This question already has an answer here:

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 Myerson Mar 30 '14 at 11:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Bah, here I was writing about how to show such equations have no solutions (when that is the case), and it turns out this is one of the equations that do have solutions. :( $\endgroup$ – Hurkyl Mar 30 '14 at 11:13
  • $\begingroup$ You might look at the expression of integers as the sum of two squares, which is well known. Or begin by noting that 4d2−c2=e2−d2 i.e. (4d+c)(4d−c)=(e+d)(e−d) $\endgroup$ – Mark Bennet Mar 30 '14 at 11:22
  • $\begingroup$ 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. $\endgroup$ – hardmath Mar 30 '14 at 11:38
  • 1
    $\begingroup$ See also math.stackexchange.com/questions/225764/… $\endgroup$ – Gerry Myerson Mar 30 '14 at 11:38
  • $\begingroup$ Thank you for all of your comments. $\endgroup$ – Wei-Cheng Liu Mar 31 '14 at 0:10