Natural numbers are the first numbers that we learn at an early age. They are represented mathematically as
We want to find a general formula for
The term
We want to represent
Mathematical induction is a proof technique in which a statement like
According to the proposed formula,
Here, we assume that the formula holds for
We know that
We can rewrite the above expression as:
We know that
This completes the proof.
We have proved that
Let’s start with a quadratic equation for
Finding the value of the constants
Let’s put the values of
Let’s remove one of the variables.
Now, let’s remove another variable.
Using the value of
Using the values of
Using these values, we can see that:
Again, we are getting the same formula but using a different technique.
Let’s briefly describe the third method before moving on to the more interesting solutions.
The first three equations from the previous section will be used as a starting point for this method. Let’s rewrite those equations below.
The following matrices and matrix multiplication express these three equations:
If we multiply both sides by the inverse of the first matrix, we will get the values of
The inverse of
We get the following result if we multiply both sides with this inverse matrix:
Once more, we reach the same conclusion, the same values for the variables, and the same closed-form, i.e.,
Consider a graph with
For
For
For
Let’s count the number of edges of
Let’s count the edges of each vertex one by one. The first vertex is connected to all the other
The second vertex is also connected to all the other
For the third vertex, which, again, is connected to all the other
We can see a decreasing trend here; first we get
This means the total number of edges in
By writing the same terms in increasing order, we get
In the last section, we noticed that in
Here, every edge is counted twice. This is because every edge is connecting two vertices. This means that this edge is counted in the list of edges of both vertices, implying that in the previous part, we over-counted the number of edges by a factor of two. In mathematical terms, this is called double counting. To fix this, we simply need to divide the result by
In both methods, we are counting the same quantity—the total number of edges in a completely connected graph with
Let’s suppose we have
You can observe a triangle-like shape in the above image if you notice carefully. These number of blocks are also called triangular numbers. The above image represents the fifth triangular number because it contains five piles.
You can also observe that the last pile contains the maximum number of blocks. This maximum number is equal to the number of piles in the diagram. Here, it is five.
If we flip the arrangement of these blocks along the diagonal, the total number of blocks will remain unchanged. For five piles, this rearrangement can be shown in the diagram below.
Stacking these piles on each other will convert these two triangles into a rectangular structure, as shown in the diagram below.
Because we combined both piles, the total number of blocks now is
The above argument provides a visual proof of the underlying closed-from expression.
The numbers under discussion are called triangular numbers. Let’s discuss another method that uses the formula to calculate the area of a triangle.
The above illustration represents the fifth triangular number. This is the same illustration that we saw earlier but with the spaces between the boxes removed. Let’s suppose that each side of these squares is of unit length, which means that this square has an area of
For the
This method also produces the exact same formula as the previous ones.
Now, let’s discuss the final and the most elegant argument among all of these. This method is attributed to Gauss. The story goes like this.
When Gauss was in elementary school, his teacher, who was not in the mood to teach that day, asked his students to add the first 100 natural numbers. Just as the teacher wanted, his classmates added the integers one by one. To everyone’s surprise, including the teacher, Gauss announced the answer
Let’s look at the illustration above. The first number
Let’s start with the following equation.
We want to find out a closed-form expression for
Now, let’s add these two equations. Let’s write them again, one over the other, so that the addition process can be described easily.
Each pair adds up to
A different flavor of the same proof is also available in a blog explaining why vector (in C++) and arraylist (in Java) are so fast.
It is easy to observe that the method used by Gauss is simple and does not require much understanding of mathematical proofs and other problem-solving techniques. However, other techniques have their own advantages because they can be used in several different scenarios.
As you see, there are multiple ways to achieve the same results. Some of these methods are long, some short. Some of them are boring, others very interesting. Some of them even fascinate us enough to learn more about the topic.
To learn more about counting techniques and graphs, please look at the following very interesting courses. These courses will capture your interest and guide you through the topic in an engaging and interactive way.
Free Resources