# Are there infinitely many rational pairs $(a,b)$ which satisfy given equation?

I saw on some facebook page this concrete example:

$1.2^2+0.6^2=1.2+0.6$

The question that immediately arises is:

Are there infinitely many pairs $(a,b)$ of rational numbers such that we have $a^2+b^2=a+b$?

• HINT: Your equation represents a circle. It has infinitely many rational points on it. – user167045 Nov 13 '15 at 15:49
• Great. Please post this as an answer. – Shailesh Nov 13 '15 at 15:50
• $$a=\frac{t(t+k)}{t^2+k^2}$$ $$b=\frac{k(t+k)}{t^2+k^2}$$ – individ Nov 13 '15 at 17:20
• @individ Would you like to post this as an answer? – Farewell Nov 13 '15 at 17:25
• Why? The equation is simple. – individ Nov 13 '15 at 17:30

Hint: $$a^2+b^2=a+b\implies{}a^2-a+b^2-b=0\implies{}2\left(a-\frac{1}{2}\right)^2+2\left(b-\frac{1}{2}\right)^2=1.$$

What can you say about this equation with respect to the cartesian plane? What is the parametrization of this figure?

• @AntePaladin: A circle with a rational centre will always have infinitely many rational points while a circle with an irrational centre will have at most two rational points. See here fore the proof: books.google.co.in/… – Jack Frost Nov 13 '15 at 16:16
• @Jack Frost a circle with rational centre and rational radius has infinitely many rational points. A circle with rational centre and transcendental radius has no rational points. – Robert Israel Nov 13 '15 at 16:41
• In this case the radius is the square root of a rational: that's more delicate. There wouldn't be any if the radius was $1/\sqrt{3}$. – Robert Israel Nov 13 '15 at 16:46
• @AntePaladin Consider the map $(x,y)\rightarrow\left(\frac{x+y}2,\frac{x-y}2\right)$. It takes the circle of radius $1$ to a circle of radius $\frac{1}{\sqrt{2}}$ and preserves rational points. – Milo Brandt Nov 13 '15 at 16:48
• Yes, in fact a parametrization of this circle is $$a = \dfrac{t+1}{t^2+1}, \ b = \dfrac{t^2 + t}{t^2 + 1}$$ Any rational value of $t$ gives you a rational point $(a,b)$. – Robert Israel Nov 13 '15 at 17:30

Real solutions:

The equation $$a^2 + b^2 = a + b$$ can be transformed: $$a^2 + b^2 = a + b \iff \\ a^2 - a + b^2 -b = 0 \iff \\ (a - 1/2)^2 + (b - 1/2)^2 = 1/4 + 1/4 = 1/2 = (1/\sqrt{2})^2 \quad (*)$$ The solutions form a circle with origin $(1/2, 1/2)$ and radius $1/\sqrt{2}$ in $\mathbb{R}^2$. They are $$(a, b) = (a, b(a)) = \left(a, (1/2) \pm\sqrt{(1/\sqrt{2})^2 - (a - 1/2)^2}\right)$$ for $a \in [1/2 - 1/\sqrt{2}, 1/2 + 1/\sqrt{2}] = [a_-, a_+]$.

Rational solutions:

Among all those infinite many real solutions $(a, b)$ we expect infinite many rational solutions, but my topology is too bad to give a good argument here. If we insert arbitrary rational $a$ not all $b = b(a)$ are rational.

I tried to find all rational $a$ for which $b = b(a)$ is rational, but ran against a wall. However an infinite subset of such rational $a$ is still infinite, so we try to pick an easy one.

An infinite rational subset of solutions:

The subset I came up with consists of those $a$ which have the form $$a_n = \frac{1}{2} + \frac{1}{2n} < a_+ \quad (n \in \mathbb{N})$$ which gives \begin{align} b_n &= \frac{1}{2} \pm \sqrt{\frac{1}{2} - \frac{1}{4n^2}} \\ &= \frac{1}{2} \pm \frac{\sqrt{2n^2 - 1}}{2n} \\ &= \frac{n \pm \sqrt{2n^2 - 1}}{2n} \end{align}

Then $b_n$ is rational, if $$2n^2 -1 = m^2$$ for some $m \in \mathbb{N} \cup \{ 0 \}$.

We can rewrite this as $$m^2 - 2 n^2 = -1 \quad (**)$$ which is a Diophantine equation related to the Pell equation with constant $D = 2$, see negative Pell equation.

Solution of the negative Pell equation:

One solution to $(**)$ is $m = 1$ and $n = 1$, from which we can generate infinite many more solutions:

For odd $k \in \mathbb{N}$ we have: $$-1 = (1^2 - 2\cdot 1^2)^k = (m^2 - 2n^2) \Rightarrow \\ -1 = (1 + \sqrt{2})^k (1-\sqrt{2})^k = (m + \sqrt{2} n)(m - \sqrt{2} n)$$ which because of $$(1 + \sqrt{2})^k = \sum_{i=0}^k \binom{k}{i} 1^i (\sqrt{2})^{n-i} = c_1 \cdot 1 + c_2 \sqrt{2} \quad (c_1, c_2 \in \mathbb{N}) \\ (1 - \sqrt{2})^k = \sum_{i=0}^k \binom{k}{i} 1^i (-\sqrt{2})^{n-i} = d_1 \cdot 1 - d_2 \sqrt{2} \quad (d_1, d_2 \in \mathbb{N})$$ gives $$m + \sqrt{2} n = (1 + \sqrt{2})^k \\ m - \sqrt{2} n = (1 - \sqrt{2})^k \\$$ and $$m = \frac{(1 + \sqrt{2})^k + (1 - \sqrt{2})^k}{2} \\ n = \frac{(1 + \sqrt{2})^k - (1 - \sqrt{2})^k}{2 \sqrt{2}}$$

Here are the first ten solutions:

k = 1,  m = 1,       n = 1
k = 3,  m = 7,       n = 5
k = 5,  m = 41,      n = 29
k = 7,  m = 239,     n = 169
k = 9,  m = 1393,    n = 985
k = 11, m = 8119,    n = 5741
k = 13, m = 47321,   n = 33461
k = 15, m = 275807,  n = 195025
k = 17, m = 1607521, n = 1136689
k = 19, m = 9369319, n = 6625109


Plugging the Pell solutions into the circle solution:

We have \begin{align} a_k &= \frac{1}{2} + \frac{1}{2n} \\ &= \frac{1}{2} + \frac{\sqrt{2}}{(1 + \sqrt{2})^k - (1 - \sqrt{2})^k} \in \mathbb{Q} \end{align} and \begin{align} b_k &= \frac{1}{2} \pm \frac{m}{2n} \\ &= \frac{1}{2} \pm \frac{\sqrt{2}}{2} \frac{(1 + \sqrt{2})^k + (1 - \sqrt{2})^k} {(1 + \sqrt{2})^k - (1 - \sqrt{2})^k} \in \mathbb{Q} \end{align} for any odd $k \in \mathbb{N}$.

Here is a visualization:

Featured are the real solutions (blue circle) and a few of the rational solutions $Q_k^{(+)} = (a_k, b_k^{(+)})$ (green points), $Q_k^{(-)} = (a_k, b_k^{(-)})$ (red points) for $k \in \{ 1,3,5 \}$. The other ones pile up too much to be distinguishable in the plot.

• FYI: When your number of edits exceeded ten, a system flag was raised. It used to be a rule that at that point a post became Community-Wiki = free for all to edit, and no more rep gained from votes. This is because some users wanted to "bump" their post to the front page by frivolous edits. It is clear to me that you had no such intentions. Yet, the bumping may irritate other users. Even though sometimes the post needs a lot of polishing and such. – Jyrki Lahtonen Nov 14 '15 at 6:50
• (cont'd) To address those needs a sandbox was created in meta. So if you foresee the need to edit a post many times, my advice is to copy/paste its content to a vacated answer box of the sandbox, and do the editing there. When you are happy with it copy/paste it back here. No real harm done. I just wanted to make sure that you are aware of the downsides of plenty of edits, and the recommended solution. – Jyrki Lahtonen Nov 14 '15 at 6:52
• How do you know that from this $(1 + \sqrt{2})^k (1-\sqrt{2})^k = (m + \sqrt{2} n)(m - \sqrt{2} n)$ follows this $m + \sqrt{2} n = (1 + \sqrt{2})^k \\ m - \sqrt{2} n = (1 - \sqrt{2})^k \\$? – Farewell Nov 14 '15 at 13:01
• It looks obvious but... – Farewell Nov 14 '15 at 13:01
• @AntePaladin I added the expansion via binomial theorem. – mvw Nov 14 '15 at 23:19