Courses for Kids
Free study material
Offline Centres
Store Icon

Lagrange's Four-Square Theorem

Last updated date: 27th May 2024
Total views: 174.9k
Views today: 3.74k
hightlight icon
highlight icon
highlight icon
share icon
copy icon

An Introduction to Lagrange's Four-Square Theorem

According to Lagrange's four-square theorem, also referred to as Lagrange's theorem, every positive integer can be expressed as the sum of squares of four non-negative numbers. Thus, the squares constitute an order of four additive bases. Fermat used infinite descent to demonstrate the theorem, but the proof was disregarded. The theorem could not be validated by Euler. Lagrange provided the initially published proof. Lagrange's Four-Square Theorem will be covered in this session.

History of the Joseph-Louis Lagrange

Joseph-Louis Lagrange, sometimes known as Giuseppe Luigi Lagrange or Lagrangian, was a mathematician and astronomer from Italy who eventually acquired French citizenship. Analysis, number theory, and both classical and celestial mechanics all benefited from his substantial contributions. In 1770, he released the original proof of the four-square theorem.

Joseph-Louis Lagrange

Joseph-Louis Lagrange

Lagrange's Theorem Statement

According to Lagrange's four-square theorem, commonly known as Bachet's conjecture, every natural number can be written as the sum of four integer squares. In other words, the squares create a four-order additive basis.

Lagrange's Theorem Formula

According to the Lagrange theorem,

\[p = a_0^2 + a_1^2 + a_2^2 + a_3^2\]

where the four numbers \[{a_0},{a_1},{a_2},{a_3}\] are integers.

Lagrange Theorem Proof

The Classical Proof:

Every odd prime integer p can be used to prove the theorem. This naturally results from Euler's identity of a four-square (and from the fact that the theorem is true for the numbers 1 and 2).

Every a between 0 and \[\dfrac{{\;\left( {p\; - 1} \right)}}{2}\] has a different set of residues for a2 modulo p (inclusive). Take some a and define c as a2 mod p to show this. The polynomial \[{x^2} - c\;\] over the field \[\dfrac{Z}{{pZ}}\] has a root called a. Likewise, p - a (which is different from a). There are no other polynomials with this property, especially not among 0 to \[\dfrac{{\;\left( {p\; - 1} \right)}}{2}\], according to the Lagrange theorem (numerical theory), which states that each polynomial of degree n in a field K has at most n different roots.

The\[ - \;{b^2}\; - 1\] are distinct for b taking integral values between 0 and \[\dfrac{{\;\left( {p\; - 1} \right)}}{2}\] (inclusive). According to the pigeonhole principle, a and b exist in this range for which $a^{2}$ and $b^{2}$ are congruent modulo p, or for which

\[{a^2} + {b^2} + {1^2} + {0^2} = np\]

Let m be the smallest positive integer that has the property that mp is the sum of the four squares \[{x_1}^2\; + \;{x_2}^2\; + \;{x_3}^2\; + \;{x_4}^2\] (we just proved that there is at least one m, namely n, that has this property; hence, m is smaller than p). We prove the existence of a positive integer r less than m, for which RP is also the sum of four squares if our proof that m equals 1 is false (this is in the spirit of the infinite descent method of Fermat).

In order to achieve this, we take into account the \[{y_i}\] for each \[{x_i}\] that belongs to the same residue class modulo m and falls between \[\dfrac{{\left( { - m\; + \;1} \right)}}{2}\] and \[\dfrac{m}{2}\] (possibly included). It follows that for some strictly positive integer r less than m, \[{y_1}^2\; + \;{y_2}^2\; + \;{y_3}^2\; + \;{y_4}^2\; = \;mr\]

Euler's four-square identity is then used once more to demonstrate that \[mpmr\; = \;{z_1}^2\; + \;{z_2}^{2\;} + \;{z_3}^2\; + \;{z_4}^2.\]. But since each \[{x_i}\] coincides with its corresponding \[{y_i}\], it follows that all\[{z_i}\] are divisible by m. Indeed,

\[\left\{ \begin{array}{l}{z_1} = {x_1}{y_1} + {x_2}{y_2} + {x_3}{y_3} + {x_4}{y_4} \equiv x_1^2 + x_2^2 + x_3^2 + x_4^2 = mp = 0(\bmod m)\\{z_2} = {x_1}{y_2} - {x_2}{y_1} + {x_3}{y_4} - {x_4}{y_3} \equiv {x_1}{x_2} - {x_2}{x_1} + {x_3}{x_4} - {x_4}{x_3} = 0(\bmod m)\\{z_3} = {x_1}{y_3} - {x_2}{y_4} - {x_3}{y_1} + {x_4}{y_2} \equiv {x_1}{x_3} - {x_2}{x_4} - {x_3}{x_1} + {x_4}{x_2} = 0(\bmod m)\\{z_4} = {x_1}{y_4} + {x_2}{y_3} - {x_3}{y_2} - {x_4}{y_1} \equiv {x_1}{x_4} + {x_2}{x_3} - {x_3}{x_2} - {x_4}{x_1} = 0(\bmod m)\end{array} \right\}\]

For \[{w_i}\; = \;\dfrac{{{z_i}}}{m}\], it follows that \[{w_i}\; = \;\dfrac{{z_i}}{m},\;{w_1}^2\; + \;{w_2}^2\; + \;{w_3}^2\; + \;{w_4}^2\; = \;rp\], which is in conflict with m's minimality.

Both the situation \[{y_1}\; = \;{y_2}\; = \;{y_3}\; = \;{y_4}\; = \dfrac{{\;m}}{2}\] (which would give r = m and no descent) and the case\[\;{y_1}\; = \;{y_2}\; = \;{y_3}\; = \;{y_4}\; = \;0\] (which would give r = 0 rather than strictly positive) must be ruled out in the aforementioned descent. In both instances, it is possible to verify that \[mp\; = \;{x_1}^2\; + \;{x_2}^2\; + \;{x_3}^2\; + \;{x_4}^2\] would be a multiple of \[{m^2}\], which would be in opposition to the assertion that p is a prime number bigger than m.

Applications of Lagrange's Four-Square Theorem

Lagrange's Four-Square Theorem gives a formula for the number of ways that a given natural number n can be represented as the sum of four squares. The theorem can be applied to every natural number. Like even for big numbers like one lakh or one crore.

Lagrange's Four-Square Theorem Examples

1. Express the number 23 as a sum of four squares using Lagrange's four-square theorem.

Ans: By Lagrange's four-square theorem,

\[p = a_0^2 + a_1^2 + a_2^2 + a_3^2\]

That means \[p\; = 23\]

And if we consider

$a_{0} = 1 \\ a_{1} = 2 \\ a_{2} = 3 \\ a_{3} = 3$


\[\begin{array}{l}23\; = \;1 + 4 + 9 + 9\\23 = \;23\end{array}\]

This is true.

So, 23 can be expressed as

\[23\; = \;{1^2}\; + {2^2} + {3^2} + {3^2}\].

2. How will you write 2012 as a sum of four squares using Lagrange's four-square theorem?

Ans: By Lagrange's four-square theorem,

\[p = a_0^2 + a_1^2 + a_2^2 + a_3^2\]

That means \[p\; = 2012\]

And if we consider,

$a_{0} = 44 \\ a_{1} = 6 \\ a_{2} = 6 \\ a_{3} = 2$


\[\begin{array}{l}2012\; = \;1936 + 36 + 36 + 4\\2012\; = \;2012\end{array}\]

This is true.

So, 2012 can be expressed as

\[2012\; = \;{44^2} + {6^2} + {6^2} + {2^2}\].

3. Show that 7839 can be written as the sum of four squares.

Ans: Using Lagrange's four-square theorem, we can say that 7839 can be written as sums of four squares.

\[p = a_0^2 + a_1^2 + a_2^2 + a_3^2\]

Using Lagrange's four-square theorem,

That means \[p\; = 7839\]


$a_{0} = 77 \\ a_{1} = 31 \\ a_{2} = 30 \\ a_{4} = 7$


\[\begin{array}{l}7839\; = 5929 + 961 + 900 + 49\\7839\; = \;7839\end{array}\]

This is true.

So, 7839 can be expressed as

\[7839 = \;{77^2} + {31^2} + {30^2} + {7^2}\,\].

Important Points to Remember

  • Any positive integer can be represented as the sum of the squares of four positive numbers.

  • The Lagrange's Four-Square theorem is applicable to every single natural number.

Important Formula from the Theorem

Any natural number p can be expressed as

\[p = a_0^2 + a_1^2 + a_2^2 + a_3^2\]

where the four numbers \[{a_0},{a_1},{a_2},{a_3}\] are integers.


In this article, we went over Lagrange's four-square theorem and its proof in great depth. It is evident from the previous discussion of Lagrange's four-square theorem that Lagrange's four-square theorem provides us with a way to write every natural number in the form of four squares.

Popular Vedantu Learning Centres Near You
Mithanpura, Muzaffarpur
location-imgVedantu Learning Centre, 2nd Floor, Ugra Tara Complex, Club Rd, opposite Grand Mall, Mahammadpur Kazi, Mithanpura, Muzaffarpur, Bihar 842002
Visit Centre
Anna Nagar, Chennai
location-imgVedantu Learning Centre, Plot No. Y - 217, Plot No 4617, 2nd Ave, Y Block, Anna Nagar, Chennai, Tamil Nadu 600040
Visit Centre
Velachery, Chennai
location-imgVedantu Learning Centre, 3rd Floor, ASV Crown Plaza, No.391, Velachery - Tambaram Main Rd, Velachery, Chennai, Tamil Nadu 600042
Visit Centre
Tambaram, Chennai
location-imgShree Gugans School CBSE, 54/5, School road, Selaiyur, Tambaram, Chennai, Tamil Nadu 600073
Visit Centre
Avadi, Chennai
location-imgVedantu Learning Centre, Ayyappa Enterprises - No: 308 / A CTH Road Avadi, Chennai - 600054
Visit Centre
Deeksha Vidyanagar, Bangalore
location-imgSri Venkateshwara Pre-University College, NH 7, Vidyanagar, Bengaluru International Airport Road, Bengaluru, Karnataka 562157
Visit Centre
View More
Competitive Exams after 12th Science

FAQs on Lagrange's Four-Square Theorem

1. What are natural numbers?

Natural numbers are utilised for counting as well as being a part of the number system that consists of all positive integers from 1 to infinity. It does not contain zero (0). In actuality, the numerals 1, 2, 3, 5, 6, 7, 8, 9,...

Natural numbers are a subset of real numbers, which only comprise positive integers such as 1, 2, 3, 4, 5, and 6 and exclude any other values such as zero, fractions, decimals, and negative numbers. These numbers can be counted and are frequently used for mathematical purposes. "N" stands for the collection of natural numbers.

2. How Euler’s four-square identity is related to Lagrange’s four-square theorem?

By reducing the problem to the case of prime numbers, the main theorem's proof is established. Lagrange's four-square theorem is implied by Euler's four-square identity, which states that if it holds for two integers, it also holds for the sum of the two numbers. For $2 =  1^{2} + 1^{2} + 0^{2}+0^{2},$ it holds. To determine this, consider an odd prime number p as a quaternion with the coordinates (p,0,0,0), and suppose for the time being (as we will demonstrate later) that it is not a Hurwitz irreducible, that is, that it can be factored into two non-unit Hurwitz quaternions.

3. What is the four square theorem's history?

The Greek mathematician Diophantus of Alexandria initially proposed the four-square theorem in his work Arithmetica (3rd century CE). The French amateur mathematician Pierre de Fermat, who lived in the 17th century, is credited with creating the first proof. The last theorem of Fermat was the result of his study of Diophantus, even though he did not publish this proof. The Italian mathematician Joseph-Louis Lagrange, after whom the theory is currently named, published the first proof of the four-square theorem in 1770.