Lagrange Multiplier problem gives wrong answer for Sphere problem.
I am studying partial differential equations to solve boundary problems. I am attempting to solve the following problem:
Textbook: The temperature at a point $(x, y, z)$ in the ball $x^2+y^2+z^2 ≤ 1$ is given by $T = y^2+xz$. Find the largest and smallest values which $T$ takes (a) on the circle $y = 0, x^2 + z^2 = 1$, (b) on the surface $x^2 + y^2 + z^2 = 1$, (c) in the whole ball.
My approach was the following.
$a)$ I noticed how the coordinates of the circle can be written with sine and cosine. Thus, $T=sin\theta cos\theta$. Which maximizes at $\theta=45^o$. From there $x,z=\frac{\sqrt2}{2}$. Therefore, $T_{min}=-\frac{1}{2}$ and $T_{max}=\frac{1}{2}$. I could have used the Lagrange method but I think that gives a wrong answer (maybe I used it wrong). Can someone show me how to use the method for part $(a)$? I've included the following for completeness.
$b)$ Since $y^2>0$ then $T_{min}$ must rely on $y=0$ because otherwise, the summation would be smaller. Thus, $T_{min}=0+az_{min}=-\frac12$. Now, the max I'm not really sure of. From $x^2+y^2+z^2=1$ we get $y=\sqrt{1-x^2-z^2}$. I could differentiate or simply see that $y$ is maximized if $x,z=0$ because of simple arithmetics. Thus, since $xz_{max}<1$ I could say $T_{max}=1$ but I left out a bunch of combinations where $xz\ne0$ and $y\ne1$. Therefore, I used the Lagrange method to state $F=y^2+xz+\lambda(x^2+y^2+z^2)$. Therefore,
$f_x=z+2x\lambda=0$,
$f_y=z+2x\lambda=0$,
$f_z=z+2x\lambda=0$.
Some algebra later, I got $x=0, z=0$ and $y=1$. I also got $y=0$ which interestingly gives rise to the first part. Therefore, $T_{max}=1$ and $T_{min}=\frac{-1}{2}$. .
Now $(c)$. My guess is that inside the sphere, $T$ assumes values that are less than on the surface simply because the maximum and minimum temperature are equal to the radius of the sphere. Therefore, any point within the sphere has a lesser radius and thus lesser max/min. Therefore, $T_{max}=1$ and $T_{min}=\frac{-1}{2}$.
Can someone please explain why the Lagrange method didn't work in the first part?
Solution 1:
For (a) you can either recall that $y$ exists or just forget about it entirely. Supposing you forget about it, you have $T(x,z)=xz,\nabla T=\langle z,x \rangle,\nabla g = \langle 2x,2z \rangle$, so the Lagrange condition is $z=2\lambda x,x=2 \lambda z$. Plug the first into the second to get $x=4\lambda^2 x$, so either $x=0$ or else $4\lambda^2=1$. $x=0$ going back into the Lagrange equations yields $z=0$ which is not consistent with the constraint, so you can discard that. With $4\lambda^2=1$ you have $2\lambda=\pm 1$ which gets you the four possible "$\pi/4$" angles.
For (b), you have $\nabla T=\langle z,2y,x \rangle,\nabla g=\langle 2x,2y,2z \rangle$, so the Lagrange condition is $z=2\lambda x,2y=2\lambda y,x=2\lambda z$. The middle equation gives either $\lambda=1$ or $y=0$. With $y=0$ you reduce to the previous case. With $\lambda=1$, you have $z=2x,x=2z$ which forces them to be zero. So you have $(0,1,0)$ and $(0,-1,0)$ as possibilities now, in addition to the four possibilities from before.
For (c) you add in the interior for which you need to solve $\nabla T=0$, from which you immediately get $(0,0,0)$. So in total you have seven candidates for the extrema on the whole ball.
Solution 2:
So for Lagrange multipliers you need to keep 2 things in mind.
(i) What is the function $f(x,y,z)$ I am investigating?
(ii) What is the constraint $g(x,y,z)=c$ for $c$ a constant?
Next you want to solve $\nabla f = \lambda \nabla g$ for $\lambda$ and use the(those) value(s) of $\lambda$ to find your critical points subject to your initial constraint.
In your question
$f=T=y^{2}+xz \quad $ and $\quad g=x^{2}+y^{2}+z^{2}$
$\nabla f = (z,2y,x) \quad $ and $\quad \nabla g = (2x,2y,2z)$
for (a) setting $y=0$ we get $(z,0,x)=\lambda(2x,0,2z)$ and so we need to solve the system
$z=2\lambda x$
$x=2\lambda z$
$x^{2}+z^{2}=1$
which after a brief calculation gives 4 critical points which we need to evaluate $f$ at.
- $T\left(\sqrt{\frac{1}{2}},0,\sqrt{\frac{1}{2}}\right)=\frac{1}{2}$
- $T\left(-\sqrt{\frac{1}{2}},0,-\sqrt{\frac{1}{2}}\right)=\frac{1}{2}$
- $T\left(\sqrt{\frac{1}{2}},0,-\sqrt{\frac{1}{2}}\right)=-\frac{1}{2}$
- $T\left(-\sqrt{\frac{1}{2}},0,\sqrt{\frac{1}{2}}\right)=-\frac{1}{2}$
i.e. Two critical points have a $T_{max}=\frac{1}{2}$ and two critical points have a $T_{min}=-\frac{1}{2}$
for (b) we get $(z,2y,x)=\lambda(2x,2y,2z)$ and so we need to solve the system
$z=2\lambda x$
$2y=2\lambda y$
$x=2\lambda z$
$x^{2}+y^{2}+z^{2}=1$
From the second equation either $y=0$ or $\lambda=1$. When we choose $y=0$ the solution is just the same as (a) when we choose $\lambda=1$ we get $x=z=0$ and $y=\pm1$ so the 2 additional critical points in addition to the previous 4 are
- $T\left(0,1,0\right)=1$
- $T\left(0,-1,0\right)=1$
i.e. Two critical points have a $T_{max}=1$ and two critical points have a $T_{min}=-\frac{1}{2}$
for (c) the only change is that your system is now
$z=2\lambda x$
$2y=2\lambda y$
$x=2\lambda z$
$x^{2}+y^{2}+z^{2}\leq 1$
which reduces to (b) with the condition that $y^{2}\leq 1$ which has the same critical points $y=\pm 1$ giving a maximum for $T$ in addition to the point $y=0$ giving a value $T(0,0,0)=0$. While this is a critical point there is nothing special about $T=0$ as this happens at multiple points, e.g. $T(0,0,1)=0$ still satisfies the constraint $x^2+y^2+z^2 \leq 1$. So two critical points have $T_{max}=1$ and 2 critical points have $T_{min}=-\frac{1}{2}$