Final answer:
In a perfectly competitive market, firms adjust their output in the short run so that marginal cost equals marginal revenue (MC = MR), which is also equal to the price (P). This allows firms to maximize profits. In the long run, the entry of new firms due to initial profits leads to no economic profits as P = MR = MC = AC.
Step-by-step explanation:
A firm in a perfectly competitive environment adjusts its output to price changes in the short run by equating marginal cost (MC) with marginal revenue (MR). In the short run, if the market price (P) changes due to an increase in demand, perfectly competitive firms respond by adjusting output to the point where P = MR = MC. This is because, in perfect competition, a firm's marginal revenue is equal to the market price. Firms make these decisions to achieve profit maximization. If the market price is above the firm's average cost (AC) at this output level, the firm will make a profit. Conversely, if the market price is below the firm's average cost, it will incur losses.
However, in the long run, short-run profits attract new firms, leading to an increase in supply which in turn lowers the market price. Eventually, the market reaches a new long-run equilibrium with firms earning zero economic profits where P = MR = MC = AC. No firm has the incentive to enter or leave the market at this point.