Can every perfect square exist as the sum or difference of two perfect squares?

7.5k Views Asked by At

I believe this is trivial and I'm over-complicating it. But can every squared integer be expressed as the sum of two squared integers OR the difference of two squared integers? And is there a proof for it?

Algebraically, assuming integers $x, y, z ≥ 0:$

$$\begin{align}z^2 &= x^2 + y^2 \\ z^2 &= x^2 - y^2\end{align}$$

In other words, can every positive integer, regardless of the other two variables, be expressed as a part of a Pythagorean triple $(a,b,c)$?

I ask this because I cannot seem to find any explicit answers for it. I understand that the set of all sums of two squared integers is closed under multiplication by the Fibonacci identity, but I'm not sure how it applies in this situation. Also, I'm not sure if a proof of the Pythagorean theorem would be able to answer this question, but I need some clarification.

4

There are 4 best solutions below

0
On BEST ANSWER

Every square can be written as the difference of two squares.

$(x+1)^2-x^2=2x+1$

This shows that any odd number, in particular an odd square, is the difference of two squares.

$(x+1)^2-(x-1)^2=4x$.

Any multiple of 4 is the difference of squares. An even square will be divisible by 4, so even squares are also the difference of two squares.

0
On

Every square number is expressible as the difference of two squares. First, note that every odd number $2n+1$ can be written as $(n+1)^2 - n^2$. Next, you can write every even square as $4n^2 = (n^2+1)^2 - (n^2-1)^2$. Note that if you specify that it has to be a difference of two nonzero squares, then $1$ and $4$ do not count.

In general, the only integers that cannot be written as differences of squares are the numbers congruent to $2$ modulo $4$. This can be obtained by solving for $x-y = n_1, x+y = n_2$, whenever you have a factorization $n = n_1n_2$ into terms of the same parity. (Again, if you specify difference of nonzero squares, $1$ and $4$ do not count.)

0
On

First of all an integer $n$ can be expressed as the difference of two squres if and only if it's odd or divisible by $4$ and here are the expression: $$n=2k+1=(k+1)^2-k^2\ \ \ n=4k=(k+1)^2-(k-1)^2$$

And because $n^2$ is either odd or divisible by $4$ we can conclude that:

Every square is the difference of two squares

0
On

I'm going to be more general, and cover all integers that can be expressed as a sum or difference of squares.

We start with the difference.

Suppose $n$ is an integer with factors $k$ and $m$, one of which could be $1$. Then if $$n = a^2-b^2 = (a+b)(a-b), $$ you need to solve the equations $$ a+b = k \\ a-b = m, $$ so $a=(k+m)/2$, $b=(k-m)/2$. Therefore you can express a number as the difference of two squares if, and only if, you can find a factorisation into two factors whose sum and difference is even. This can only occur if the factors are both odd, or both even.

Since 1 is an odd number, if $n$ is odd we can use $n=n \times 1$, so all odd numbers are so expressible. Hence, looking modulo 4, the residue classes $n \equiv 1,3 \pmod{4}$ are covered. $n \equiv 0 \pmod{4}$ is also obvious since $n = 2 \times 2 (n/4)$. However, if $n=4k+2=2(2k+1)$, this cannot work.

Now, what about a sum of two squares? Working modulo $8$, the squares are $$ 0^2 \equiv 0, 1^2 \equiv 1, 2^2 \equiv 4,3^3 \equiv 1,4^2 \equiv 0,5^2 \equiv 1,6^2 \equiv 4,7^2 \equiv 1, $$ so all squares are $0,1$ or $4 \pmod{8}$. Hence anything that is $6,7 \pmod{8}$ cannot be a sum of two squares. (and anything that is $7 \pmod{8}$ is not even a sum of three squares. Four squares, on the other hand, are enough for anything sufficiently large - this is the solution to Waring's problem for squares)

In fact all Pythagorean triples are given by $((m^2+n^2),2mn,(m^2-n^2))$ for integer $m,n$.