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