The cost of producing the estimated quantities of nails is
the income is
and the profit is the income minus the cost,
If we open the parentheses, the result will be
A maximum of this function is reached or at a point where both partial derivatives are zero, or at the boundaries of the domain. There are some restrictions, at least `Xgt=0` and `Ygt=0.` Also the quantities `500(Y-X)` and `45000+500(X-2Y)` should be nonnegative. This defines a triangle domain with vertices (0, 0), (0, 45) and (90, 90) (check).
Let's start from the derivatives:
`(del/(del X)) P(X,Y) = -2X+2Y-20 = 0,` or `-X+Y-10=0,`
`(del/(del Y)) P(X,Y) = 2X-4Y+170 = 0,` or `X-2Y+85=0.`
Adding these equations we obtain `-Y+75=0,` so `Y=75.` Therefore `X=Y-10=65.`
Because of the character of `P(X,Y)` (its graph is an elliptic paraboloid vertex up) and the fact that the found point (65, 75) is in the domain (check), we may state that it is the point of maximum profit.
The profit at that point is `P(65, 75) = 500*(25*10+15*(90-85))=500*325=162500` (cedis).
The answers: (a) X=65 cedis, Y=75 cedis, (b) 162500 cedis.
There is also a graph: https://www.desmos.com/calculator/jjr0xhm5vd