You are currently browsing the tag archive for the ‘fermat’ tag.

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:

p = x^2 + y^2

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 32 + 22.
17 is also of the form 4n + 1 and can be written as 42 + 12.
29 = 52 + 22.
37 = 62 + 12.

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 x2 + y2 (x and y integers) are either of the form 4n + 1 or even.

In other words, for some n:

x2 + y2 = 4n + 1 or

x2 + y2 = 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

x2 + y2 = (2n)2 + (2m)2
x2 + y2 = 4n2 + 4m2
x2 + y2 = 2(2n2 + 2m2)

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 x2 + y2 = (2n+1)2 + (2m+1)2
x2 + y2 = 4n2+ 4n + 1 + 4m2 + 4m + 1
x2 + y2 = 4n2+ 4n + 4m2 + 4m + 2
x2 + y2 = 2(2n2 + 2m2 + 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 x2 + y2 = (2n+1)2 + (2m)2
x2 + y2 = 4n2+ 4n + 1 + 4m2
x2 + y2 = 4(n2+m2+n) + 1
which is in the form 4k+1 (with k = (n2+m2+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 an + bn=c2 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

Website Stats


IB Maths Exploration Guide

IB Maths Exploration Guide

A comprehensive 63 page pdf guide to help you get excellent marks on your maths investigation. Includes:

  1. Investigation essentials,
  2. Marking criteria guidance,
  3. 70 hand picked interesting topics
  4. Useful websites for use in the exploration,
  5. A student checklist for top marks
  6. Avoiding common student mistakes
  7. A selection of detailed exploration ideas
  8. Advice on using Geogebra, Desmos and Tracker.

Available to download here.

IB Revision Notes

IB Revision Notes

Full revision notes for both SL Analysis (60 pages) and HL Analysis (112 pages).  Beautifully written by an experienced IB Mathematics teacher, and of an exceptionally high quality.  Fully updated for the new syllabus.  A must for all Analysis students!

Available to download here.

IB HL Paper 3 Practice Questions (120 page pdf)

IB HL Paper 3 Practice Questions 

Seventeen full investigation questions – each one designed to last around 1 hour, and totaling around 40 pages and 600 marks worth of content.  There is also a fully typed up mark scheme.  Together this is around 120 pages of content.

Available to download here.

IB Exploration Modelling and Statistics Guide

IB Exploration Modelling and Statistics Guide

A 60 page pdf guide full of advice to help with modelling and statistics explorations – focusing in on non-calculator methods in order to show good understanding. Includes:

  1. Pearson’s Product: Height and arm span
  2. How to calculate standard deviation by hand
  3. Binomial investigation: ESP powers
  4. Paired t tests and 2 sample t tests: Reaction times
  5. Chi Squared: Efficiency of vaccines
  6. Spearman’s rank: Taste preference of cola
  7. Linear regression and log linearization.
  8. Quadratic regression and cubic regression.
  9. Exponential and trigonometric regression.

Available to download here.

Recent Posts

Follow IB Maths Resources from British International School Phuket on