# Rational Number of a given fraction

Find all rational numbers $\frac pq$ such that $\frac pq=\frac {p^2 +30}{q^2 +30}$. How can I go about it. If I substitute p and q by real values $\frac pq$ gets innumerable rational numbers

After cross-multiplying,

\begin{align*} p(q^2 + 30) - q(p^2 + 30) &= 0 \\ pq(q - p) - 30(q - p) &= 0 \\ (pq - 30)(q - p) &= 0 \end{align*}

You can take it from here.

Assuming $p,q$ to be coprime integers,

On cross multiplication & simplification we have $$(p-q)(p\cdot q-30)=0$$

As $(p,q)=1$ if $p=q,p=q=1$

Otherwise, $p\cdot q=30$ which does have finite number of solutions