TITLE: Solve $x^2+y^2=2$ for $x,y\in\mathbb Q$.
QUESTION [8 upvotes]: Solve $x^2+y^2=2$ for $x,y\in\mathbb Q$.

I think the answer should be in terms of 1 integer variable $\in\mathbb Z$ only. I rewrite the equation to $(x+y)^2+(x-y)^2=2^2$, then by the formula of pythagorean triples, $x+y=u^2-v^2,x-y=2uv,2=u^2+v^2$. How can I proceed? Thanks.

REPLY [6 votes]: We can imitate one standard method of finding a rational parametrization of the unit circle. 
Note that the point $A=(1,1)$ is on our curve. Let $m$ be rational, and consider the line with slope $m$ passing through  $(1,1)$. This has equation $y=m(x-1)+1$.
Substituting in $x^2+y^2=2$, we get after a while the equation
$$x^2(m^2+1)-2(m^2-m)x+m^2-2m-1=0.$$
One of the roots of this equation is $x=1$. Since the product of the roots is $\frac{m^2-2m+1}{m^2+1}$, it follows that the other root is given by 
$$x=\frac{m^2-2m-1}{m^2+1}.$$
In particular, this root is rational. Conversely, if $P\ne A$ is (almost) any rational point on the curve, then the slope $m$ of the line $AP$ is rational. (The exception is $(1,-1)$, since then technicallly the slope does not exist.)
The value of $y$ corresponding to the above $x$ is 
$$y=-\frac{m^2+2m-1}{m^2+1}.$$
By stretching things a bit, we view the exceptional point  $(1,-1)$ as also being on the parametrized curve, if we allow "$m=\infty$."