*********************************************************************************
There is an error or typo somewhere in one of your modeling functions.
*********************************************************************************
Normally we can solve this in 2 different ways using Calculus or Algebra 2.
First we recognize that profit = demand price - cost, so we can say that profit P is a function of quantity q with
P(q) = 500 - 0.5q^2 -50q - 40
Method 1 using calculus:
===================
Find P'(q) and set it equal to zero. However, given your modeling functions we will end up with a negative quantity q = -50.
Next we would plug in our quantity q that we just found into our profit function P(q) to calculate the maximum profit.
Method 2 using Algebra 2:
====================
We recognize that P(q) is a quadratic function whose graph is a parabola. We know it opens downward, so its vertex must be the point of maximum profit.
We can find the vertex easily using q = -b/2a, but again this gives us a negative quantity q = -50.
Next we would plug in our quantity q that we just found into our profit function P(q) to calculate the maximum profit.