# An Equation in Squares

### Problem

Find all solutions in positive integers of

$x^{2}+y^{2}=z^{2}+u^{2}.$

### Solution

At least one of $x,$ $y$ is greater or equal than one of $z,$ $u.$ Without loss of generality, assume that $x\ge z$ so that $y\le u.$

The given equation is equivalent to

$(x-z)(x+z)=(u-y)(u+y).$

Denote $x-z=n$ and $x+z=m.$ Obviously, $m-n=2z$ and $m+n=2x$ are both even and $m\ge 2,$ $n\ge 0.$ Thus, $\displaystyle x=\frac{m+n}{2}$ and $\displaystyle z=\frac{m-n}{2}.$

From this we deduce that $\displaystyle\{x,y\}=\bigg\{\frac{m+n}{2},\frac{p-q}{2}\bigg\}$ and $\displaystyle\{z,u\}=\bigg\{\frac{m-n}{2},\frac{p+q}{2}\bigg\},$ with $m\gt n\ge 0,$ $p\gt q\ge 0,$ $m-n$ and $p-q$ are even, and $mn=pq.$

### Acknowledgment

The problem has been posted by Dao Thanh Oai at the CutTheKnotMath facebook page and solved by Leo Giugiuc.