Rearranging a formula, transpose for A2 - I'm lost Given the formula:
$$ q = A_1\sqrt\frac{2gh}{(\frac{A_1}{A_2})^2-1} $$
Transpose for $A_2$
I have tried this problem four times and got a different answer every time, none of which are the answer provided in the book. I would very much appreciate if someone could show me how to do this step by step. 
The answer from the book is:
$$ A_2=\sqrt\frac{A_1^2q^2}{2A_1^2gh+q^2} $$
The closest I can get is the following:
$$ q = A_1\sqrt\frac{2gh}{(\frac{A_1}{A_2})^2-1} $$
$$ \frac{q^2}{A_1^2} = \frac{2gh}{(\frac{A_1}{A_2})^2-1} $$
Invert:
$$ \frac{A_1^2}{q^2} = \frac{(\frac{A_1}{A_2})^2-1}{2gh} $$
Multiply both sides by $2gh$:
$$ 2gh\frac{A_1^2}{q^2} = (\frac{A_1}{A_2})^2-1 $$
$$ \frac{2ghA_1^2}{q^2} = (\frac{A_1}{A_2})^2-1 $$
Add 1 to both sides and re-arrange:
$$ \frac{A_1^2}{A_2^2} = \frac{2ghA_1^2}{q^2} +1 $$
Invert again:
$$ \frac{A_2^2}{A_1^2} = \frac{q^2}{2ghA_1^2} +1 $$
Multiply by $A_1^2$:
$$ A_2^2 = \frac{A_1^2q^2}{2ghA_1^2} +1 $$
Get the square root:
$$ A_2 = \sqrt{\frac{A_1^2q^2}{2ghA_1^2}+1} $$
I cannot see where the $q^2$ on the bottom of the textbook answer comes from.

$$
\begin{eqnarray*}
q &=& A_1\sqrt{\frac{2gh}{(\frac{A_1}{A_2})^2-1} }&\biggr| : A_1, (\;\;)^2\\
\left(\frac{q}{A_1}\right)^2 &=& \frac{2gh}{(\frac{A_1}{A_2})^2-1}&\biggr| (\;\;)^{-1},\cdot 2gh,+1 \\
2gh\left(\frac{A_1}{q}\right)^2+1 &=& (\frac{A_1}{A_2})^2&\biggr| (\;\;)^{-1/2},\cdot A_1\\
\pm\frac{A_1}{\sqrt{2gh\left(\frac{A_1}{q}\right)^2+1}} &=& A_2\\
\pm\sqrt{\frac{A_1^2q^2}{2ghA_1^2+q^2}} &=& \\
\end{eqnarray*}
$$
