# Find naturals numbers $p$ and $q$ such that $\frac{\sqrt{p^2+7}}{\sqrt{q^2-3}}$ is rational

Find naturals numbers $p$ and $q$ such that $\frac{\sqrt{p^2+7}}{\sqrt{q^2-3}}$ is rational

i have taken $$\frac{\sqrt{p^2+7}}{\sqrt{q^2-3}}=\frac{a}{b}$$ where $a$ and $b$ are positive integers which are co prime then after simplification we get

$$3a^2+7b^2=(aq-bp)(aq+bp)$$

$$3(a^2+b^2)+4b^2=(aq-bp)(aq+bp)$$

Obviously $a$ and $b$ both cannot be even since they are co prime

but now if i consider other cases i could not find $p$ and $q$...i will be happy if i get any hint

• hint: don't make a system of equations. just consider the numerator and denominator separately; you want them both to be integers. May 2, 2017 at 3:12
• Ok fine got it $p=3$ and $q=2$ May 2, 2017 at 3:18
• but what i thought is even though both are irrational ratio can be rational like $\frac{\sqrt{3}}{2\sqrt{3}}$ is a rational May 2, 2017 at 3:20
• If $p^2 + 7 = a^2*k$ and $q^2 - 3 = b^2*k$ we are still solving for integers May 2, 2017 at 3:33
• Here are all solutions $p$, $q$, $r=\displaystyle\frac{\sqrt{p^2+7}}{\sqrt{q^2-3}}$ for $p\in[1,10^6]$, $q\in[1,200]$: $$p=3,\quad q=2,\quad r= 4$$ $$p=9,\quad q= 5,\quad r= 2$$ $$p=27,\quad q= 7,\quad r= 4$$ $$p=75,\quad q= 5,\quad r= 16$$ $$p=3147,\quad q= 7,\quad r= 464$$ $$p=3621,\quad q= 5,\quad r= 772$$ $$p=4779,\quad q= 14,\quad r= 344$$ $$p=5979,\quad q= 19,\quad r= 316$$ $$p=14379,\quad q= 16,\quad r= 904$$ $$p=29559,\quad q= 5,\quad r= 6302$$ $$p=124419,\quad q= 26,\quad r= 4796$$ $$p=784419,\quad q= 16,\quad r= 49316$$
– Alex
May 2, 2017 at 4:06

If $\dfrac{p^2+7}{q^2-3} = \dfrac{a^2}{b^2}$, where $\gcd(a,b) = 1$, then there is a positive integer $r$ such that $$\begin{cases}p^2 - ra^2 = -7& \\ q^2 - rb^2 = 3. & \end{cases}$$
For each $r$ we have two independent generalized Pell's Equations. There are several algorithms to find the solutions to this equations. I suggest you read the ones here.