A classic problem in discete mathematics is finding the sum of the first natural numbers: . This sum can also be written as: .
There are various ways to find the answer to this question. If you take a college level discrete mathematics class, you will learn various techniques. I'm going to give a quick overview of some of these techniques applied to this specific case.
Let's call the sum we are looking for . The idea is to rewrite as the sum from to and then add both equations. Each element of the sum will nicely pair up:
Which leads to: . It is believed that Gauss discovered this method when he was 9.
If you have some intuition about the result or want to prove that Gauss found the right answer, you can prove that the result is right by induction.
Let's prove that the solution is correct for :
And then let's prove that is correct if is correct:
We can express the idea behind the first method above by using a formal notation. We need to use 4 properties:
We then have:
And we can add the first and last sum:
Let's define the sum of the square of every number from to :
We then have:
Since the last sum is 0 for , we can write:
We can cancel the :
Which leads to:
The repertoire method helps solve general forms of equations, e.g.:
This method works when the solution has the form:
We first set :
We then set :
Finally, we set :
Which results in the general solution: