# Akiva's question at Yahoo! Answers regarding a Diophantine equation

#### MarkFL

Staff member
Here is the question:

X^2 + 1 = 2y^2 Diophantine equation?

I've been thinking about what whole numbers x and y satisfy:
x^2 + 1 = 2y^2

I know that (1, 1) works, as do (7, 5) and (41, 29), but I want a formula that gives me the next one, or any given one. What's the pattern?

The question is equivalent to asking which triangular numbers are twice other ones (the first three are (0, 0), (3, 2) (3rd is 6, 2nd is 3), and (20, 14)), and which right triangles with integer legs have one leg 1 unit longer than the other (first three triplets are (0, 1, 1), (3, 4, 5), (20, 21, 29)).

I'm not sure how to solve it. Which numbers x and y satisfy it? Is there an equation to find, say, the 20th x and y? Are there an infinite number of pairs that satisfy it, or just a few? Please help.
I have posted a link there to this topic so the OP can see my work.

#### MarkFL

Staff member
Hello Akiva,

The Diophantine equation you are considering is closely related to Pell's equation.

You have made the astute observation that the solutions to this equation are related to Pythagorean triples where the legs differ by 1. You may find this topic to be of interest.

Okay, you have found the solutions:

$(x,y)=(1,1),\,(7,5),\,(41,29)$

At this point, we could hypothesize that $x$ and $y$ can be given recursively with:

$$\displaystyle S_{n+1}=6S_{n}-S_{n-1}$$

which leads to the characteristic equation:

$$\displaystyle r^2-6r+1=0$$

which has the roots:

$$\displaystyle r=3\pm2\sqrt{2}=\left(1\pm\sqrt{2} \right)^2$$

and so we know the closed form is:

$$\displaystyle S_n=k_1\left(1-\sqrt{2} \right)^{2n}+k_2\left(1+\sqrt{2} \right)^{2n}$$

Next, we may using the initial values for each sequence to determine the parameters.

For $x_n$, we may use:

$$\displaystyle x_1=k_1\left(1-\sqrt{2} \right)^{2}+k_2\left(1+\sqrt{2} \right)^{2}=1$$

$$\displaystyle x_2=k_1\left(1-\sqrt{2} \right)^{4}+k_2\left(1+\sqrt{2} \right)^{4}=7$$

This gives rise to the system:

$$\displaystyle 3\left(k_1+k_2 \right)+2\sqrt{2}\left(k_2-k_1 \right)=1$$

$$\displaystyle 17\left(k_1+k_2 \right)+12\sqrt{2}\left(k_2-k_1 \right)=7$$

Multiplying the first equation by $-6$, then adding, we get:

$$\displaystyle -k_1-k_2=1\,\therefore\,k_1=-1-k_2$$

Substituting into the first equation for $k_1$, there results:

$$\displaystyle -3+2\sqrt{2}\left(2k_2+1 \right)=1$$

Solving for $k_2$, we find:

$$\displaystyle k_2=\frac{\sqrt{2}-1}{2}$$

Thus:

$$\displaystyle k_1=-1-\frac{\sqrt{2}-1}{2}=-\frac{\sqrt{2}+1}{2}$$

and so we find:

$$\displaystyle x_n=-\frac{\sqrt{2}+1}{2}\left(1-\sqrt{2} \right)^{2n}+\frac{\sqrt{2}-1}{2}\left(1+\sqrt{2} \right)^{2n}$$

$$\displaystyle x_n=\frac{1}{2}\left(\left(\sqrt{2}-1 \right)\left(1+\sqrt{2} \right)^{2n}-\left(\sqrt{2}+1 \right)\left(1-\sqrt{2} \right)^{2n} \right)$$

For $y_n$, we may use:

$$\displaystyle y_1=k_1\left(1-\sqrt{2} \right)^{2}+k_2\left(1+\sqrt{2} \right)^{2}=1$$

$$\displaystyle y_2=k_1\left(1-\sqrt{2} \right)^{4}+k_2\left(1+\sqrt{2} \right)^{4}=5$$

This gives rise to the system:

$$\displaystyle 3\left(k_1+k_2 \right)+2\sqrt{2}\left(k_2-k_1 \right)=1$$

$$\displaystyle 17\left(k_1+k_2 \right)+12\sqrt{2}\left(k_2-k_1 \right)=5$$

Multiplying the first equation by $-6$, then adding, we get:

$$\displaystyle -k_1-k_2=-1\,\therefore\,k_1=1-k_2$$

Substituting into the first equation for $k_1$, there results:

$$\displaystyle 3+2\sqrt{2}\left(2k_2-1 \right)=1$$

Solving for $k_2$, we find:

$$\displaystyle k_2=\frac{\sqrt{2}-1}{2\sqrt{2}}$$

Thus:

$$\displaystyle k_1=1-\frac{\sqrt{2}-1}{2\sqrt{2}}=\frac{\sqrt{2}+1}{2\sqrt{2}}$$

and so we find:

$$\displaystyle y_n=\frac{\sqrt{2}+1}{2\sqrt{2}}\left(1-\sqrt{2} \right)^{2n}+\frac{\sqrt{2}-1}{2\sqrt{2}}\left(1+\sqrt{2} \right)^{2n}$$

$$\displaystyle y_n=\frac{1}{2\sqrt{2}}\left(\left(\sqrt{2}+1 \right)\left(1-\sqrt{2} \right)^{2n}+\left(\sqrt{2}-1 \right)\left(1+\sqrt{2} \right)^{2n} \right)$$

So, in summary, we find an infinite number of solution pairs, given:

i) recursively:

$$\displaystyle x_{n+1}=6x_{n}-x_{n-1}$$ where $$\displaystyle x_1=1,\,x_2=7$$

$$\displaystyle y_{n+1}=6y_{n}-y_{n-1}$$ where $$\displaystyle y_1=1,\,x_2=5$$

ii) closed form:

$$\displaystyle x_n=\frac{1}{2}\left(\left(\sqrt{2}-1 \right)\left(1+\sqrt{2} \right)^{2n}-\left(\sqrt{2}+1 \right)\left(1-\sqrt{2} \right)^{2n} \right)$$

$$\displaystyle y_n=\frac{1}{2\sqrt{2}}\left(\left(\sqrt{2}+1 \right)\left(1-\sqrt{2} \right)^{2n}+\left(\sqrt{2}-1 \right)\left(1+\sqrt{2} \right)^{2n} \right)$$