You are here

Lagrange’s Work on Wilson’s Theorem: Three Mini-Primary Source Projects for Number Theory Students

Carl Lienert (Fort Lewis College)


Joseph-Louis Lagrange (1736–1813) enthusiastically began his paper “Proof of a New Theorem Concerning Prime Numbers” [Lagrange 1771] by declaring

I have just found, in an excellent work of Mr. Waring that I recently received, a beautiful arithmetic theorem, which is: If \(n\) is any prime number, the number \(1\cdot 2 \cdot 3 \cdot 4 \cdots (n-1)+1\) will always be divisible by \(n\).

The theorem is known today as Wilson’s Theorem in honor of John Wilson (1741–1793), a student of Edward Waring (1736–1798), who made the observation. Lagrange’s treatment of this beautiful theorem provides a unique opportunity to expose students to two important results of number theory, stated here using modern notation:1

  • Wilson’s Theorem: If \(p\) is prime, then \((p-1)! \equiv -1 \pmod{p}\).
  • Fermat’s Little Theorem: If \(p\) is prime and \(\gcd(a,p)=1\), then \(a^{p-1} \equiv 1 \pmod{p}\).

His paper is an interesting setting in which to study these results. First, Lagrange presented his proofs in a constructive fashion. That is, he worked through the motivating calculations and presented the results as a consequence. Second, many important number theoretic tools and techniques are used along the way. The three mini-Primary Source Projects (mini-PSPs) presented here take advantage of these pedagogical benefits and Lagrange’s clear writing to guide students through the major highlights of Lagrange’s paper:

  • a proof of Wilson’s Theorem that allowed him to deduce Ferma’s Little Theorem as a corollary;
  • a proof of the converse of Wilson's Theorem; and
  • a proof of Wilson’s Theorem that assumes Fermat’s Little Theorem.

Portrait of Pierre Fermat     Portrait of Joseph-Louis Lagrange     Portrait of mathematician John Wilson
A Trio of Number Theorists: Pierre de Fermat (left, 1601–1665), Joseph-Louis Lagrange (center),
and John Wilson (right). Images courtesy of Convergence Portrait Gallery and Wikipedia.

The mini-PSP Lagranges Proof of Wilsons Theoremand More presents Lagrange’s first proof of Wilson's Theorem, which he began by comparing the coefficients of the polynomial \[f(x)=(x+1)(x+2)\cdots(x+n-1)\] to those of \(f(x+1)\) using the case of the Binomial Theorem \[(x+1)^n=x^n+nx^{n-1}+\frac{n(n-1)}{2}x^{n-2}+\frac{n(n-1)(n-2)}{2 \cdot 3}x^{n-3}+\dots + nx+1.\] This approach provides a nice illustration of how moving a question from its obvious setting to a larger setting can serve as a powerful problem-solving technique. The main technique in the proof involves solving the system of equations that results from the comparison of these coefficients. Other tools that are used include Euclid's Lemma and the Division Theorem. To prove Fermat’s Little Theorem as a consequence of this approach to Wilson’s Theorem, Lagrange then made a divisibility observation about the polynomial he used in his main proof.

The mini-PSP Lagranges Proof of the Converse of Wilsons Theorem guides students to think carefully about the statement of Wilson’s Theorem, its converse and its contrapositive. Students must also make careful use of quantifiers. While the converse of Wilson’s Theorem does not appear frequently in number theory, the proof itself is pedagogically interesting, especially for students who are relatively new to proof writing. The main number theory tools that appear are about divisibility and the Division Theorem.

In the mini-PSP Lagranges Alternate Proof of Wilsons Theorem students study Lagrange’s second proof of Wilson's Theorem, in which he assumed Fermat’s Little Theorem as a starting point. Modern textbooks often take this approach, but not in the way Lagrange did. Lagrange used the Theory of Differences, that is, a discrete version of differentiation. This is the only part of the three projects that is not common in a modern mathematics curriculum. However, it’s fun, and the necessary explanation and key result, which students are asked to confirm but not prove, are included in the project. Again, divisibility arguments, the Division Theorem, and the Binomial Theorem—here in the form of expanding \((1-1)^n\)—are used.

All three mini-PSPs are ready for student use:

Each project presents a part of Lagrange’s paper, summarized above in the order in which they appear in Lagrange’s paper. The projects themselves are fully independent of each other and can be used either singly or in combination in any order. A set of instructor notes offering practical advice for classroom use is appended at the end of each project. The LaTeX source of the complete project is also available from the author by request.

These projects mark the twenty-ninth entry in A Series of Mini-projects from TRIUMPHS: TRansforming Instruction in Undergraduate Mathematics via Primary Historical Sources appearing in Convergence, for use in courses ranging from precalculus and first year calculus to analysis, number theory to topology, and more. Links to other mini-PSPs in this series appear below, including the number theory mini-PSPs Generating Pythagorean Triples and The Origin of the Prime Number Theorem. The full TRIUMPHS collection also offers other PSPs (some mini, some not) for use in teaching standard topics in introductory number theory courses, including a project that combines the content of the three mini-PSPs based on Lagrange’s study of Wilson’s Theorem into a single “full-length” PSP.


The development of the student projects presented in this article has been partially supported by the TRansforming Instruction in Undergraduate Mathematics via Primary Historical Sources (TRIUMPHS) project with funding from the National Science Foundation’s Improving Undergraduate STEM Education Program under Grants No. 1523494, 1523561, 1523747, 1523753, 1523898, 1524065, and 1524098. Any opinions, findings, and conclusions or recommendations expressed in this project are those of the author and do not necessarily reflect the views of the National Science Foundation.


Lagrange, Joseph-Louis. 1771. Démonstration d’un Théorème Nouveau Concernant les Nombres Premiers (Proof of a New Theorem Concerning Prime Numbers). Nouveaux Mémoires de l’Académie Royale des Sciences et Belles-Lettres de Berlin, année 1771, 425–438. Also in Œuveres de Lagrange, Tome 3, pp. 425–440.

[1] The student projects themselves are faithful to Lagrange’s notation and presentation of these theorems.


Carl Lienert (Fort Lewis College), "Lagrange’s Work on Wilson’s Theorem: Three Mini-Primary Source Projects for Number Theory Students," Convergence (October 2023), DOI:10.4169/20231002

A Series of Mini-projects from TRIUMPHS: TRansforming Instruction in Undergraduate Mathematics via Primary Historical Sources