Maximize the following equation under a constraint Maximize $g(x,y)=x^4+y^4$ on $x^2+y^2=9$.
Our professor had sped through it and I didn't fully understand how they arrived at the answer. Some clarification on it would be greatly appreciated. I have attached the writing below:


Since we are finding a maximum on a circle centered at the origin it makes sense to convert both equations to polar coordinates:
\begin{eqnarray} g(r,\theta)&=&(r\cos\theta)^4+(r\sin\theta)^4\\
                            &=&r^4(\cos^4\theta+\sin^4\theta)\\
\frac{dg}{dr}&=&4r^3(\cos^4\theta+\sin^4\theta)=0\\
\frac{dg}{d\theta}&=&-4r^4\cos^3\theta\sin\theta+4r^4\sin^3\theta\cos\theta\\
&=&-4r^4\sin\theta\cos\theta(\cos^2\theta-\sin^2\theta)\\
&=&-2r^4(2\sin\theta\cos\theta)(\cos^2\theta-\sin^2\theta)\\
&=&-2r^4\sin(2\theta)\cos(2\theta)\\
&=&-r^4\sin(4\theta)=0
 \end{eqnarray}
So extrema should occur when $\sin(4\theta)=0$. And $\sin(4\theta)=0$ only when $4\theta$ is a whole multiple of $\pi$. Thus you must check points of the circle corresponding to multiples of $\dfrac{\pi}{4}$.
You should find that the minima occur when $\theta$ is an odd multiple of $\dfrac{\pi}{4}$ and the maxima will occur when $\theta$ is an even multiple of $\dfrac{\pi}{4}$ (i.e. a multiple of $\dfrac{\pi}{2})$.
$$g\left(3,\frac{\pi}{4}\right)=g\left(3,\frac{3\pi}{4}\right)=g\left(3,\frac{5\pi}{4}\right)=g\left(3,\frac{7\pi}{4}\right)=\left(\pm\frac{3}{\sqrt{2}}\right)^4+\left(\pm\frac{3}{\sqrt{2}}\right)^4=\frac{81}{2}$$
$$g(3,0)=g\left(3,\frac{\pi}{2}\right)=g\left(3,\pi\right)=g\left(3,\frac{3\pi}{2}\right)=3^4=81$$
