Friday, November 30, 2018

Integral by substitution

I believe sometimes intuitive understanding or visualization helps us recognize what we're doing. In this article, I will share the intuitive understanding for "Integral by substitution". I hope you will find this article informative :)

0. Fundamental understanding

Indefinite integral

First of all, we confirm the understanding of fundamentals for Integral substitution.

Let $f(t)$ satisfy $\frac{dF(t)}{dt} = f(t)$, Then, $$F(t) = \int f(t) dx \tag{1}$$

Let $ \varphi(x)$ be function with respect to $x$,
$$\begin{eqnarray}\frac{dF(\varphi(x))}{dx} = \frac{dF(\varphi)}{d\varphi}\frac{d\varphi(x)}{dx} = f(\varphi)\frac{d\varphi(x)}{dx} \end{eqnarray}\ \ \because\ (1)$$

Therefore, $$F(\varphi(x)) = \int f(\varphi)\frac{d\varphi(x)}{dx}dx = \int f(\varphi) d\varphi \tag{2}$$

Definite Integral

From (2), $$\begin{eqnarray}\int^{b}_{a} f(\varphi)\frac{d\varphi(x)}{dx}dx &=& [F(\varphi(x))]^{b}_{a} \\ &=&F(\varphi(b)) - F(\varphi(a)) \end{eqnarray}$$

On the other hand, Let $\varphi(a), \varphi(b)$ be $\varphi(a) = \alpha$, $\varphi(b) = \beta$,
$$\int^{\beta}_{\alpha}f(t) dt = [F(t)]^{\beta}_{\alpha} = F(\beta) - F(\alpha)$$ Consequently, $$\int^b_a f(\varphi(x))\frac{d\varphi(x)}{dx}dx = \int^\beta_\alpha f(t)dt$$

1. Apply "Integral by substitution"

In this section, let us think about following integral. Obviously, you don't have to apply Integral by substitution. Nonetheless, for the sake of intuitive, we're gonna apply "Integral by substitution":) $$\int^1_0 8x^2 dx $$
Let $\varphi(x) = x^2$, $\frac{d\varphi}{dx} =2$, $$\int^2_0 2\varphi^2 \frac{1}{2}d\varphi = \int^2_0 \varphi^2 d \varphi = \frac{8}{3}$$
This example can be visualized as below,

In [16]:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
In [27]:
x = np.linspace(0,3, 101)
y1 = 8 *(x ** 2)
y2 = x **2 

plt.figure(figsize=(14,6))
plt.plot(x,y1,label='before substitution')
plt.plot(x,y2,label='after substitution')

x1_area = np.where(x <=1)[0]
x2_area = np.where(x <=2)[0]

plt.fill_between(x[x1_area],y1[x1_area],np.zeros(x1_area.shape))
plt.fill_between(x[x2_area],y2[x2_area],np.zeros(x2_area.shape))

plt.legend(fontsize=14)
plt.title('Integral by substitution',fontsize=16)
plt.show()

What we did was Instead of calculating blue colored area, calculated green area. And we somehow extend $\Delta x$ to 2 times ($\varphi = 2dx$) :)

No comments:

Post a Comment