A perfectly competitive firm can sell its product at a market price of $10 per unit. The total costs incurred by the firm if X products are produced is given by TC = 10 + 2X + 0.25X^2. The revenue earned when X units are sold is 10*X. This gives the profit made when X units are sold as P = 10X - 10 - 2X - 0.25*X^2 = 8X - 10 - 0.25*X^2.

To determine the number of units that need to be produced to maximize profits, the first derivative of P with respect to X, P', has to be determined, this should be equated to 0 and the resulting equation solved for X.

P' = 8 - 0.5X

8 - 0.5X = 0

=> X = 16

The firm should produce 16 units to maximize its profits. The maximum profits earned by the firm are $54.