A perfectly competitive firm with rising marginal costs maximizes profit by producing up until the point at which marginal cost is equal to marginal revenue. The marginal revenue for a perfectly competitive firm is the market price determined by the intersection of the supply and demand curves, as shown in the panel on the left. The panel on the right shows the orange price line intersecting the purple marginal cost curve at the profit maximizing quantity, . The per unit profit is represented by the distance between the price line and the point on the U-shaped average total cost curve corresponding to . The total profit is the per unit profit times and is represented by the shaded rectangle. If the price is below the average total cost, the profit is negative and can be interpreted as the loss minimizing level of output.