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?
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.
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
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}$