Let a,b be rationals and x irrational. Show that if $\frac{x+a}{x+b}$ is rational, then $a=b$. I'm trying to solve the following problems:


*

*Let $a$,$b$ be rationals and $x$ irrational. Show that if $\frac{x+a}{x+b}$ is rational, then $a=b$

*Let $x$,$y$ be rationals such that $\frac{x^2+x+\sqrt{2}}{y^2+y+\sqrt{2}}$ is also rational. Prove that either $x=y$, or $x+y=-1$.
Only thing I can think of is that if $\frac{x+a}{x+b}$ and $\frac{x^2+x+\sqrt{2}}{y^2+y+\sqrt{2}}$ are rationals, then there's a number $\frac{m}{n}$ where integers $m$ and $n$ are co-prime.
I would appreciate any form of help.
Thank you.
 A: For the first one, you can proceed directly: Notice that if the expression is equal to some rational $r$, then
$$x + b = r(x + a) \implies x(1 - r) = a - b$$
Now the right side is rational, but the left side is irrational unless.....

For the second, I'd suggest proceeding similarly. Write
$$x^2 + x + \sqrt 2 = r(y^2 + y + \sqrt 2)$$
and rearrange to get
$$x^2 + x - ry^2 - y = \sqrt2(r - 1)$$
From this, get $r$; then do some algebra to figure out when the first equality can hold.
A: 1. There are $p,q\in\mathbb{Z}$, with $gcd(p,q)=1$ such that $\frac{x+a}{x+b}=\frac{p}{q}$. Then $$(x+a)q=(x+b)p\Leftrightarrow x(q-p)=bp-aq\Leftrightarrow x=\frac{bp-aq}{q-p}\in\mathbb{Q}\Leftrightarrow x=0.$$ This is absurd. Therefore $p=q$ and $x+a=x+b$, so $a=b$.
2. Let $r\in\mathbb{Q}$ such that $\frac{x²+x+\sqrt{2}}{y²+y+\sqrt{2}}=r$ and suppose that $\frac{x}{y}$ is a irreducible fraction. Then $$\frac{x²+x+\sqrt{2}}{y²+y+\sqrt{2}}=r\Leftrightarrow x²+x+\sqrt{2}=(y²+y+\sqrt{2})r\Leftrightarrow x²+x-y²r-yr=\sqrt{2}(r-1).$$ If $r\neq 1$ we have $\sqrt{2}=\frac{x²+x-y²r-yr}{r-1}\in\mathbb{Q}$, but this is absurd. It follows that $r=1$ and $$x²+x+\sqrt{2}=y²+y+\sqrt{2}\Rightarrow y(y+1)=x(x+1).$$ If $x=-1$, we have $y(y+1)=0$ and so $y=0=x+1$ or $y=x=-1$. If $x\neq -1$ we have $$x=y(\frac{y+1}{x+1}).$$ If $y=-1$, it is analogous. We can suppose that $y\neq -1$. If $y=0$, $x=0$. Suppose $-1\neq y\neq 0$. We have $$\frac{x}{y}=\frac{y+1}{x+1}.$$ Since $\frac{x}{y}$ is irreducible, follows the last equality that $x=y$.
