### Differential and integral calculus – differentiate with regard to anything

Integral calculus was one of the major discoveries of Liebniz and Newton. Their research independently paved the way to proof, and identification of the criticality of the fundamental theorem of calculus, which connected integral to derivatives. With the finding of integrals, areas and volumes could thus be researched.

Integral calculus is the next half of the calculus journey that we will be looking into.

In this guide, you will find out about the relationship between differential and integral calculus.

After going through this guide, you will be aware of:

- The theories of differential and integral calculus are connected together by the basic theorem of calculus.
- Through application of the fundamental theorem of calculus, we can go about computing the integral to discover the area under a curve.
- In machine learning, the application of integral calculus can furnish us with a metric to evaluate the performance of a classifier.

__Tutorial Summarization__

This guide is subdivided into three parts, they are:

- Differential and integral calculus – what is the connection?
- The Fundamental Theorem of Calculus
- The Sweeping Area Analogy
- The Fundamental Theorem of Calculus – Part 1
- The Fundamental Theorem of Calculus – Part 2

- Integration instance
- Application of integration within machine learning

__Differential and integral calculus – what is the connection?__

In the journey through calculus thus far, we have come to know that differential calculus is concerned with the measurement of the rate of change. We have also learned about differentiation, and applied it to differing functions from first principles. We have even comprehended how to apply rules to arrive to the derivative quicker.

However, we are only partially through the journey.

From a 21^{st} century perspective, calculus is typically perceived as the mathematics of change. It quantifies change leveraging two big concepts: derivatives and integrals. Derivatives model rates of change … integrals model the accumulation of change.

Calculus consists of two phases – cutting and rebuilding

The cutting stage breaks down a curved shape into infinitesimally small and straight pieces that can be researched independently, like through application of derivatives to model their rate of change or slope.

This part of the calculus journey is referred to as differential calculus, and we have already investigated it in some detail.

The rebuilding stage gathers the infinitesimally small and straight pieces, and sums them back together in an effort to research the original whole. In this fashion, we can determine the area or volume of regular and irregular shapes upon having cut them into infinitely thin slices. This second part of the calculus journey is what we will be looking into next. It is referred to as integral calculus.

This critical theorem that connects the two ideas together is referred to as the fundamental theorem of calculus.

__The Fundamental Theorem of Calculus__

To work our way towards comprehending the fundamental theorem of calculus, let’s revisit the car’s position and velocity instance.

Through computation of the derivative we possessed solved the forward problem, where we discovered the velocity from the slope of the position graph at any time, t. But what if would wish to solve the backward problem, where we are provided the velocity graph, v(f), and desire to identify the distance travelled? The answer to this issue is to calculate the area under the curve (the shaded region) up to time, t:

We do not possess a particular formula to define the area of the shaded region directly. However we can apply the mathematics of calculus to cut the shaded area under the curve into several infinitely thin rectangles, for which we possess a formula:

If we take up the ith rectangle, selected arbitrarily to span the time interval Δ*t*, we can define its area as its length times its width:

area_of_rectangle = *v*(*t _{i}*) Δ

*t*

_{i}We can have as many rectangles as required to span the interval of interest, which in this scenario is the shaded area underneath the curve. For simplicity’s sake, let’s indicate this closed interval by [a,b]. Identifying the area of this shaded region (and, therefore, the distanf evce travelled), then minimizes to identifying the sum of the n number of rectangles.

total_area = *v*(*t*_{0}) Δ*t*_{0}* + v*(*t*_{1}) Δ*t*_{1}* + … + v*(*t*_{n}) Δ*t*_{n }

We can express this sum even more concisely through application of the Riemann sum with sigma notation:

If we cut (or divide) the area underneath the curve by a finite number of rectangles, then we discover that the Riemann sum provides us an approximation of the area, as the rectangles so that their upper left or upper right corners touch the curve, the Riemann sum provides us either an underestimate or an overestimate of the true area, respectively. If the midpoint of every rectangle had to touch the curve, then the portion of the rectangle protruding above the curve roughly compensates for the gap between the curve and neighbouring rectangles.

The solution to identifying the correct region under the curve, is to minimize the rectangles width so much that they turn infinitely thin (remember the infinity principle in calculus). In this fashion, the rectangles would be covering the total region, and in summation of their areas we would be identifying the definite integral.

The definite integral (“simple” definition): The precise area under a curve between t=a and t=b is provided by the definite integral, which is defined as the limit of a Reimann sum…

The definite integral can, then be defined by the Riemann sum as the number of rectangles, n, approaches infinity. Let’s also signify the area under the curve by A(f). Then:

Observe that the notation now alters into the integral symbol, ∫, substituting sigma. The purpose behind this change is, simply, to signify that we are summing over a massive number of thinly sliced rectangles. The expression on the left hand side reads as, the integral of v(f) from a to b, and the procedure of identifying the integral is referred to as integration.

__The Sweeping Area Analogy__

Probably a simpler analogy to assist us relate integration to differentiation, is to visualize holding one of the thinly cut slices and dragging it rightwards under the curve in infinitesimally small steps. As it shifts rightwards, the thinly cut slice will sweep a bigger area under the curve, while its height will alter going by the shape of the curve. The question that we would like to provide a solution to is, at which rate does the region accumulate as the thin slices sweeps rightwards?

Let dt signify every infinitesimal step traversed by the sweeping slice, and v(t) its height at any time, t. Then the infinitesimal region, dA(t), of this thin slice can be discovered through multiplication of its height, v(t), to its infinitesimal width, dt:

*dA*(*t*) = *v*(*t*) *dt*

Dividing the equation by dt provides us the derivative of A(t), and informs us that the rate at which the region accumulates is equivalent to the height of the curve v(t), at time, t:

dA(t) l dt = v(t)

We can lastly define the fundamental theorem of calculus.

__The Fundamental Theorem of Calculus – Part 1__

We discovered that a region, A(t) swept underneath a function, v(t) can be defined by:

We have also discovered that the rate at which the region is being swept is equivalent to the original function, v(t):

dA(t) l dt = v(t)

This takes us to the first portion of the fundamental theorem of calculus, which informs us that if v(t) is continuous on an interval, [a,b], and if it is additionally the derivative of A(t), then A(t) is the antiderivative of v(t):

A’(t) = v(t)

Or in layman’s terms, integration is the reverse operation of differentiation. Therefore, if we initially had to integrate v(t) and then differentiate the outcome, we would get back the original function, v(t):

**The Fundamental Theorem of Calculus – Part 2**

The second portion of the theorem provides us a shortcut for computation of the integral, without having to take the longer path of computation of the limit of a Riemann sum.

It specifies that if the function, v(t), is continuous on an interval, [a,b], then:

Here, F(t) is any antiderivative of v(t), and the integral receives definition as the subtraction of the antiderivative assessed at a and b.

Therefore, the second portion of the theorem computes the integral through subtraction of the region underneath the curve between some beginning point, C, and the lower limit, a, from the region between the identical beginning point, C, and the upper limit, b. This, basically, calculates the region of interest between a and b.

As the constant, C, defines the point on the x-axis at which the sweep begins, the simplest antiderivative to take up is the one with C=0. Nevertheless, any derivative with any value of C can be leveraged, which easily sets the beginning point to a different position on the x-axis.

__Integration instance__

Take up the function v(t) = x cubed. Through application of the power rule, it is easy to identify its derivative, v(t) = 3x squared. The antiderivative of 3x squared is again x cubed – we execute the reverse operation to get the original function.

Now let’s assume that we possess a different function, g(t) = x cubed + 2. Its derivative is also 3x squared, and so is the derivative of another function, h(t) = x cubed minus 5. Both of these functions (and other ones that resemble it) possess x cubed as their antiderivative. Therefore, we specify the family of all antiderivatives of 3x squared through the indefinite integral.

The indefinite integral does not go about defining the limits between which the region underneath the curve is being quantified. The constant, C, has been included to make up for the lack of data with regards to the limits, or the beginning point of the sweep.

If we do possess know-how of the limits, then we can merely apply the second fundamental theorem of calculus to go about computing the definite integral:

We can merely set C to zero, as it will not alter the outcome in this scenario.

__Leveraging of integration within machine learning:__

We have taken up the car’s velocity curve, v(t), as a familiar instance to comprehend the relationship between integration and differentiation.

However, you can leverage this adding-up-areas-of-rectangles scheme to add up small bits of anything – distance, volume, or energy, for instance. To put it in different words, the region underneath the curve doesn’t have to signify an actual region.

One of the critical steps of successful application of machine learning strategies which includes the choice of relevant performance metrics. Within deep learning, for example, it is usual practice to quantify precision and recall.

Precision is the fraction of detections reported by the model that were right, while recall is the fraction of true events that were identified.

It is also usual practice to, then, plot the accuracy and recall on a Precision-Recall (PR) curve, situating the recall on the x-axis and the accuracy on the y-axis. It would be desired that a classifier is personified by both high recall and high accuracy, implying that the classifier can identify several of the true events correctly. Such a good classification performance would be personified by a higher region under the PR curve.

You can likely already guess where this is heading.

The region underneath the PR curve, can, indeed be quantified through application of integral calculus, enabling us to characterize the performance of the classifier.

__Further reading__

This section furnishes more resources on the subject if you are seeking to go in-depth:

- Single and multivariate calculus, 2020
- Calculus for Dummies, 2016
- Infinite Powers, 2020
- The Hitchhiker’s Guide to Calculus, 2019
- Deep Learning, 2017

__Summarization__

In this guide, you found out about the relationship between differential and integral calculus.

Particularly, you learned:

- The concepts of differential and integral calculus are connected together by the fundamental theorem of calculus
- Through application of the fundamental theorem of calculus, we can go about computing the integral to discover the region under a curve
- Within machine learning, the application of integral calculus can furnish us with a metric to evaluate the performance of a classifer.