<s>[INST] 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.
 [/INST] \begin{align}
   q &= A_1\sqrt\frac{2gh}{\left(\frac{A_1}{A_2}\right)^2-1} \\
   \frac{q^2}{A_1^2} &= \frac{2gh}{\left(\frac{A_1}{A_2}\right)^2-1} \\
   \left(\frac{A_1}{A_2}\right)^2-1 &=\frac{2ghA_1^2}{q^2} \\
   \frac{A_1}{A_2} &= \sqrt\frac{2ghA_1^2 + q^2}{q^2} \\
   A_2 &= A_1\sqrt\frac{q^2}{2ghA_1^2 + q^2} \\
\end{align}
</s>