Sums & Products
Alright, let's start with arithmetic sums:
The sum of the first integers () is:
Why?
Say that we are looking for the sum of numbers from 1 to 5. What we are looking for is the answer to .
There is a constant amount of difference between each term, which is . The difference between and is , between and is , and so on.
That means, we can write it as
Let's use to stand for our first term , and to stand for our last term . We can also use for the difference between terms, which is .
is for the arithmetic sum, of course.
Then, we can write it as
Addition is commutative, we can reverse the order of the terms:
Let's add those two together, and see what we have, because why not:
If you didn't catch it, 's are canceling out. And, what we have is
Dividing by to find , we get what we have started with:
Substituting our first and last terms, clearly we have . We can also write it as
With geometric sums, each sum is a multiple of the previous sum.
So, .
The formula we have to find that is this:
Again, why?
Let's use another trick, different from the one we used for arithmetic sums.
This time let's multiply by . This will increase the power of in each term:
Let's subtract it from the original , because again, why not:
What we end up having is
We can factor out to have:
That means, is
We had simple formulas for arithmetic and geometric sums, but this time, we'll look at a formula that can give an estimation.
Let be a weakly increasing function.
The sum is:
Think of each term as a unit-width () rectangle, with a height of .
Then, the number for the sum we are looking for has to be the total area under the curve of .
The area under the curve from to is:
Then:
Perhaps it would make more sense visually:
And, shift it left by :
Figures 13.2 and 13.3 from the course notes Mathematics for Computer Science.
Any product can be converted into a sum by taking its logarithm.
Let's look at a factorial, for example, is .
We can also denote it as:
It can be turned into a sum by taking the logarithm:
It is because of the product rule:
We have to estimate this sum to get a closed-form bound.
In order to do that, we are going to use the formula we defined above: .
So, plugging them in:
Looks beautiful.
is . So, it is just
After taking the integral, and exponentiating the whole thing (it was the product, remember, we are undoing it), the eventual result will be, according to the book:
One example of asymptotic equivalence is .
In order for two functions to be asymptotically equal, the limit of their quotient has to go to as approaches infinity. Let's see.
So, simplifying we have . As goes to , goes to , so we're left with . And, that proves that and are asymptotically equal.