maximize profit of competitive firm in short-run Consider a competitive firm with the short-run cost function $C(q) = 20 + 6q +5q^2$. The firm faces a market price of $p$ for its output.

(1) Find the firm's Profit Maximization problem.

(2) Find F.O.C and S.O.C.

I'm uncertain how to write the maximization problem up. As I understand competitive firm in short-run, we simple need to maximize profits minus cost by choosing the optimal quantity $q$.

So my guess is that the answer is: 

$\max_{q} p-C(q)$.

Assuming that is correct, I am then uncertain how to make sense of the S.O.C.
Is the cost given the marginal or cumulative cost? If it's the cumulative cost, then the profit is  pq-C(q): your price is money per item, so you have to multiply by the number of items to find the total gross revenue. The problem is then to maximize the profit, i.e. find $\max_{q} pq-C(q)$. 

If C(q) is the marginal cost, then the marginal profit is marginal revenue minus marginal cost, i.e. marginal profit = p-C(q).

The FOC is that the firm should keep selling the product until selling more would cause their marginal profit to go negative. For a continuous function to go from positive to negative, it has to go through zero. Thus, the FOC is that their marginal profit be zero.

While the marginal profit going from positive to negative means that it's going through zero, going through zero doesn't necessarily mean that you're going from positive to negative; you still have to check which direction it's going. So the SOC is that the marginal profit be decreasing.

FOC: marginal profit = 0
SOC: marginal profit decreasing

If the marginal profit is decreasing, then when it hits zero, it's going from positive to negative.