In the differential calculus course, we learned about derivatives and how they can be interpreted as the rate of change in the value of a function around a particular point. We also saw how derivatives can be approximated by the method of finite differences, where we calculate an approximation of the derivative by subtracting the value of a particular function at two different but very close points, and divide it by the distance between those points:
where is a very small number.
To make this more concrete, let's look at an example with . We will start by approximating the derivative of , , via the method of finite differences with .
As expected, our approximation of looks pretty much like a straight line with a slope of 2, since .
Now here is something to think about: what is the inverse operation of differentation? That is, what is the operation that, once applied to returns the original function ?
Before formally defining this operation, let's try to think about it intuitively. As we have seen above, the approximation of the derivative tells us the rate at which the function is changing. For instance, if we know the value of , then we know that the value of will be the value of plus how much the function has changed between and , which we can approximate as . Thus, we can write
Likewise, the value of the function at the point could be retrieved by considering how much the function has changed between and :
Thus, is given by
If we look at the last term in the previous equation, we see that it represents the cumulative sum of . Thus, all we need to do to reconstruct is to accumulate our approximation of the derivative, scale it by and offset it by .
Let's see this in practice by recovering the starting with and thus :
Our approximation looks pretty much the same as , which is great! But we sort of cheated a bit, because our approximation of relies on knowing the value of . Without knowing , the best we can do is to approximate up to a constant offset.
This is an inevitable consequence of differentiation, since differentiation looks at differences between subsequent values and does not consider all the values of the function. It turns out that recovering the original function up to an offset is the best we can do. For instance, the functions and have exactly the same derivative, so all we can say is that the function whose derivative is is of the form , where is a constant.
The process we have been looking at is called integration. Integrating a given function provides us with a primitive (also known as the antiderivative or indefinite integral) of that function, which can be differentiated to obtain the original function . Thereby, integration is the inverse operation of differentiation.
Formally, we can write that is a primitive of if
where represents integration, represents a constant, and denotes the variable with respect to which integration applies (similar to the logic of the notation used in differentiation).
The type of integration above is called indefinite because it applies to the function as a whole, i.e. across its entire domain. However, it is possible to integrate a function over a particular interval of interest—this is known as definite integration. Formally, the definite integral of a function in the interval is defined as:
where is the indefinite integral of the function .
But what does this represent? As we have seen before, and for a very small epsilon, the value of can be thought of as the cumulative sum of the values of in increments of epsilon up to the value . Thus, can be thought of as the sum of the values of the function up to the value and can be thought of as the sum of the values of up to the value . Assuming , when we subtract from the cumulative sum of all the values up to cancels out and we are left with the cumulative sum of the values of in the interval .
To make things a bit more concrete, let's take a look at the function in the interval .
The plot above depicts the values of that are accumulated to compute and , in orange and green respectively. As you can see, all the values up to are used to calculate . Conversely, all the values up to are used to compute the value of . If we look closely, we can thus say that approximates the area under the curve of in the interval .
This approximation is known as the Riemann sum, which can be formally written as
where is the coordinate of the -th point and is the increment size of the -th point. If we keep the increment size constant for all , then the Riemann sum becomes:
In this section, we have introduced integration as the inverse of differentiation. We have also seen how definite integration can be understood as the area under the curve over a particular interval . But note that we have been working exclusively with approximations of differentiation and integration! In the next sections, we will look at how to integrate functions analytically whenever possible and we will cover the most important rules of integration.