Building the Supply Curve
The supply curve of a firm operating in a competitive market can be derived from its marginal cost curve. The supply curve represents the firm's optimal production quantity at each price level. This optimal quantity is the one that enables the firm to maximize its profit.
profit = pq - cv(q) - CF
If the firm produces nothing (q=0), it incurs a loss equal to its fixed costs (CF). In the short run, the firm considers only the variable costs of production. The minimum production condition can be expressed as follows:
pq - cv(q) > 0
Through some algebraic manipulation, we can highlight the average variable cost on the left-hand side of the inequality and the selling price on the right:
cv(q)/q < p
In short, a firm will choose to produce only if the price exceeds the average variable cost. In perfect competition, the optimal condition is met when the price equals the marginal cost curve (P = MC). Thus, in the short run, the upward-sloping portion of the marginal cost curve above the average variable cost can be considered the firm's supply curve.

Producer Surplus. Producer surplus is the difference between the market price and the minimum price (shutdown price) at which the firm is willing to produce and sell its goods.
