
In
number theory
Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and integer-valued functions. German mathematician Carl Friedrich Gauss (1777–1855) said, "Math ...
, the sum of the first
cube
In geometry, a cube is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex. Viewed from a corner it is a hexagon and its net is usually depicted as a cross.
The cube is the on ...
s is the
square
In Euclidean geometry, a square is a regular quadrilateral, which means that it has four equal sides and four equal angles (90-degree angles, π/2 radian angles, or right angles). It can also be defined as a rectangle with two equal-length a ...
of the th
triangular number
A triangular number or triangle number counts objects arranged in an equilateral triangle. Triangular numbers are a type of figurate number, other examples being square numbers and cube numbers. The th triangular number is the number of dots i ...
. That is,
:
The same equation may be written more compactly using the mathematical notation for
summation
In mathematics, summation is the addition of a sequence of any kind of numbers, called ''addends'' or ''summands''; the result is their ''sum'' or ''total''. Beside numbers, other types of values can be summed as well: functions, vectors, m ...
:
:
This
identity is sometimes called Nicomachus's theorem, after
Nicomachus of Gerasa (c. 60 – c. 120 CE).
History
Nicomachus, at the end of Chapter 20 of his ''Introduction to Arithmetic'', pointed out that if one writes a list of the odd numbers, the first is the cube of 1, the sum of the next two is the cube of 2, the sum of the next three is the cube of 3, and so on. He does not go further than this, but from this it follows that the sum of the first cubes equals the sum of the first
odd numbers, that is, the odd numbers from 1 to
. The average of these numbers is obviously
, and there are
of them, so their sum is
Many early mathematicians have studied and provided proofs of Nicomachus's theorem. claims that "every student of number theory surely must have marveled at this miraculous fact". finds references to the identity not only in the works of
Nicomachus
Nicomachus of Gerasa ( grc-gre, Νικόμαχος; c. 60 – c. 120 AD) was an important ancient mathematician and music theorist, best known for his works '' Introduction to Arithmetic'' and '' Manual of Harmonics'' in Greek. He was born ...
in what is now
Jordan
Jordan ( ar, الأردن; tr. ' ), officially the Hashemite Kingdom of Jordan,; tr. ' is a country in Western Asia. It is situated at the crossroads of Asia, Africa, and Europe, within the Levant region, on the East Bank of the Jordan Ri ...
in the first century CE, but also in those of
Aryabhata in
India
India, officially the Republic of India ( Hindi: ), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country, and the most populous democracy in the world. Bounded by the Indian Ocean on the ...
in the fifth century, and in those of
Al-Karaji circa 1000 in
Persia
Iran, officially the Islamic Republic of Iran, and also called Persia, is a country located in Western Asia. It is bordered by Iraq and Turkey to the west, by Azerbaijan and Armenia to the northwest, by the Caspian Sea and Turkme ...
. mentions several additional early mathematical works on this formula, by
Al-Qabisi
Abu al-Saqr Abd al-Aziz ibn Uthman ibn Ali al-Qabisi, generally known as Al-Qabisi, (Latinised as Alchabitius or Alcabitius), and sometimes known as ''Alchabiz'', ''Abdelazys'', ''Abdilaziz'' (Arabic:'' 'Abd al-Azîz'', عبدالعزيز ال ...
(tenth century Arabia),
Gersonides (circa 1300 France), and
Nilakantha Somayaji (circa 1500 India); he reproduces Nilakantha's visual proof.
Numeric values; geometric and probabilistic interpretation

The sequence of squared triangular numbers is
These numbers can be viewed as
figurate numbers, a four-dimensional hyperpyramidal generalization of the
triangular number
A triangular number or triangle number counts objects arranged in an equilateral triangle. Triangular numbers are a type of figurate number, other examples being square numbers and cube numbers. The th triangular number is the number of dots i ...
s and
square pyramidal number
In mathematics, a pyramid number, or square pyramidal number, is a natural number that counts the number of stacked spheres in a pyramid with a square base. The study of these numbers goes back to Archimedes and Fibonacci. They are part of a br ...
s.
As observes, these numbers also count the number of rectangles with horizontal and vertical sides formed in an
grid. For instance, the points of a grid (or a square made up of three smaller squares on a side) can form 36 different rectangles. The number of squares in a square grid is similarly counted by the square pyramidal numbers.
The identity also admits a natural probabilistic interpretation as follows. Let be four integer numbers independently and uniformly chosen at random between and . Then, the probability that is the largest of the four numbers equals the probability that is at least as large as and that is at least as large as . That is,