Solve $x^2+y^2=2$ for $x,y\in\mathbb Q$. 
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.
 A: 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$." 
A: Solutions to the equation $x^2+y^2=2$ with $x,y\in \mathbb{Q}$ can be parametrized by $$\left(x,y\right)=\left(\frac{1+2t-t^{2}}{1+t^{2}},\ \frac{1-2t-t^{2}}{1+t^{2}}\right),$$ where $t\in \mathbb{Q}$.
This follows by rewriting the equation as $$\left(\frac{x+y}{2}\right)^{2}+\left(\frac{x-y}{2}\right)^{2}=1,$$ and using the parametrization for $u^2+v^2=1$.   Consequently, we see that $$\left(\frac{x+y}{2},\ \frac{x-y}{2}\right)=\left(\frac{1-t^{2}}{1+t^{2}},\ \frac{2t}{1+t^{2}}\right),$$ and so we arrive at  $$\left(x,y\right)=\left(\frac{1+2t-t^{2}}{1+t^{2}},\ \frac{1-2t-t^{2}}{1+t^{2}}\right).$$
