Welcome! This repository contains the detailed solutions to the challenges posed in my article Discrete Calculus: The Power of Finite Differences.
The Problem:
Show that
$\Delta(u_n v_n) = v_{n+1}\Delta u_n + u_n \Delta v_n$ . Use this to derive the "Summation by Parts" formula:$\sum u_n \Delta v_n = u_n v_n - \sum v_{n+1} \Delta u_n$ .
In continuous calculus, the product rule is
By definition:
To make this look like the difference operator, we need to add and subtract
Now, factorise:
Recognising the definitions of
To derive the summation by parts formula, we take the antidifference of both sides of the result above:
Rearranging to isolate
The Problem:
Use Summation by Parts to find a closed form for
$\sum_{k=1}^n k 2^k$ .
In continuous calculus, integrating
Let's choose u and v:
- Let
$u_k = k \implies \Delta u_k = 1$ - Let
$\Delta v_k = 2^k \implies v_k = 2^k$ (Using the fact that $ \Delta 2^k = 2^k $ )
Notice that our formula requires
Now, plug these into the Summation by Parts formula from Challenge 1:
First, evaluate the limits block:
Next, evaluate the remaining sum. We can pull out a factor of
This is a standard geometric series:
Finally, put it all together:
To tidy this up, we can write
The Problem:
Come up with a general method to find
$\sum_{k=1}^n k^a$ . If you can code, try implementing it in python/sympy.
The difficult part is finding a way to generally represent any
There are a few cool ways to go about this, including using the discrete Taylor series expansion called the Newton series expansion. This can even get you a closed form! I've written out that derivation here because it took me too long not to.
(If you want to try this: Use the fact that
You can also find an algorithm by inductive construction. Email me at kdlegum [at] gmail [dot] com if you're curious.
Below is what I think is the simplest way I've found so far and my thought process.
We want to find coefficients
The only term on the RHS that contributes to the coefficient of
So now we have:
Now we can expand
Clearly, we will be able to continue doing this until we've found all of the coefficients
An implementation of this in python is in this repo.
A linear system with this structure — where you can solve for each coefficient one at a time by matching terms — is called triangular.
The coefficients you've solved for are a famous result from combinatorics, called Stirling numbers of the Second Kind, denoted
The closed form solution to the original problem is called Faulhaber's formula or sometimes Bernoulli's formula, which is usually presented as:
where
There are also a lot of crazy looking solutions on the Faulhaber's formula Wikipedia page.
Update: By complete coincidence, a few great youtube videos about this topic have been uploaded recently which I will share here:
Faulhaber's formula and that linear system we solved is intrisically tied to the Bernoulli numbers, which are also tied to the Riemann Zeta function. Check out how what we derived links to the Riemann Zeta function's analytic continuation and therefore the distrubution of prime numbers.