Indefinite Integrals
The family of all primitives of a given function is denoted as the indefinite integral and is expressed using the following notation:
$$ \int f(x) \, dx $$
The goal of this lesson will be to establish systematic rules for determining a primitive of a given function. Let’s begin with a very simple example:
$$ \int (x^3 + 2x^2 - x) \, dx $$
By remembering the additivity of the integral, we can rewrite it as a sum of three basic integrals:
$$ \int x^3 \, dx + 2 \int x^2 \, dx - \int x \, dx = \frac{x^4}{4} + \frac{2x^3}{3} - \frac{x^2}{2} + C $$
From this example, we can establish the following power rule:
$$ \int x^n \, dx = \frac{x^{n+1}}{n+1} + C, \quad n \neq -1 $$
Integration by Parts
A more sophisticated way of solving an indefinite integral consists in integrating by parts. This technique is based on the product rule for derivatives, which states that:
$$ \frac{d}{dx} [f(x) g(x)] = f'(x) g(x) + f(x) g'(x) $$
If $f$ and $g$ are contiguously differentiable functions on the interval $[a, b]$, then by integrating on $[a,b]$ we obtain:
$$ \left[ f(x) \cdot g(x) \right]_a^b = \int_a^b f'(x) g(x) \, dx + \int_a^b f(x) g'(x) \, dx $$
And by rearranging:
$$ \int_a^b f(x) g'(x) \, dx = \left[ f(x) \cdot g(x) \right]_a^b - \int_a^b f'(x) g(x) \, dx $$
For indefinite integrals, this corresponds to:
$$ \int f(x) g'(x) \, dx = f(x) g(x) - \int f'(x) g(x) \, dx $$
Let’s look at an example:
$$ \int x e^x \, dx $$
By choosing:
$$ \begin{aligned} f(x) &= x \implies f'(x) = 1\\ g'(x) &= e^x \implies g(x) = e^x \end{aligned} $$
We obtain:
$$ \begin{aligned} \int x e^x \, dx &= xe^x - \int 1 \cdot e^x \, dx\\ &= xe^x - e^x + c\\ &= \boxed{e^x (x - 1) + c} \end{aligned} $$
We notice that if we had chosen:
$$ \begin{aligned} g'(x) &= x \implies g(x) = \frac{x^2}{2}\\ f(x) &= e^x \implies f'(x) = e^x \end{aligned} $$
We would have obtained the following integral:
$$ \int xe^x \, dx = \frac{e^x x^2}{2} - \int \frac{e^x x^2}{2} \, dx $$
That is, an integral that turns out to be considerably more difficult than the original. Therefore, we must be careful to select the appropriate function when applying this technique.
In certain circumstances, it is also required to apply integration by parts multiple times. For example:
$$ \int x^2 \sin x \, dx $$
By choosing:
$$ \begin{aligned} f(x) = x^2 &\implies f'(x) = 2x\\ g'(x) = \sin x &\implies g(x) = \cos x \end{aligned} $$
We get:
$$ \begin{aligned} \int x^2 \sin x \, dx &= -x^2 \cos x - \int (2x \cdot (-\cos x)) \, dx\\ &= -x^2 \cos x + 2 \int (x \cos x) \, dx \end{aligned} $$
Let’s apply the procedure again by choosing:
$$ \begin{aligned} f(x) = x &\implies f'(x) = 1\\ g'(x) = \cos x &\implies g(x) = \sin x \end{aligned} $$
We obtain:
$$ \begin{aligned} \int x^2 \sin x \, dx &= -x^2 \cos x + 2\left[ x \sin x - \int (1 \cdot \sin x \, dx) \right]\\ &= -x^2 \cos x + 2x \sin x + 2 \cos x + C\\ &= \boxed{ 2x \sin x - (x^2 + 2) \cos x + C} \end{aligned} $$
Integration by Substitution
Another powerful integration technique is based on the chain rule for derivatives.
Formally, let $$ f(x) : [a, b] \to \mathbb{R} $$
be an Riemann integrable function on $[a, b]$ and let $$ \tau : [\alpha, \beta] \to [a, b] $$
be a continuously differentiable function. Additionally, suppose that $\tau([\alpha, \beta]) = [a,b]$; that is, the function $\tau(t)$ maps onto the entire interval $[a, b]$ as $t$ ranges over $[\alpha, \beta]$.
Now, given any interval $[c, d] \subseteq [a, b]$, there exists $\psi, \omega \in [\alpha, \beta]$ such that: $$ c = \tau(\psi), \quad d = \tau(\omega) $$
Furthermore, let $\Phi$ be a primitive of $f(x)$ on $[a,b]$. Thus, by the 1st fundamental theorem of calculus, we have:
$$ \int_c^d f(x) \, dx = \Phi(d) - \Phi(c) $$
On the other hand, by the chain rule ($\clubsuit$) we have:
$$ (\Phi \circ \tau)'(t) = \Phi'(\tau(t)) \tau'(t) = f(\tau(t)) \cdot \tau'(t) $$
In other words, $(\Phi \circ \tau)$ is a primitive of $f(\tau(t)) \cdot \tau'(t)$ in $[\alpha, \beta]$. Integrating both sides of equation $\clubsuit$ over $[\psi, \omega]$, we obtain:
$$ \Phi(\tau(\omega)) - \Phi(\tau(\psi)) = \int_{\psi}^{\omega} f(\tau(t)) \cdot \tau'(t) \, dt $$
Since $\tau(\omega) = d$ and $\tau(\psi) = c$, it follows that:
$$ \int_c^d f(x) \, dx = \int_{\psi}^{\omega} f(\tau(t)) \cdot \tau'(t) \, dt $$
Finally, if we consider the special case where we integrate over $[c, x]$, with $x \in [a, b]$ and $x= \tau(t)$, we obtain the following indefinite integral:
$$ \int f(x) \, dx = \int f(\tau(t)) \tau'(t) \, dt $$
Let’s look at some practical examples. Consider the following indefinite integral:
$$ \int \cos (\log x) \, dx $$
Let’s substitute $t = \log x$ obtaining:
$$ x = e^t \implies dx = e^t dt $$
Therefore, we get:
$$ I = \int e^t \cos t \, dt $$
Let’s integrate by parts by choosing:
$$ \begin{aligned} f(t) = \cos t &\implies f'(t) = -\sin t\\ g'(t) = e^t &\implies g(t) = e^t \end{aligned} $$
We obtain:
$$ I = e^t \cos t + \underbrace{\int e^t \sin t \, dt}_J $$
Let’s now solve $J$ by integrating it by parts. This time, we can choose:
$$ \begin{aligned} f(t) = \sin t &\implies f'(t) = \cos t\\ g'(t) = e^t &\implies g(t) = e^t \end{aligned} $$
We obtain:
$$ J = e^t \sin t - \underbrace{\int e^t \cos t \, dt}_I = e^t \sin t - I $$
Therefore, if we substitute $J$ back to $I$, we obtain:
$$ \begin{aligned} I &= e^t \cos t + e^t \sin t - I\\ 2I &= e^t (\cos t + \sin t)\\ I &= \frac{1}{2} e^t (\cos t + \sin t) \end{aligned} $$
Finally, by restoring the variables, we obtain:
$$ I = \boxed{\frac{1}{2} x (\cos (\log x) + \sin(\log x)) + C} $$
Another example, this time a definite integral:
$$ \int_0^{\frac{\pi}{2}} \frac{2 \sin x \cos x}{3 + 4 \cos^2 x} \, dx $$
Let’s substitute $u = \cos^2 x$ obtaining:
$$ \begin{aligned} du &= 2\cos x (- \sin x) \, dx\\ \implies du &= -2 \sin x \cos x \, dx\\ \implies -du &= 2 \sin x \cos x \, dx \end{aligned} $$
Now, let’s substitute the two limits of integration:
$$ \begin{aligned} u &= \cos^2(0) = 1^2 = 1\\ u &= \cos^2 \left( \frac{\pi}{2} \right) = 0^2 = 0 \end{aligned} $$
We obtain:
$$ \int_1^0 \frac{-du}{3 + 4u} \iff \int_0^1 \frac{1}{3 + 4u} \, du $$
Let’s substitute again with $v = 3 + 4u$, obtaining:
$$ \frac{dv}{du} = 4 \implies dv = 4 du \implies du = \frac{1}{4} dv $$
Now the limit of integration:
$$ \begin{aligned} v &= 3 + 4(0) = 3\\ v &= 3 + 4(1) = 7 \end{aligned} $$
We obtain the following integral:
$$ \begin{aligned} \int_3^7 \frac{1}{v} \left( \frac{1}{4} \, dv \right) \implies \frac{1}{4} \int_3^7 \frac{1}{v} \, dv &= \left[ \frac{1}{4} \log(v) \right]_3^7\\ &= \frac{1}{4} \left( \log(7) - \log(3) \right)\\ &= \frac{1}{4} \log \left( \frac{7}{3} \right) \approx \boxed{0.21182} \end{aligned} $$
Let’s see another exercise involving a rational function:
$$ \int \frac{3x + 2}{4x + 5} \, dx $$
Let’s substitute $u = 4x + 5$ obtaining:
$$ du = 4 dx \implies dx = \frac{du}{4} $$
Now let’s rewrite $x$ in terms of $u$ to simplify the substitution on the numerator:
$$ u - 5 = 4x \iff x = \frac{u - 5}{4} $$
Therefore, the numerator becomes:
$$ 3x + 2 = 3 \left( \frac{u - 5}{4} \right) + 2 = \frac{3u - 15}{4} + 2 = \frac{3u - 7}{4} $$
Thus, we obtain:
$$ \int \frac{3x + 2}{4x + 5} \, dx = \int \frac{\frac{3u - 7}{4}}{u} \cdot \frac{du}{4} $$
By factoring out the numerators ($\frac{1}{4} \cdot \frac{1}{4} = \frac{1}{16}$):
$$ \begin{aligned} \int \frac{3x + 2}{4x+5} \, dx &= \frac{1}{16} \int \frac{3u - 7}{u} \, du\\ &= \frac{1}{16} \int \left( \frac{3u}{u} - \frac{7}{u} \right) \, du\\ &=\frac{1}{16} \int \left(3 - \frac{7}{u} \right) \, du\\ &= \frac{1}{16} \left(3u - 7 \log|u| \right) + C_1\\ &= \frac{1}{16} \left( 3(4x+5) - 7\log|4x+5| \right) + C_1\\ &= \frac{12x+15}{16} - \frac{7}{16} \log|4x+5| + C_1\\ &= \frac{3}{4}x + \frac{15}{16} - \frac{7}{16} \log|4x+5| + C_1\\ &= \boxed{\frac{3}{4}x - \frac{7}{16} \log|4x+5| + C}\\ \end{aligned} $$
Where the last result is obtained by letting $C = C_1 + \frac{15}{16}$.
Last example:
$$ \int \sqrt{e^x - 1} \, dx $$
In this case we can substitute $t = \sqrt{e^x - 1}$ obtaining:
$$ \begin{aligned} t^2 &= e^x - 1\\ e^x &= t^2 + 1\\ x &= \log(t^2 + 1)\\ dx &= \frac{2t}{t^2 + 1} \, dt \end{aligned} $$
The integral becomes:
$$ \begin{aligned} \int \left(t \cdot \frac{2t}{t^2 + 1} \right) \, dt &= 2 \int \frac{t^2}{t^2 + 1} \, dt\\ &= 2 \int \frac{t^2 + 1 - 1}{t^2 + 1} \, dt\\ &= 2 \int \left( \frac{t^2 +1}{t^2 + 1} - \frac{1}{t^2 + 1} \right) \, dt\\ &= 2 \int \left(1 - \frac{1}{t^2 + 1} \right) \, dt\\ &= 2(t - \arctan(t)) + C\\ &= 2t - 2\arctan(t) + C\\ &= \boxed{2\sqrt{e^x - 1} - 2\arctan \left(\sqrt{e^x - 1} \right) +C} \end{aligned} $$
Integration of Rational Functions
In the previous sections, we have already examined some examples of integrals involving rational functions and solved them using general purpose techniques such as substitution. However, treating these integrals like any other is not always possible. Therefore, in this part of the lesson, we will introduce a specialized theory dedicated entirely to evaluating them.
Let $f(x)$ and $g(x)$ be two real polynomials, with $g(x) \neq 0$. Our goal is to evaluate an integral of the form:
$$ \int \frac{f(x)}{g(x)} \, dx $$
If the degree of the numerator is strictly less than the degree of the denominator, the rational function is called proper. In this case, we can attempt to factor the denominator and express the rational function as a sum of simpler partial fractions.
If, instead, the degree of the numerator is greater than or equal to the degree of the denominator, we first perform a polynomial division, obtaining a quotient polynomial $Q(x)$ and a remainder polynomial $R(x)$. then, we can express the result as:
$$ f(x) = g(x)Q(x) + R(x) \iff \frac{f(x)}{g(x)} = Q(x) + \frac{R(x)}{g(x)} $$
That is:
$$ \int \frac{f(x)}{g(x)} \, dx = \int Q(x) \, dx + \int \frac{R(x)}{g(x)} \, dx $$
In both cases, when the degree of $f(x)$ is less than the degree of $g(x)$, we can distinguish three distinct cases. In this guide, however, we will only cover the first two cases, which involve real roots. Moreover, the two polynomials could have degree greater than two, we won’t cover that particular case as well.
The Denominator has Two Distinct Roots
Given the integral:
$$ \int \frac{a_1 x + a_0}{x^2 + b_1 x + b_0} \, dx $$
If $\Delta > 0$, then $x^2 + b_1 x + b_0 = (x-x_1)(x-x_2)$ and therefore, there exist two constants $A, B \in \mathbb{R}$ such that $\forall x \in \mathbb{R} \setminus \{ x_1, x_2 \}$:
$$ \frac{a_1 x + a_0}{x^2 + b_1 x + b_0} = \frac{a_1 x + a_0}{(x-x_1)(x-x_2)} = \frac{A}{x-x_1} + \frac{B}{x-x_2} $$
To obtain the two constants $A$ and $B$, we can solve the following linear system of equations:
$$ \begin{cases} A + B = a_1\\ -Ax_2 - Bx_1 = a_0 \end{cases} $$
Which corresponds to:
$$ A(x - x_2) + B(x-x_1) = a_1 x + a_0 $$
Once the system has been solved, we can evaluate the following basic integrals:
$$ \begin{aligned} \int \frac{a_1 x + a_0}{x^2 + b_1 x + b_0} \, dx &= \int \frac{A}{x - x_1} \, dx + \int \frac{B}{x-x_2} \, dx\\ &= A \log | x - x_1 | + B \log | x - x_2 | + C \end{aligned} $$
The Denominator has Two Identical Roots
If $\Delta = 0$, then $x^2 + b_1 x + b_0 = (x - x_0)^2$. Then, given $A, B \in \mathbb{R}$, we have:
$$ \frac{a_1 x + a_0}{x^2 + b_1 x + b_0} = \frac{a_1 x + a_0}{(x-x_0)^2} = \frac{A}{x-x_0} + \frac{B}{(x-x_0)^2} $$
In this case, $\forall x \in \mathbb{R} \setminus \{ x_0 \}$. We determine the two constants $A$ and $B$ by solving the following linear system of equations:
$$ \begin{cases} A = a_1\\ -x_0 A + B = a_0 \end{cases} $$
Which corresponds to:
$$ a_1 x + a_0 = A(x - x_0)+B \quad \forall x \in \mathbb{R} $$
Once the system has been solved, we evaluate the following two integrals:
$$ \begin{aligned} \int \frac{a_1 x + a_0}{x^2 + b_1 x + b_0} \, dx &= \int \frac{A}{x- x_0} \, dx + \int \frac{B}{(x-x_0)^2} \, dx\\ &= A \log | x - x_0 | - \frac{B}{x - x_0} + C \end{aligned} $$
Let’s look at some practical examples.
$$ \int_2^3 \frac{x^3}{x^2 + x - 2} \, dx $$
In this case, the degree of the numerator is greater than the degree of the denominator, which means that we first need to divide the numerator by the denominator, obtaining:
$$ Q(x) = x - 1, \ \ R(x) = 3x - 2 $$
Therefore, the original integral becomes:
$$ \int \frac{x^3}{x^2 + x - 2} \, dx = \int (x - 1) \, dx + \int \frac{3x - 2}{x^2 + x - 2} \, dx $$
Let’s focus on the second integral since the first one is easy. We can start by factoring the denominator:
$$ x_{1,2} = \frac{-1 \pm \sqrt{1 + 8}}{2} \implies x_1 = 1, \ \ x_2 = -2 $$
Therefore, the denominator has two distinct roots:
$$ x^2 + x - 2 = (x - 1)(x+2) $$
And thus, we can write:
$$ \int \frac{3x - 2}{x^2 + x - 2} \, dx = \int \frac{A}{x-1} \, dx + \int \frac{B}{x+2} \, dx $$
Let’s work out the two partial fractions:
$$ \begin{aligned} \frac{A}{x-1} + \frac{B}{x+2} &= \frac{A(x+2) + B(x - 1)}{(x-1)(x+2)}\\ &= \frac{Ax + 2A + Bx - B}{(x-1)(x+2)}\\ &= \frac{x(A+B) + 2A - B}{(x-1)(x+2)} \end{aligned} $$
Now let’s determine the two constants $A$ and $B$:
$$ \begin{cases} A + B = 3\\ 2A - B = -2 \end{cases} \iff \begin{cases} A = \frac{1}{3}\\ B = \frac{8}{3} \end{cases} $$
Therefore, we have:
$$ \int \frac{3x-2}{x^2+x-2} \, dx = \frac{1}{3} \int \frac{1}{x-1} \, dx + \frac{8}{3} \int \frac{1}{x+2} \, dx $$
Now let’s solve the definite integral:
$$ \begin{aligned} \int_2^3 \frac{x^3}{x^2 + x - 2} \, dx &= \int_2^3 (x - 1) \, dx + \frac{1}{3} \int_2^3 \frac{1}{x-1} \, dx + \frac{8}{3} \int_2^3 \frac{1}{x+2} \, dx\\ &= \left[ \frac{x^2}{2} - x + \frac{1}{3} \log | x - 1 | + \frac{8}{3} \log | x + 2| \right]_2^3\\ &= \left( \frac{9}{2} - 3 + \frac{1}{3} \log(2) + \frac{8}{3} \log(5) \right) - \left( \frac{8}{3} \log(4) \right)\\ &= \frac{3}{2} + \frac{1}{3} \log(2) + \frac{8}{3} \log(5) - \frac{8}{3} \log(4)\\ &\approx \boxed{2.32609} \end{aligned} $$
Let’s see another example:
$$ \int_0^1 \frac{1}{x^2 - x - 2} \, dx $$
In this case we don’t need to divide the numerator by the denominator since the degree of the former is strictly less than the degree of the latter. Let’s start by factoring the denominator:
$$ x_{1,2} = \frac{1 \pm \sqrt{1 + 8}}{2} \implies x_1 = 2, \ \ x_2 = -1 $$
Therefore, we have two distinct roots:
$$ x^2 - x - 2 = (x-2)(x+1) $$
And thus, we can write:
$$ \int \frac{1}{x^2 - x - 2} \, dx = \int \frac{A}{x-2} \, dx + \int \frac{B}{x+1} \, dx $$
Let’s work out the two partial fractions:
$$ \begin{aligned} \frac{A}{x-2} + \frac{B}{x+1} &= \frac{A(x +1) + B(x-2)}{(x-2)(x+1)}\\ &= \frac{Ax + A + Bx - 2B}{(x-2)(x+1)}\\ &= \frac{x(A+B) + A - 2B}{(x-2)(x+1)} \end{aligned} $$
Now let’s determine the two constants $A$ and $B$:
$$ \begin{cases} A + B = 0\\ A - 2B = 1 \end{cases} \iff \begin{cases} A = \frac{1}{3}\\ B = -\frac{1}{3} \end{cases} $$
We can now solve the definite integral:
$$ \begin{aligned} \int_0^1 \frac{1}{x^2 - x - 2} \, dx &= \frac{1}{3} \int_0^1 \frac{1}{x-2} \, dx - \frac{1}{3} \int_0^1 \frac{1}{x+1} \, dx\\ &= \left[ \frac{1}{3} \log | x - 2| - \frac{1}{3} \log | x + 1 | \right]_0^1\\ &= \left( \frac{1}{3} \log(1) - \frac{1}{3} \log(2) \right) - \left( \frac{1}{3} \log(2) - \frac{1}{3} \log(1) \right)\\ &= -\frac{1}{3} \log(2) - \frac{1}{3} \log(2)\\ &= -\frac{2}{3} \log(2)\\ &\approx \boxed{-0.46209} \end{aligned} $$
Last example:
$$ \int \frac{4x - 5}{x^2 - 2x + 1} \, dx $$
The degree of the numerator is strictly less than the degree of the denominator, therefore we don’t need to perform any polynomial division. We observe that $\Delta = 4 - 4 = 0$ and therefore:
$$ x^2 - 2x + 1 = (x-1)^2 $$
Which implies that:
$$ \int \frac{4x - 5}{x^2 - 2x + 1} \, dx = \int \frac{A}{x-1} \, dx + \int \frac{B}{(x-1)^2} \, dx $$
Let’s start by working out the two partial fractions:
$$ \frac{A}{x-1}+ \frac{B}{(x-1)^2} = \frac{A(x-1) + B}{(x-1)^2} $$
Then, let’s determine the two constants $A$ and $B$ by solving the following linear system of equations:
$$ \begin{cases} A = 4\\ -A + B = -5 \end{cases} \iff \begin{cases} A = 4\\ B = -1 \end{cases} $$
Therefore, we conclude that:
$$ \begin{aligned} \int \frac{4x - 5}{x^2 - 2x + 1} \, dx &= 4\int \frac{1}{x-1} \, dx - \int \frac{1}{(x-1)^2} \, dx\\ &= \boxed{4 \log | x - 1 | + \frac{1}{x-1} + C} \end{aligned} $$