The Solution.
The given profit function is
[tex]P(n)=-0.02n^2+6n-21[/tex]To maximize the factory's profit, we have to differentiate the given function with respect to n, and then equate to zero.
[tex]\frac{dP}{dn}=-2(0.02)n^{2-1}+6n^{1-1}+0=0[/tex][tex]\frac{dP}{dn}=-0.04n^{}+6=0[/tex][tex]-0.04n+6=0[/tex]Solving for x, we get
[tex]-0.04n=-6[/tex]Dividing both sides by -0.04, we get
[tex]n=\frac{-6}{-0.04}=150\text{ (thousands of cookies)}[/tex]So, the number of cookies to be sold to maximize profit is 150 thousands of cookies.
To get the maximum profit that can be expected, we shall substitute 150 for n in the given profit function. That is,
[tex]P(150)=-0.02(150)^2+6(150)-21[/tex][tex]P(150)=-0.02(22500)+900-21[/tex][tex]P(150)=-450+900-21[/tex][tex]P(150)=429\text{ thousands of dollars}[/tex]Thus, the maximum profit to be expected is 429 thousands of dollars.