The maximum and minimum of a function occurs when the derivative of a function is equal to 0. To find the value of x that minimises a function find the derivative and put it equal to 0 and solve the equation you get for x.

The monthly revenue is the demand multiplied by the price. That's x*p(x)

The profit is revenue - cost. That's x*p(x) - C(x)

Now you have the function for profit