**Fermat’s Theorem on the sum of two squares**

Not as famous as Fermat’s Last Theorem (which baffled mathematicians for centuries), Fermat’s Theorem on the sum of two squares is another of the French mathematician’s theorems.

Fermat asserted that all odd prime numbers p of the form 4n + 1 can be expressed as:

where x and y are both integers. No prime numbers of the form 4n+3 can be expressed this way.

This is quite a surprising theorem – why would we expect only some prime numbers to be expressed as the sum of 2 squares? To give some examples:

13 is a prime number of the form 4n+1 and can be written as 3^{2} + 2^{2}.

17 is also of the form 4n + 1 and can be written as 4^{2} + 1^{2}.

29 = 5^{2} + 2^{2}.

37 = 6^{2} + 1^{2}.

Prime numbers of the form 4n + 3 such as 7, 11, 19 can’t be written in this way.

The proof of this theorem is a little difficult. It is however easier to prove a similar (though not logically equivalent!) theorem:

All sums of x^{2} + y^{2} (x and y integers) are either of the form 4n + 1 or even.

In other words, for some n:

x^{2} + y^{2} = 4n + 1 or

x^{2} + y^{2} = 2n

We can prove this by looking at the possible scenarios for the choices of x and y.

**Case 1:**

x and y are both even (i.e. x = 2n and y = 2m for some n and m). Then

x^{2} + y^{2} = (2n)^{2} + (2m)^{2 }

x^{2} + y^{2} = 4n^{2} + 4m^{2}

x^{2} + y^{2} = 2(2n^{2} + 2m^{2})

which is even.

**Case 2:**

x and y are both odd (i.e. x = 2n+1 and y = 2m+1 for some n and m).

Then x^{2} + y^{2} = (2n+1)^{2} + (2m+1)^{2 }

x^{2} + y^{2} = 4n^{2}+ 4n + 1 + 4m^{2} + 4m + 1

x^{2} + y^{2} = 4n^{2}+ 4n + 4m^{2} + 4m + 2

x^{2} + y^{2} = 2(2n^{2} + 2m^{2} + 2m + 2n + 1).

which is even.

**Case 3:**

One of x and y is odd, one is even. Let’s say x is odd and y is even. (i.e. x = 2n+1 and y = 2m for some n and m).

Then x^{2} + y^{2} = (2n+1)^{2} + (2m)^{2 }

x^{2} + y^{2} = 4n^{2}+ 4n + 1 + 4m^{2}

x^{2} + y^{2} = 4(n^{2}+m^{2}+n) + 1

which is in the form 4k+1 (with k = (n^{2}+m^{2}+n) )

Therefore, the sum of any 2 integer squares will either be even or of the form 4n+1. Unfortunately this does not necessarily imply the reverse: that all numbers of the form 4n+1 are the sum of 2 squares (which would then prove Fermat’s Theorem). This is because,

A implies B

Does not necessarily mean that

B implies A

For example,

If A is “cats” and B is “have 4 legs”

A implies B (All cats have 4 legs)

B implies A (All things with 4 legs are cats).

A is logically sound, whereas B is clearly false.

This is a nice example of some basic number theory – such investigations into expressing numbers as the composition of 2 other numbers have led to some of the most enduring and famous mathematical puzzles.

The Goldbach Conjecture suggests that every even number greater than 2 can be expressed as the sum of 2 primes and has remained unsolved for over 250 years. Fermat’s Last Theorem lasted over 350 years before finally someone proved that a^{2} + b^{2 }=c^{2 } has no positive integers a, b, and c which solve the equation for n greater than 2.

If you liked this post you might also like:

The Goldbach Conjecture – The Goldbach Conjecture states that every even integer greater than 2 can be expressed as the sum of 2 primes. No one has ever managed to prove this.

Mathematical Proof and Paradox – how we can “prove” the impossible

## 2 comments

Comments feed for this article

April 15, 2014 at 7:36 am

VivianI believe that is a picture of Newton, not Fermat.

April 15, 2014 at 2:03 pm

Ibmathsresources.comthanks – I have now updated it!