Original article was published by Adrià Serra on Deep Learning on Medium

## CALCULUS FOR DATA SCIENCE AND MACHINE LEARNING

# The Fundamental theorem of calculus

## The relation between derivatives and integrals

The first theorem relates derivation with the integration of functions, it is divided between two theorems, let’s explain them.

**The first fundamental theorem of calculus**

Let

fbe integrable on[a,b], and defineFon[a,b]by

If

fis continuous atcin[a,b], thenFis differentiable atc, andF’(c) = f(c).

By this theorem, we ensured that if **c** is continuous at** f**, then **F **is differentiable at **c**. When **f** is continuous in **[a,b]**, **F** is differentiable at **[a,b]** and **F’=f.**

The first theorem has a corollary that frequently reduces computational costs of integrals.

If

fis continuous on[a,b]andf = g’for some functiong, then:

This corollary can induce to the fallacy that all in integrals have a function g whose derivate is f. It’s wrong, a function f may be integrable without being the derivate of any other function.

# The second fundamental theorem of calculus

If

fis integrable on[a,b]andf=g’for some functiong, then

# The area between two functions

We defined integrals as areas between the x-axis and the function, positive or negative. But there’s a world above it, we can use them to calculate the area between two functions.

To do it we just have to subtract the integral of one function to the other one.

There are some considerations to apply this calculation:

- If
**g(x) ≤ f(x)**for all**x**in**[a,b]**, then this integral always gives the area bounded by**f**and**g**, even if**f**and**g**are sometimes negative. - If
**g(x)≤ f(x)**is not true for all**x**in**[a,b]**, we need to search for the values where both functions intersect to determine the region more precisely. To do that we solve**f(x)=g(x)**and check what function is bigger than the other in the intervals generated between the solutions. The area should be calculated separately for each interval subtracting the function wich image is bigger to the other one in each section and adding the results.

# The third fundamental theorem of calculus

If

fis continous on[a,b],thenfis integrable on[a,b].

# Conclusion

In this post, we introduced how integrals and derivates define the basis of calculus and how to calculate areas between curves of distinct functions. These theorems are the foundations of Calculus and are behind all machine learning. Even if you don’t see them, all frameworks use them to create and optimize the algorithms of deep learning, probability functions, etc…