Can't find n (algebraic manipulation)

$$n^2 - 1 = \frac{\left(\dfrac{p^2}{q^2} - 2n\right)^2}{4}= \frac{\dfrac{p^4}{q^4} + 4n^2-4n\dfrac{p^2}{q^2} }{4}=\dfrac {p^4}{4q^4}+n^2-n\dfrac{p^2}{q^2}. $$

Subtract $n^2$ from both sides to get $$-1=\dfrac {p^4}{4q^4} -n\dfrac{p^2}{q^2} ,$$

which is $$n\dfrac{p^2}{q^2}=1+\dfrac {p^4}{4q^4}.$$

Can you take it from here (solve for $n$)?


If $$n^2 - 1 = \frac{(\frac{p^2}{q^2} - 2n)^2}{4}$$ then $$n^2 = \frac{(\frac{p^2}{q^2} - 2n)^2+4q^2}{4}$$ then $$n^2 = \frac{(p^2 - 2q^2n)^2+4q^2}{4q^2}$$ then $$4q^2n^2 = (p^2 - 2q^2n)^2+4q^2$$ then $$4q^2n^2 = 4q^4n^2-4p^2q^2n+p^4+4q^2$$ so $$0=-4p^2q^2n+p^4+4q^2$$ and finally $$n=\frac{p^4+4q^4}{4p^2q^2}$$