Finding Maximum Area of a Rectangle in an Ellipse 
Question: A rectangle and an ellipse are both centred at $(0,0)$.
       The vertices of the rectangle are concurrent with the ellipse as shown
  
Prove that the maximum possible area of the rectangle occurs when the x coordinate of
  point $P$ is $x = \frac{a}{\sqrt{2}} $


What I have done
Let equation of ellipse be 
$$ \frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$
Solving for y
$$ y = \sqrt{ b^2 - \frac{b^2x^2}{a^2}} $$
Let area of a rectangle be $4xy$
$$ A = 4xy $$
$$ A = 4x(\sqrt{ b^2 - \frac{b^2x^2}{a^2}}) $$
$$ A'(x) = 4(\sqrt{ b^2 - \frac{b^2x^2}{a^2}}) + 4x\left( (b^2 - \frac{b^2x^2}{a^2})^{\frac{-1}{2}} \times \frac{-2b^2x}{a^2} \right) $$
$$ A'(x) = 4\sqrt{ b^2 - \frac{b^2x^2}{a^2}} + \frac{-8x^2b^2}{\sqrt{ b^2 - \frac{b^2x^2}{a^2}}a^2} = 0 $$
$$ 4a^2\left(b^2 - \frac{b^2x^2}{a^2} \right) - 8x^2b^2 = 0 , \sqrt{ b^2 - \frac{b^2x^2}{a^2}a^2} \neq 0 $$
$$ 4a^2\left(b^2 - \frac{b^2x^2}{a^2} \right) - 8x^2b^2 = 0 $$
$$ 4a^2b^2 - 4b^2x^2 - 8x^2b^2 = 0  $$
$$ 4a^2b^2 - 12x^2b^2 = 0  $$
$$ 12x^2b^2 = 4a^2b^2 $$
$$ x^2 = \frac{a^2}{3} $$
$$ x = \frac{a}{\sqrt{3}} , x>0 $$
Where did I go wrong?
edit:The duplicate question is the same but both posts have different approaches on how to solve it so I don't think it should be marked as a duplicate..

Your mistake is here
$$
A'(x) = 4(\sqrt{ b^2 - \frac{b^2x^2}{a^2}}) +\color{red}{\frac12} \times4x\left( (b^2 - \frac{b^2x^2}{a^2})^{\frac{-1}{2}} \times \frac{-2b^2x}{a^2} \right).
$$
