# Distinct integer solutions to $a^2+b^2=c^2+d^2$ [duplicate]

I'm trying to find integer solutions to $$a^2+b^2=c^2+d^2$$

with values $a> c > d > b>0$

Or in other words, two triangles with integer legs and equal hypotenuse lengths, not necessarily integer. Seems like a Diophantine equation to me, but I only learned how to solve Diophantine equations in the form of Pell's equations. I couldn't find anything on this equation when I checked Wikipedia. It is similar to a Pythagorean quadruple, although not quite, so that's not helpful either. How do I find integer solutions to this?

## marked as duplicate by Théophile, kingW3, B. Goddard, Dando18, José Carlos SantosSep 16 '17 at 21:16

• $5^2+5^2=7^2+1^2$ – José Carlos Santos Sep 14 '17 at 17:06
• @A---B oops forgot to mention all values are are unique. I'll add that in – Ryan Sep 14 '17 at 17:06
• @Ryan Is Jose's solution valid ? – A---B Sep 14 '17 at 17:07
• Subtract $b^2$ and $d^2$ from each side to get $a^2-d^2=c^2-b^2$, or $$(a+d)(a-d)=(c+b)(c-b).$$ – Théophile Sep 14 '17 at 17:07
• You should clarify the restriction: if $a\neq b$ and $b\neq c$, it can still be true that $a=c$. – Chase Ryan Taylor Sep 14 '17 at 17:22

One way to find some solutions is to rewrite as $a^2-c^2=d^2-b^2$, which in turn becomes $(a-c)(a+c)=(d-b)(d+b)$.

Then choose a number that factors in more than one way and see what you get.

Example: $15=3\cdot 5=1\cdot 15$

Then $15=(4-1)(4+1)=(8-7)(8+7)$.

So take $a=4, b=7, c=1, d=8$

HINT.-The general solution of the equation $x^2+y^2=z^2+w^2$ is given by the known enough parametrization with four parameters $$x=tX+sY\\y=tY-sX\\z=tX-sY\\w=tY+sX$$.

$$\implies a^2-c^2=b^2-d^2=N$$ For some $N\in \mathbb{Z}$

If $$d_1 d_2=d_3 d_4=N$$

Then \begin{cases} \begin{align} a&=\frac{d_1 +d_2}{2} \\ c&=\frac{d_1 -d_2}{2} \\ b&=\frac{d_3 +d_4}{2} \\ d&=\frac{d_3 -d_4}{2} \\ \end{align} \end{cases}

What's needed is that $(d_1,d_2)$ need to be of the same parity and $(d_3,d_4)$ need to be of the same parity.

This answer is of the same spirit as paw88789

Strong Hint: \begin{align} a^2 + b^2 &= c^2 + d^2 \\ \implies a^2 + b^2 - c^2 &= d^2 \\ \implies a^2 + (b + c)(b - c) &= d^2 \\ \implies (b + c)(b - c) &= d^2 - a^2 \\ \implies (b + c)(b - c) &= (d + a)(d - a) \end{align}. $$\therefore a^2 + b^2 \neq \{p : p = \text{prime number}\} \iff a^2 + b^2 = c^2 + d^2$$ Now what separates a prime number from any other (composite) number?

Solution to finding distinct integer solutions: $$a^2 + b^2 = c^2 + d^2 = \{n \iff d(n) \geq 4 : d(n) = \text{number of divisors of n}, \ \forall n\in \mathbb{R}\}$$

First note that in the equation $a^2+b^2=c^2+d^2 (*)$ you can adjust the signs of the variables, which can thus be taken in $\mathbf Z$ in order to work in the Gaussian ring $\mathbf Z[i]$. Denoting by $N$ the norm map of $\mathbf Q(i)/\mathbf Q$, one can write $(*)$ as $N(a+ib)=N(c+id)$, or $(a+ib)=u(c+id)$, with $N(u)=1$. Every $u \in \mathbf Q(i)$ having norm $1$ is of the form $(e+if)/(e-if)$, where $e,f$ can be taken in $\mathbf Z$ for reasons of homogeneity. By developping the products in the equation $(a+ib)(e-if)=(c+id)(e+if)$, one gets immediately the following parametrization of the solutions of $(*)$ : $(a, b, c, d)=(AE+BF, BE-AF, CE-DF, DE+CF))$, with $A, B, C, D, E, F \in \mathbf Z$.

Note that this kind of problem can be generalized to $N_{1}(z_1)=\lambda N_2(z_2)$, where the $N_h$'s are the norm maps of two quadratic fields, see e.g. For which values of $a\in\mathbb{Q}$ does integer solutions to $x^2+x+1=a(y^2+1)$ exist?