Calculus max rectangle 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 zero.
My approach was;
  i took 1st and 2nd derivatives 
1st: $nx^{n-1}+ny^{n-1}y'$
2nd: $[n(n-1)x^{n-2}+n(n-1)y^{n-2}y'+y''ny^{n-1}]$
And tried to put $\sqrt{a^2-x^2}$ to the $y$ then took the derivatives  and that doesn't go anywhere too.
 A: Hint...you would find it a lot easier to do the differentiation and to analyse the different cases for $n$ if you first parametrized the variables using $$x=a\cos\theta,$$$$y=a\sin\theta$$
A: By Lagrange multipliers:  Let $g(x,y) = x^2+y^2$ and $f(x,y) = x^n+y^n$.  First assume $x$ and $y$ are positive.  The constraint is $g = a^2$.  Since the case $n=2$ is done, assume $n \neq 2.$
We have $\nabla f = (nx^{n-1},ny^{n-1})$ and $\nabla g = (2x,2y).$ So the equation $\nabla f = \lambda \nabla g$ gives us
$$nx^{n-1} = \lambda 2x, \mbox{ and } ny^{n-1} = \lambda 2y.$$
Cancel an $x$ from the first equation and a $y$ from the second:
$$nx^{n-2} = \lambda 2, \mbox{ and } ny^{n-2} = \lambda 2.$$
Conclude that $x= y.$  Then $2x^2 = a^2$ and so $x= y = a/\sqrt{2}.$
So the critical points are $(a/\sqrt{2},a/\sqrt{2})$ and the points where either $x$ or $y$ equal zero.  Then 
$$f(a/\sqrt{2},a/\sqrt{2}) = 2\left(\frac{a}{\sqrt{2}}\right)^n$$
and
$f(0,y) = y^n$ which is maximized when $y=a$.  Similarly for $f(x,0)$.  The max will be which ever value is greater.
