# Local Maximum of a function

In a problem, I'm asked to find the local maximum of the function: $$\rho_v = (\rho^2 - 10^{-4})z\sin(2\phi)$$ over the solid: \begin{align*} 0.005 &\leq \rho \leq 0.02 \\ 0 &\leq \phi \leq \frac{\pi}{2} \\ 0 &\leq z \leq 0.04 \end{align*}

Differentiating, I get the following system: \begin{cases} 2\rho z \sin(2\phi) &= 0 \\ (\rho^2 - 10^{-4}) z \cos(2\phi) &= 0 \\ (\rho^2 - 10^{-4}) \sin(2\phi) &= 0 \end{cases}

While solving, I get from the first two partial derivatives that ($\phi = 0$ or $\phi = \frac{\pi}{2}$) and that $\phi = \frac{\pi}{4}$. Clearly, that's not possible, the original function doesn't have critical points. (Or maybe these two cases are not mutually exclusive, but I learned that between the equations I use an AND.)

However, inspecting the function I can affirm that it have a local maximum with $\rho = 0.02$, $\phi = \frac{\pi}{4}$ and $z = 0.04$. What I don't know is how to find those values explicitly, that is, without guessing.

-
In order for a product to be $0$, only one factor needs to be $0$. If $(\rho^2-10^{-4})=0$, $\phi$ can be whatever you want and $(\rho^2-10^{-4})z\cos(\phi)=0$ just because your first factor is $0$. The same holds for the third equation in your system. After having found values for $\rho$ and $\phi$ such that all your equations are $0$, your function is linear in $z$ and so takes the maximum on the border, that is why $z=0.04$. – martin.koeberl Dec 19 '12 at 18:15
The function does have critical points within the specified domain. For example, when $\phi = 0$ and $z = 0$, all three partial derivative vanish; this is true for all $\rho$. – Fly by Night Dec 19 '12 at 18:22
@martin.koeberl I think I'm confusing the operations "or" and "and" while solving the system. I'll try to review the steps, but the answer below explains the solution in general. – osmano807 Dec 20 '12 at 0:01
@FlybyNight It seems that I do not understand well the order of "or" and "and." In the first equation, it follows that $\phi = 0$ or $\phi = \frac {\pi} {2}$, but the second equation also says that $\phi= \frac {\pi} {4}$. For me, this is a contradiction, but maybe I'm not correctly evaluating the logical operations. – osmano807 Dec 20 '12 at 0:02
@osmano807 In the first equation, $\rho = 0$ or $z=0$ or $\phi = 0$ or $\phi = \pi/2$. You need to consider each case one by one. Assume that $\rho = 0$, the first equation is satisfied then the second equation tells us that $z=0$ or $\phi = \pi /4$. This again gives two cases, which we need to consider one by one. Assume that $z = 0$ (as well as $\rho = 0$). The first two equations are satisfied and we need $\phi = 0$ or $\phi = \pi/2$ for the third equation to hold. Thus $(\rho,z,\phi) = (0,0,0)$ and $(\rho,z,\phi) = (0,0,\pi/2)$ are two solutions. Repeat this process for all cases. – Fly by Night Dec 20 '12 at 0:55

We are told to find the local maxima of the function $$f(r,z,\phi):=(r^2-10^{-4})z\sin(2\phi)$$ in a certain box region in $(r,z,\phi)$-space. Looking at the data it becomes obvious that such maxima are taken in points where $z=0.04$, $\ \phi={\pi\over4}$, because for every allowed point $(r,z,\phi)$ with $z<0.04$ or $\phi\ne{\pi\over4}$ there is a nearby allowed point $(r',z',\phi')$ with $f(r',z',\phi')>f(r,z,\phi)$.
It follows that it suffices to consider the univariate function $$g(r):=r^2-10^{-4}\qquad(0.005\leq r\leq0.02)\ .$$ Solving $g'(r)=2r=0$ shows that $g$ has no critical point in the interval $[0.005, 0.02]$. Furthermore $$g(0.005)=-0.000075<0.0003=g(0.02)\ .$$ It follows that $g$ takes its maximum at the right endpoint of its domain. Therefore the point $\bigl(0.02,0.04,{\pi\over4}\bigr)$ is the unique point in the allowed region where $f$ is locally maximal, and $f\bigl(0.02,0.04,{\pi\over4}\bigr)=0.000012$ is the global maximum of $f$ in this region.