As we know, a profit maximizing firm will produce where Marginal Revenue = Marginal Cost. As we also know, Marginal Revenue = Market Price for a perfectly
competitive firm so the firm will produce where MC = P.
As shown in the graph below, if the price is 20, MC = P at an output of 8 so the firm will produce 8 units when the price is 20.