Rectangle in a circle of radius a that maximizes x^n+ y^n 
Consider a rectangle with sides $2x$ and $2y$ inscribed in a given fixed circle $$x^2 + y^2 = a^2,$$ and let $n$ be a positive number. We wish to find the rectangle that maximizes the quantity $$z = x^n + y^n.$$ If $n = 2$, it is clear that $z$ has the constant value $a^2$ for all rectangles.

*

*If $n < 2$, show that the square maximizes $z$; and

*if $n > 2$, show that $z$ is maximized by a degenerate rectangle in which $x$ or $y$ is $0$.


My approach.
$$x^2 + y^2 = a^2$$
$$\therefore\, y = (a^2 - x^2)^{1\over 2}$$
\begin{align}
z &= x^n + y^n \\
{d\over dx}z & = nx^{n-1} - nx(a^2-x^2)^{n-2\over 2}
\end{align}
Equating with $0$ gives:
$$nx^{n-1} = nx(a^2-x^2)^{n-2\over 2}$$
$$x^{n-2} = (a^2 - x^2)^{n-2\over 2}$$
Squaring on both sides gives:
$$(x^2)^{n-2} = (a^2 - x^2)^{n-2}$$
Taking $\ln$ on both sides gives
$$(n-2) \ln(x^2) = (n-2)\ln(a^2 - x^2)$$33
Equating $x^2 = a^2 - x^2$ , we get $x = {a\over \sqrt{2}}$ and $y = {a\over\sqrt{2}}$. In particular $x=y$ implies that the optimal rectange is a square.
My computation appears to be independent of $n$, so I am puzzled about the statement in the question for $n>2$ and $n<2$.
 A: Alternative way, without calculus.

*

*If $\,n \le 2\,$ then by the generalized means inequality $\,\left(\frac{x^n+y^n}{2}\right)^{1/n} \le \left(\frac{x^2+y^2}{2}\right)^{1/2}=\frac{a}{\sqrt{2}}\,$. The maximum is attained when the equality is achieved, for $\,x=y\,$ i.e. the square.


*If $\,n \gt 2\,$ then $\,x^n+y^n=(x^2)^{n/2}+(y^2)^{n/2} \le (x^2+y^2)^{n/2} = a^n\,$ with equality for $\,x=0\,$ or $\,y=0\,$, since $\,x^2/a^2, \,y^2/a^2 \le 1\,$ so $\,(x^2/a^2)^{n/2}+(y^2/a^2)^{n/2} \le x^2/a^2+y^2/a^2 = 1\,$.
A: ${d\over dx}z$ =
$nx^{n-1}$ - $nx(a^2-x^2)^{n-2\over 2}$
Equating with $0$ gives
$x= {a\over \sqrt {2}}$ so, $y =  {a\over \sqrt {2}}$
and $x= 0$ so, $y = a$
Now on double differentiating z
${d^2\over dx^2}z$ = $n(n-1)x^{n-2} - n(a^2 - x^2)^{n-2\over 2} + n(n-2)x^2(a^2 - x^2)^{n-4\over 2}$
At $x= {a\over \sqrt {2}}$,
${d^2\over dx^2}z$ simplifies to be $2n(n-2)({a^2\over 2})^{n-2\over 2}$
So, if $n<2$,
${d^2\over dx^2}z$ At $x= {a\over \sqrt {2}}$ is < $0$
So, at $x= {a\over \sqrt {2}}$, Z = maximum when $n<2$ and minimum when $n>2$
When $ n < 2$
At $x =0$ ${d^2\over dx^2}z$ is undefined due to the term $n(n-1)x^{n - 2}$ = $n(n-1)$$({1\over 0})^{2 - n}$
When n>2
At $x = 0$
${d^2\over dx^2}z$ simplifies to be $-n(a^2)^{n-2\over 2}$ which is $< 0$ as $n > 0$
So $z$ is maximum at $x = 0$
This shows that when $n<2$ maximum value of $z$ occurs when $x = y = {a\over \sqrt {2}}$ thus a square
When $n= 2$, $z$ simply equates to $a^2$
When n > 2 $z$ is maximum when $x = 0$ , $y = a$ and since $x$ and $y$ are symmetric so they are interchangeable this means z is also maximum when $x = a$ , $y = 0$
and thus it is a degenerate rectangle which gives maximum value of $z$ when $n>2$
A: For $n < 2$ your expression for $\frac{dz}{dx}$ is not defined where $y = 0$, so one must check those points separately. Also, between the two equations following, "equating it with $0$...", division by $0$ assumes that $x \neq 0$.

Here's an alternative approach: This problem is a typical candidate for the method of Lagrange multipliers, and applying that method has the advantage that it leaves $x$ and $y$ on equal footing and in particular avoid the complications introduced by solving (partially) for $y$ in terms of $x$.
Our objective function is $$f(x, y) := x^n + y^n ,$$ and our constraint is $g(x, y) = 0$, where
$$g(x, y) := x^2 + y^2 - a^2 .$$ (Herein I'll assume $a > 0$, so that the circle is nondegenerate.)
By symmetry we may as well assume that any (constrained, local) extremum $(c, d)$ lies in the closed first quadrant, i.e., are both nonnegative.

In fact, if $c = 0$, then the constraint implies $d = a$, and vice versa, so if a (constrained, local) extremum occurs where $c = 0$ or $d = 0$, its value is $f(a, 0) = f(0, a) = a^n$, and we may as well restrict the rest of our search to the interior of the first quadrant, i.e., the case $c, d > 0$.

The method of Lagrange multipliers yields that any (constrained, local) extremum $(c, d)$ satisfies $$(\nabla f)(c, d) = \lambda (\nabla g)(c, d) ,$$
that is, the system
\begin{align}
n c^{n - 1} &= 2 c \lambda \\
n d^{n - 1} &= 2 d \lambda .
\end{align}

Dividing the first equation by the second equation and rearranging yields $c^{n - 2} = d^{n - 2}$, so either (a) $n = 2$ (which corresponds to the tautology that there is a maximum at every point on the unit circle), or (b) the only critical point is $c = d = \frac{a}{\sqrt{2}}$. In the latter case computing gives $f\left(\frac{a}{\sqrt{2}}, \frac{a}{\sqrt{2}}\right) = a^n (\sqrt{2})^{2 - n} ,$ and whether this quantity is greater than $f(a, 0) = f(0, a) = a^n$ manifestly depends just on the sign of $2 - n$.

