All posts

Pierre de Fermat: Number Theory, Analytic Geometry, Calculus and Probability

October 18, 2026 · 6 min read

History of MathematicsNumber Theory

A little about his life

His full name was Pierre de Fermat. He was born in 1607 in France; his father was a wealthy trader. He took his bachelor's degree in law in 1626 and worked as a lawyer for most of his life, so mathematics was something he did in his spare time. He spoke six languages fluently. He married in 1631 and had five children. He died in 1665.

Number theory

Fermat's little theorem

Theorem. Let $p$ be a prime and suppose that $p \nmid a$. Then $a^{p-1} \equiv 1 \pmod p$.

Proof. Consider the numbers

$$a,\ 2a,\ 3a,\ \dots,\ (p-1)a.$$

These numbers are all different modulo $p$. Otherwise, for some $n \neq m$,

$$na \equiv ma \pmod p \implies (n-m)a \equiv 0 \pmod p \implies n - m \equiv 0 \pmod p,$$

since $p \nmid a$. But $1 \le n, m \le p-1$, so this is not possible. Hence $a, 2a, \dots, (p-1)a$ are congruent to $1, 2, \dots, p-1$ in some order. Multiplying them all,

$$a \cdot 2a \cdot 3a \cdots (p-1)a \equiv 1 \cdot 2 \cdot 3 \cdots (p-1) \pmod p,$$

that is,

$$a^{p-1}(p-1)! \equiv (p-1)! \pmod p \implies a^{p-1} \equiv 1 \pmod p.$$

We can cancel $(p-1)!$ because it is not divisible by the prime $p$. $\blacksquare$

Fermat's last theorem

Although it has always been called Fermat's last theorem, it remained a conjecture until 1995. The statement is:

Theorem. There are no positive integers $a, b, c$ satisfying $a^n + b^n = c^n$ for any integer $n \ge 3$.

Fermat wrote in the margin of his copy of the Arithmetica of Diophantus of Alexandria that he had found a remarkable proof, but the margin was too small to contain it. The proof stayed unknown for more than 300 years despite the efforts of many mathematicians. A complete account is far beyond a short post, but here is a rough map of those efforts:

  1. Fermat himself proved the special case $n = 4$.
  2. Over the next two centuries the theorem was proved for the exponents $3$, $5$ and $7$.
  3. In the mid-19th century Ernst Kummer extended it to all regular primes.
  4. In 1955 the Japanese mathematicians Goro Shimura and Yutaka Taniyama suspected a link between elliptic curves and modular forms, now known as the Taniyama–Shimura conjecture. At the time nobody saw any connection with Fermat's last theorem.
  5. In 1984 Gerhard Frey noticed that the two problems were linked: a counterexample to Fermat's last theorem would give an elliptic curve that could not be modular.
  6. Andrew Wiles, an English mathematician who had dreamed of solving the problem since childhood, worked on it in secret for six years. He proved the part of the Taniyama–Shimura conjecture that was needed, and the proof of Fermat's last theorem was published in 1995.

Fermat numbers

A Fermat number is an integer of the form

$$F_n = 2^{2^n} + 1, \qquad n \ge 0.$$

If $F_n$ is prime, it is called a Fermat prime. Fermat wrote in a letter to Mersenne that he had found that numbers of the form $2^{2^n}+1$ are always prime. However, in 1732 Euler showed that

$$F_5 = 2^{2^5} + 1 = 4294967297$$

is divisible by $641$. Even today it is not known whether there are infinitely many Fermat primes.

Calculus and analytic geometry

At the same time as Descartes, Fermat was building analytic geometry in the modern sense. He found the equations of the straight line and the circle, and described many curves analytically, including hyperbolas, parabolas, the spiral of Fermat and the curve later called the witch of Agnesi.

He also developed methods for finding tangents to curves and areas under them. Here is his method for locating the maxima and minima of a function.

A curve with a flat minimum at a and a steep part at b; the same step e in x gives a tiny change in f near a and a large change near b
Near a maximum or minimum, a step e in x changes f very little.

His idea was that at a maximum or minimum of a continuous function, the change in the value of the function is very small compared with the change in the input. The change on the horizontal axis is

$$e = (a+e) - a = (b+e) - b.$$

As an example, take the function

$$f(x) = x^3 - 3x. \tag{1}$$

The difference in the value of the function at a point $x$ is

$$f(x+e) - f(x) = \left(x^3 + 3x^2 e + 3x e^2 + e^3 - 3x - 3e\right) - \left(x^3 - 3x\right). \tag{2}$$

Since at a maximum or minimum this difference is very small, Fermat set (2) equal to zero:

$$3x^2 e + 3x e^2 + e^3 - 3e = 0. \tag{3}$$

Dividing both sides of (3) by $e$ gives

$$3x^2 + 3xe + e^2 - 3 = 0. \tag{4}$$

His second assumption was that the change in $x$ is very small, so $e$ can be replaced by $0$ in (4). This gives

$$3x^2 - 3 = 0, \tag{5}$$

so the maximum and minimum are at

$$x_1 = 1 \quad \text{and} \quad x_2 = -1. \tag{6}$$

Equation (5) is exactly the modern method: set the derivative of the function equal to zero. The process does break some modern rules, though. For example, (2) is not really equal to zero for any value of $e$; today we handle this step with the concept of a limit.

Probability

The problem of points (also known as the division of stakes) can be seen as the starting point of probability theory in the modern sense. Two players, $A$ and $B$, bet the same amount of money and play a game in rounds; in each round they win with probabilities $p_A$ and $p_B$. The first player to reach a certain number of wins takes all the money.

Take a specific example with fair rounds. The first player to reach 4 wins takes the money; $A$ has 2 wins and $B$ has 1, and at this point they have to stop. How should they split the money? Earlier approaches split it according to the wins each player had so far, but this is not right. The correct solution appeared in the letters between Fermat and Pascal.

Since $A$ needs 2 more wins and $B$ needs 3, the game would end within at most 4 more rounds. We can list all 16 equally likely ways those rounds could go:

Outcome Winner Outcome Winner Outcome Winner Outcome Winner
AAAA A ABAA A BAAA A BBAA A
AAAB A ABAB A BAAB A BBAB B
AABA A ABBA A BABA A BBBA B
AABB A ABBB B BABB B BBBB B

If they could continue the game, $B$ would win in only 5 of the 16 outcomes. So they should split the money $\frac{11}{16}$ to $A$ and $\frac{5}{16}$ to $B$.

References

  1. Carl B. Boyer, The Invention of Analytic Geometry, Scientific American, 1949.
  2. Howard W. Eves, An Introduction to the History of Mathematics, Saunders, 1990.
  3. David M. Burton, Elementary Number Theory, McGraw-Hill Higher Education, 2010.
  4. Saul Stahl, Real Analysis: A Historical Approach, John Wiley & Sons, 1999.
  5. Pierre de Fermat, Wikipedia.