# Right triangle where all sides are integer lengths, and the two smaller sides differ by 1

## Background

I'm currently taking a course in number theory and the following problem came up.

## Problem

Find all the right triangles where the small sides differ by one.

## My Attempt

Let $\Delta ABC$ be my triangle with sides $a,b,c\in\Bbb N$ and $a^2+b^2=c^2$. Without loss of generality we can assume $a<b$, and thus $b=a+1$.

This gives the following equation: $2a^2+2a+1=c^2$, which I yet can't use. When reading another question on the site, a user gets to $a=\sqrt{b+c}$ when they assume $b=a+1$. They don't explain what is the process to get there.

I tried to obtain a solution, but could't get around the equations. The most I got to was $b^2-a^2=a+b$.

Now parametrizing the sides I get:

\begin{align} (a,b,c) &= (m^2-n^2,2mn,m^2+n^2) \\ &= (m^2-n^2,m^2-n^2+1,m^2+n^2) \\ & =(2mn-1,2mn,m^2+n^2) \end{align}

When I plug this solutions into the Pythagorean identity, I get curves with degree $4$ which I can't solve for any of the two variables. Even if I plug them into Mathematica, I get solutions with irrational numbers.

How can I find a solution to the equations? For example one of the curves is

$$m^4+n^4+6(mn)^2-4mn+1=0$$

When solving, I get a radical solution and I don't know how to make sure that it is an integer.

Any hints or comments are very much appreciated.

• $a,b,c \in \Bbb N$? – Jaideep Khare Feb 9 '18 at 22:53
• Yes, forgot to add that. – Ignacio Rojas Feb 9 '18 at 22:54
• Is it not assumed that the length are integers? – zoli Feb 9 '18 at 22:54
• Something is wrong here. You can make a right triangle with any $a \in \mathbb{N}$ with sides $a$, $a+1$ and $\sqrt{a^2 + (a+1)^2}$. Please clarify your question. – David G. Stork Feb 9 '18 at 22:54
• Just edited, $a, b, c$ are all integers. – Ignacio Rojas Feb 9 '18 at 22:56

You got the equation $$2a^2+2a+1=c^2$$

Hint : For this equation (quadratic in $a$) to posses integer solutions for $a$ and $c$, it's discriminant must also be a perfect square.

$$\Delta = 8c^2-4=\lambda^2$$

• Ahh, I see. I'm getting a Pell type equation from this. I'll work around and will post my results soon. – Ignacio Rojas Feb 9 '18 at 23:01
• I solved it using that technique. Check your solutions against $a = \{0, 3, 20, 119, 696, 4059, 23660, 137903, 803760, ... \}$. – David G. Stork Feb 9 '18 at 23:04
• @Ignacio Did you try to find out answers? – Jaideep Khare Feb 10 '18 at 12:14
• I did, had a bit of trouble with Pell's equation but now I have solved it. Thanks! – Ignacio Rojas Feb 10 '18 at 21:04

From the Pythagorean triples $(m^2-n^2,2mn,m^2+n^2)$ we require $m^2-n^2+1=2mn$ which leads to Pell's equation \begin{eqnarray*} (m-n)^2-2n^2=1. \end{eqnarray*} A solution is $(m-n,n)=(3,2)$ leading to the triple $(21,20,29)$.

The next solution is $(m-n,n)=(17,12)$ leading to $(697,696,985)$.

• You missed two solutions with smaller $a$ (see below). – David G. Stork Feb 9 '18 at 23:16