# The solutions to $x^2+y^2=5$ in $\mathbb{Q}$. [duplicate]

Consider the following equation: $$x^2+y^2=5.\tag{1}$$ What are the solutions to this equation if $x,y\in\mathbb{Q}$, where $\mathbb{Q}$ is the set of all rational numbers?

My attempt: Because $x,y\in\mathbb{Q}$, we can set $x=a/b$ and $y=c/d$, where $a,b,c,d\in\mathbb{Z}$, $b\neq0$, $d\neq0$, gcd$(a,b)=1$, gcd$(c,d)=1$. $\mathbb{Z}$ is the set of all integers and gcd$(a,b)$ denotes the greatest common divisor of $a$ and $b$.

Then the original equation (1) can be rewritten as $$\left(\frac{a}{b}\right)^2+\left(\frac{c}{d}\right)^2=5.\tag{2}$$ When $a=0$, we have $c/d=\pm\sqrt{5}$. In this case, there is no solution for $c$ and $d$ in integers because $\pm\sqrt{5}$ are irrational numbers. Similarly, when $c=0$ we know that there is no solution for $a$ and $b$ in integers.

When $a\neq0$ and $c\neq0$, we rewrite equation (2) as \begin{aligned} a&=\pm\sqrt{b^2[5-(c/d)^2]}\\ &=\pm|b|\sqrt{5-(c/d)^2}\\ &=\pm|b|\sqrt{\frac{5d^2-c^2}{d^2}}\\ &=\pm\left|\frac{b}{d}\right|\sqrt{5d^2-c^2}\tag{3}. \end{aligned} In order to make $a\in\mathbb{Q}$, we must have $$5d^2-c^2=e^2\tag{4}$$ for some $e\in\mathbb{Z}$. Then I don't know how to continue. Any comments and answers are welcome. Thank you very much!

## marked as duplicate by Stefan4024, Yiyuan Lee, hardmath, Davide Giraudo, Gerry MyersonMar 30 '14 at 11:37

• Note that the reduction from (1) to (4), $c^2 + e^2 = 5d^2$, can be made directly (by "clearing denominators" in rational $x,y$), but that in answering the duplicate Q, @GerryMyerson tackles the rational points on the circle with a technique that works for any conic with integral coefficients and (at least one) rational point. – hardmath Mar 30 '14 at 11:38