## The Sum of Cubes is the Square of the Sum

It’s fairly well-known, to those who know it, that

$\displaystyle \left(\sum_{k=1}^n k \right)^2 = \frac{n^2(n+1)^2}{4} = \sum_{k=1}^n k^3$.

In other words, the square of the sum of the first n positive integers equals the sum of the cubes of the first n positive integers.

It’s probably less well-known that a similar relationship holds for $\tau$, the function that counts the number of divisors of an integer:

$\displaystyle \left(\sum_{d|n} \tau(d) \right)^2 = \sum_{d|n} \tau(d)^3$.

In this post we’re going to prove this formula for $\tau$.

First, it’s pretty easy to see what the value of $\tau$ is for prime powers; i.e., integers of the form $p^e$, where p is prime. Since the only divisors of $p^e$ are $1, p, p^2, \ldots, p^e$, the number of divisors of $p^e$ is given by $\tau(p^e) = e+1$.

Let’s check the identity we’re trying to prove when $n = p^e$. We have

$\displaystyle \left(\sum_{d|p^e} \tau(d) \right)^2 = \left(\tau(1) + \tau(p) + \tau(p^2) + \cdots + \tau(p^e)\right)^2 \\ = \left(1 + 2 + 3 + \cdots + (e+1)\right)^2 = \left( \frac{(e+1)(e+2)}{2}\right)^2.$

We also have

$\displaystyle \sum_{d|p^e} \tau(d)^3 = \tau(1)^3 + \tau(p)^3 +\tau(p^2)^3 + \cdots + \tau(p^e)^3 \\ = 1^3 + 2^3 + 3^3 + \cdots + (e+1)^3 = \left( \frac{(e+1)(e+2)}{2}\right)^2.$

Clearly, the two expressions are equal, so the identity we’re trying to prove holds in the prime-power case. (And, in fact, the derivation uses the identity about the sum of the first several positive integers mentioned at the beginning of the post!)

Let $f(n) = \sum_{d|n} \tau(d)$ and $F(n) = \sum_{d|n} \tau(d)^3$. What we’ve shown thus far is that $f(p^e) = F(p^e)$.

Now, we’re going to pull some elementary number theory. One fact about $\tau$ is that it is multiplicative; i.e., $\tau(mn) = \tau(m) \tau(n)$ when m and n are relatively prime. This is one of the first properties you learn about $\tau$ once you learn its definition, and we’re not going to prove it here.

It turns out that both f and F are multiplicative as well! First, the product of two multiplicative functions is also multiplicative. (This is a one-line proof using the definition of multiplicative.) So $\tau(d)^3$ is multiplicative.

Another property of multiplicative functions is that if g is multiplicative, then $\sum_{d|n} g(d)$ is also multiplicative. This is a special case of the more general result that the Dirichlet convolution of two multiplicative functions is multiplicative. (In the Dirichlet convolution $g \star h$, take h to be the identity function; i.e., $h(n) = 1$.) This means that our functions f and F defined in the previous paragraph are both multiplicative.

Therefore, with the prime-power factorization of n given by $n = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k}$, we have

$\displaystyle \left(\sum_{d|n} \tau(d) \right)^2 = f(n) = f(p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k}) = f(p_1^{e_1}) f(p_2^{e_2}) \cdots f(p_k^{e_k}) \\= F(p_1^{e_1}) F(p_2^{e_2}) \cdots F(p_k^{e_k}) = F(p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k}) = F(n) = \sum_{d|n} \tau(d)^3.$

For an even further generalization, see Barbeau and Seraj [1]. (The proof we give in this post follows the same basic argument as the proof of Proposition 1 in Barbeau and Seraj’s paper.)

1. Barbeau, Edward, and Samer Seraj, “Sum of cubes is square of sum,” Notes on Number Theory and Discrete Mathematics 19(1), 2013, pages 1–13.

This entry was posted in number theory. Bookmark the permalink.