# Economic Ordering Quantity

- Author:
- Mike May

This applet looks at economic ordering quantity, or EOQ.
For each order there is a cost of setting up an order. That cost is inversely proportional to the order size, so it is minimized by having few orders, but of large size.
Based on order size, there is also a cost of holding inventory. That cost is proportional to the order size, so it is minimized by having many small orders.
We are interested in minimizing the total cost from these two factors.

## Explaining the equations

For our simplified model the holding cost computed as the cost of holding one unit is storage for a year times the average number of units we will be holding, or half an order's worth of units.
If H is the cost of holding one unit for a year, and Q is the number of units per order, then our annual holding cost is Q(H/2).
We also assume that the cost of making the orders is simply the number of orders
If D is the annual demand, Q is the size of an order, and S is the cost of processing an order, then the cost of processing orders is S(D/Q).
The total cost is Q(H/2)+S(D/Q)

## A bit of calculus

We want to find a Q that minimizes total cost. In calculus terms, we want the derivative of total cost with respect to Q to be zero.
If you remember the formulas for differentiation from calculus that derivative is
(H/2)-SD/Q^2.
Solving for Q, this happens when .
(You should play with the sliders in the applet and verify that this happens for all choices of values.
By coincidence this also happens when the Cost of ordering equals the cost of holding.