Understanding the cost function calculator — concept and principle
This calculator evaluates a cubic short-run cost function TC = a + bQ + cQ² + dQ³ at a chosen output. It returns total and variable cost, average fixed, variable and total cost, marginal cost, and the output and price at minimum AVC and minimum ATC. Economics students use it to check cost-curve exercises; analysts use it with coefficients fitted to their own cost data.
How it is calculated
- Variable cost VC = bQ + cQ² + dQ³; total cost TC = a + VC
- AFC = a ÷ Q; AVC = b + cQ + dQ²; ATC = TC ÷ Q
- Marginal cost MC = dTC/dQ = b + 2cQ + 3dQ²
- Minimum AVC at Q = −c ÷ (2d) (when c < 0 and d > 0)
- Minimum ATC where 2dQ³ + cQ² − a = 0, solved numerically
Q is in units; costs are in whatever money unit the coefficients use.
The principle
A negative c and positive d give the classic U-shaped cost curves: costs per unit first fall as specialisation and better use of fixed inputs help, then rise as diminishing returns set in. Marginal cost is the slope of total cost. Whenever MC is below an average, it pulls the average down; above, it pulls it up. So MC crosses AVC and ATC exactly at their minimum points. For a competitive firm, minimum AVC is the short-run shutdown price and minimum ATC is the break-even price.
Worked example
Defaults: a = 1,000, b = 40, c = −0.6, d = 0.01, Q = 40.
- VC = 40 × 40 − 0.6 × 1,600 + 0.01 × 64,000 = 1,600 − 960 + 640 = 1,280; TC = 2,280.
- AFC = 1,000 ÷ 40 = 25; AVC = 1,280 ÷ 40 = 32; ATC = 2,280 ÷ 40 = 57.
- MC = 40 + 2(−0.6)(40) + 3(0.01)(1,600) = 40 − 48 + 48 = 40.
- Minimum AVC at Q = 0.6 ÷ 0.02 = 30, where AVC = 40 − 18 + 9 = 31.
- Minimum ATC: 0.02Q³ − 0.6Q² − 1,000 = 0 gives Q = 50, where ATC = 2,750 ÷ 50 = 55.
| Output Q (units) | Total cost TC(Q) |
|---|---|
| 10 | 1,350 |
| 20 | 1,640 |
| 30 | 1,930 |
| 40 | 2,280 |
| 50 | 2,750 |
| 60 | 3,400 |
| 80 | 5,480 |
How to read the result
At Q = 40, MC (40) is below ATC (57), so producing more would still lower average total cost, until Q = 50. If the market price is below 31, a competitive firm would do better to shut down in the short run; between 31 and 55 it covers variable costs but not all fixed costs; above 55 it makes an economic profit.
Common mistakes
- Entering a positive c with d = 0, which gives no AVC minimum.
- Mixing up AVC (no fixed cost) and ATC.
- Using coefficients fitted in thousands with outputs in units.
- Reading the curve far outside the output range used to fit it.
Frequently asked questions
Why does marginal cost cross average cost at its minimum?
Adding a unit that costs less than the average lowers the average; one that costs more raises it. The average is lowest where they are equal.
What is the shutdown price?
The minimum of AVC. Below it, revenue does not even cover variable costs.
How do I get the coefficients?
Fit a cubic regression to observed total cost at several output levels.
Sources: OpenStax, Principles of Microeconomics, section 7.2 "The Structure of Costs in the Short Run" · OpenStax, Principles of Microeconomics, section 8.2 "How Perfectly Competitive Firms Make Output Decisions"