14

I am quite new to generating functions concept and I am really finding it difficult to know how to approach problems like this. I need to find the sum of $1^3 + 2^3 + 3^3 +\dotsb+ n^3$ using generating functions. How do I proceed about it?

mdp
  • 14,671
  • 1
  • 39
  • 63
  • 2
    If you have a generating function $f(x)$ for a sequence $a_n$, then $xf'(x)$ gives a generating function for $na_n$. Can you produce a generating function for $a_k = k^3$ (for $k \le n$) this way? – Thomas Belulovich Oct 08 '12 at 15:01
  • The other element of the puzzle: from the generating function for the sequence $a_n$, do you understand how to find the generating function for the sequence $b_n=\sum_{i\leq n}a_i$? (Hint: if $g(x) = \sum_n b_nx^n$, what is $xg(x)$? What is $xg(x)-g(x)$? ) – Steven Stadnicki Oct 08 '12 at 15:46

7 Answers7

35

Let $s_n=\sum_{k=0}^nk^3$; your generating function for these numbers will be $$f(x)=\sum_{n\ge 0}s_nx^n\;.$$

You know that the sequence satisfies the recurrence $s_n=s_{n-1}+n^3$. Multiply this recurrence by $x^n$ and sum over $n\ge 0$:

$$\sum_{n\ge 0}s_nx^n=\sum_{n\ge 0}s_{n-1}x^n+\sum_{n\ge 0}n^3x^n\tag{1}\;.$$

The lefthand side of $(1)$ is $f(x)$. We assume that $s_n=0$ for all $n<0$, so we can rewrite $(1)$ as $$f(x)=x\sum_{n\ge 0}s_{n-1}x^{n-1}+\sum_{n\ge 0}n^3x^n=x\sum_{n\ge 0}s_nx^n+\sum_{n\ge 0}n^3x^n=xf(x)+\sum_{n\ge 0}n^3x^n$$ and see that $$f(x)=\frac1{1-x}\sum_{n\ge 0}n^3x^n\;.\tag{2}$$

To deal with the summation in $(2)$, start with $$\frac1{1-x}=\sum_{n\ge 0}x^n\;.$$ Differentiate and multiply by $x$ to get $$\frac{x}{(1-x)^2}=\sum_{n\ge0}nx^n\;.$$ Repeat: $$\frac{x(1+x)}{(1-x)^3}=\sum_{n\ge0}n^2x^n\;.$$ And one more time: $$\frac{x(1+4x+x^2)}{(1-x)^4}=\sum_{n\ge 0}n^3x^n\;.$$ Thus,

$$f(x)=\frac{x+4x^2+x^3}{(1-x)^5}\;.$$ Now decompose $f$ into partial fractions:

$$f(x)=-\frac1{(1-x)^2}+\frac7{(1-x)^3}-\frac{12}{(1-x)^4}+\frac6{(1-x)^5}\;.$$

Finally, you need to know some standard generating functions. In particular, you need to know that $$\frac1{(1-x)^k}=\sum_{n\ge 0}\binom{n+k-1}{k-1}x^n\;.$$ With that you get finally that

$$\begin{align*} f(x)&=\sum_{n\ge 0}\left(-\binom{n+1}1+7\binom{n+2}2-12\binom{n+3}3+6\binom{n+4}4\right)x^n\\ &=\sum_{n\ge 0}\frac14\left(n^4+2n^3+n^2\right)x^n \end{align*}$$

and therefore that $$s_n=\frac14\left(n^4+2n^3+n^2\right)=\left(\frac{n(n+1)}2\right)^2\;.$$

Brian M. Scott
  • 616,228
  • Nice post. I believe there is a typo on the line "Thus, $f(x)=...$". The denominator should be $(1-x)^5$. – Jonathan Oct 08 '12 at 16:23
  • @Jonathan: Thanks. You’re absolutely right. – Brian M. Scott Oct 08 '12 at 16:26
  • Perhaps it would be good, to make that nice (+1) derivation easier memorizable, using the incidence, that the occuring coefficients (1,4,1) are Eulerian numbers and (1,7,12,6) are $(0! \cdot 1, 1! \cdot 7, 2!\cdot 6, 3!\cdot 1)$ and thus simple scalings of the Stirling numbers 2'nd kind. Knowing this, one can simply gain the coefficients for problem-variations, where the exponent of the initial sequence varies... – Gottfried Helms Oct 08 '12 at 17:59
  • Thanks Brian for the beautiful solution. You made it absolutely clear. :) – user1631009 Oct 10 '12 at 15:14
  • @user1631009: You’re welcome. – Brian M. Scott Oct 11 '12 at 02:21
  • I think the function should be $f(x) = \frac{x(x^2 +4x+1)}{(1-x)^4}$ and not power 5, http://www.wolframalpha.com/input/?i=x%28x%5E2%2B4x%2B1%29%2F%281-x%29%5E4

    Wolfram even confirm this as it generates the sequence ${1,2^3,3^3,.... }$

    – alkabary Nov 22 '15 at 21:04
  • $f(x) = \frac{x(x^2+4x+1)}{(1-x)^5}$ generates a different result @BrianM.Scott

    http://www.wolframalpha.com/input/?i=x%28x%5E2%2B4x%2B1%29%2F%281-x%29%5E5

    – alkabary Nov 22 '15 at 21:05
  • @alkabary: No, it’s correct. You’re forgetting that $f(x)$ is $\frac1{1-x}\sum_nn^3x^n$, not $\sum_nn^3x^n$. – Brian M. Scott Nov 22 '15 at 22:21
  • But how come it gives incorrect results wen u do that taylor expansion of wolfram alpha (The 2nd link I provided) @BrianM.Scott

    and without $\frac{1}{1-x}$ it gives the correct one (first link)

    – alkabary Nov 23 '15 at 00:18
  • @alkabary: What do you mean? The second link shows exactly what it should show. – Brian M. Scott Nov 23 '15 at 00:24
9

You can do this more prettily with exponential generating functions. Note that $$e^{kx} = \sum_n \frac{k^n x^n}{n!}$$ so $$1+e^x+e^{2x} + e^{3x} + \cdots + e^{kx} = \sum_n \frac{(1+2^n+3^n + \cdots + k^n) x^n}{n!}.$$ The left hand side is $$(e^{kx}-1) \cdot \frac{1}{e^x-1} = \left( kx + \frac{k^2 x^2}{2} + \frac{k^3 x^3}{6} + \cdots \right) \left( \frac{1}{x} - \frac{1}{2} + \frac{x}{12} - \frac{x^3}{720} + \cdots \right)$$ where the second factor can be expressed in terms of Bernoulli numbers.

Now compare coefficients of $x^3$ on both sides.

4

Notice that $k^{3}=\frac{1}{4}[k^{2}(k+1)^{2}-(k-1)^{2}k^{2}]$, so

$$\sum_{k=1}^{n}k^{3} =\frac{1}{4}\sum_{k=1}^{n}[k^{2}(k+1)^{2}-(k-1)^{2}k^{2}] =\frac{1}{4}n^{2}(n+1)^{2}$$

Alfred Chern
  • 2,658
  • Thanks Alfred. Is there any way of solving this using generating functions? – user1631009 Oct 08 '12 at 15:16
  • @user1631009: I'm sorry. Because the question is of discrete type, I don't know how to deal it using generating function. Why you persist on using generating functions to solve the problem? – Alfred Chern Oct 08 '12 at 15:32
  • 1
    Interesting solution, even though it is not using generating functions. I wonder if similar approaches work for higher powers? – Maesumi Oct 08 '12 at 17:16
  • @Maesumi: Yes, there exist similar approaches work for higher powers, but seems more complex. – Alfred Chern Oct 08 '12 at 17:43
  • 3
    I'm not trying to be rude Alfred, but I don't understand why an answer that doesn't even answer the question is getting upvotes. – GeoffDS Oct 08 '12 at 19:06
  • 2
    I agree with Graphth. This answer may be correct, but the question seems to be asked with the intent to better understand generating functions. This question does not address the question. – Michael Dyrud Oct 08 '12 at 21:07
  • @Graphth: I'm sorry, I'm wrong in understand and solve the problem as claim. – Alfred Chern Oct 09 '12 at 02:31
  • 1
    @AlfredChern, Can you explain what you did here? is it a telescoping series? – AnnieOK Jun 16 '14 at 18:25
  • This is cheating, in a way, as the terms are just $\sum_{0 \le k \le n} k^3$ and $\sum_{0 \le k \le n - 1} k^3$, and so it telescopes. – vonbrand Aug 25 '15 at 16:42
1

Note that if $A(z) = \sum_{n \ge 0} a_n z^n$, then

$$ z \frac{\mathrm{d}}{\mathrm{d} z} A(z) = \sum_{n \ge 0} n a_n z^n $$

and also:

$$ \frac{A(z)}{1 - z} = \sum_{n \ge 0} \left( \sum_{0 \le k \le n} a_k \right) z^n $$

Starting with:

$$ \sum_{n \ge 0} z^n = \frac{1}{1 - z} $$

the generating function for the sum you want is:

$\begin{align} \frac{z}{1 - z} \frac{\mathrm{d}}{\mathrm{d} z} \left( z \frac{\mathrm{d}}{\mathrm{d} z} \left( z \frac{\mathrm{d}}{\mathrm{d} z} \frac{1}{1 - z} \right) \right) &= \frac{z (1 + 4 z + z^2)}{(1 - z)^5} \end{align}$

Thus:

$\begin{align} \sum_{0 \le k \le n} k^3 &= [z^n] \frac{z (1 + 4 z + z^2)}{(1 - z)^5} \\ &= [z^n] (z + 4 z^2 + z^3) \sum_{k \ge 0} (-1)^k \binom{-5}{k} z^k \\ &= [z^n] (z + 4 z^2 + z^3) \sum_{k \ge 0} \binom{k + 5 - 1}{5 - 1} z^k \\ &= \binom{n - 1 + 4}{4} + 4 \binom{n - 2 + 4}{4} + \binom{n - 3 + 4}{4} \\ &= \frac{n^2 (n + 1)^2}{4} \end{align}$

Note that:

$$ \sum_{0 \le k \le n} k^3 = \left( \sum_{0 \le k \le n} k \right)^2 $$

vonbrand
  • 27,812
0

If you really want to get blown away, consider the following, taken from Aigner's "A Course in Enumeration" (Springer, 2007). Define:

$$ s_m(n) = \sum_{0 \le k < n} k^m $$

and it's exponential generating function:

$ \begin{align} \widehat{S}_n(z) &= \sum_{m \ge 0} s_m(n) \frac{z^m}{m!} \\ &= \sum_{1 \le k \le n - 1} \sum_{m \ge 0} \frac{k^m z^m}{m!} \\ &= \sum_{1 \le k \le n - 1} \mathrm{e}^{k z} \\ &= \frac{\mathrm{e}^{n z} - 1}{\mathrm{e}^z - 1} \end{align} $

This is almost the exponential generating function for the powers:

$ \begin{align} \widehat{P}(z) &= \sum_{m \ge 0} n^m \frac{z^m}{m!} \\ &= \mathrm{e}^{n z} \end{align} $

Sadly, the series $\mathrm{e}^z - 1$ has no reciprocal, as it has no constant term. But we can write:

$$ (\widehat{P}(z) - 1) \widehat{B}(z) = z \widehat{S}(z) $$

where:

$$ \widehat{B}(z) = \frac{z}{\mathrm{e}^z - 1} $$

whose coefficients are the Bernoulli numbers:

$\begin{align} \widehat{B}(z) &= \sum_{n \ge 0} B_n \frac{z^n}{n!} \\ &= 1 - \frac{1}{2} z + \frac{1}{6} \frac{z^2}{2!} - \frac{1}{30} \frac{z^4}{4!} + \frac{1}{42} \frac{z^6}{6!} - \frac{1}{30} \frac{z^8}{8!} + \frac{5}{66} \frac{z^{10}}{10!} - \frac{691}{2130} \frac{z^{12}}{12!} + \frac{7}{6} \frac{z^{14}}{14!} - \dotsb \end{align}$

and finally:

$$ \sum_{m \ge 0} s_m(n) \frac{z^{m + 1}}{m!} = \sum_{m \ge 0} z^m \sum_{0 \le k \le m} \binom{m}{k} \frac{(n z)^{m - k}}{(m - k)!} B_k $$

Comparing coefficients of $z^{m + 1}$ and simplifying:

$$ s_m(n) = \frac{1}{m + 1} \sum_{0 \le k \le m} (-1)^k \binom{m + 1}{k} B_k n^{m + 1 - k} $$

vonbrand
  • 27,812
0

Yet another way is to start with:

$$ \sum_{0 \le k \le n} z^k = \frac{1 - z^{n + 1}}{1 - z} $$

differentiate thrice:

$$ \frac{\mathrm{d}}{\mathrm{d} z} \left( z \frac{\mathrm{d}}{\mathrm{d} z} \left( z \frac{\mathrm{d}}{\mathrm{d} z} \frac{1 - z^{n + 1}}{1 - z} \right) \right) = \frac{1 + 4 z + z^2 - z^n (1 - 3 n^2 - n^3) - z^{n + 1} (4 - 6 n^2 - 3 n^3) - z^{n + 2} (1 - 3 n + 3 n^2 + 3 n^3) + z^{n + 3} n^3} {(1 - z)^4} $$

Taking the limit as $z \to 1$ of this mess (l'Hôpital to the rescue) again gives:

$$ \sum_{0 \le k \le n} k^3 = \frac{n^2 (n + 1)^2}{4} $$

The above courtesy of my CAS, maxima. Any transcription errors are mine only.

vonbrand
  • 27,812
0

This is the particular case $p=3$ , more generally known as the Faulhaber formula which gives a closed-form for the sum $\sum_{k=1}^n k^p$

Some more proofs can be found here: p1,p2,p3

wsdookadr
  • 151