# Calculate integrals of functions

 

Calculate integrals using different techniques with examples and detailed solutions and explanations. Also more exercises with solutions are presented at the bottom of the page.
In all examples and exercises, $c$ represent the constant of integration.

## Examples and Their Solutions

Example 1
Evaluate the integral $\displaystyle\int 6 \; \cos x \; \sin x \; dx$

Solution to Example 1
We first use the trigonometric identity   $2 \sin x \cos x = \sin (2 x)$   to rewrite the integral as follows
$\displaystyle\int 6 \; \cos x \; \sin x \; dx = 3\displaystyle\int \sin (2x) \; dx$

Use Integration by Substitution: Let $u = 2 x$ which leads to $\dfrac{du}{dx}= 2$ or $du = 2 dx$ or $dx = du / 2$, and substitute in the above integral to obtain
$= 3 \displaystyle \int (1/2) \sin u \; du$

We now use integral formulas for sine function to obtain
$\displaystyle = -(3/2) \cos u + c$
Substitute back $u$ by $2 x$ into the above result to obtain the final result
$\displaystyle\int 6 \cos x\; \sin x dx= -(3/2) \cos (2 x) + c$
As an exercise, differentiate $\; - (3/2) \cos 2 x + c$ to obtain $6 \sin x \; \cos x$ which is the integrand in the given integral. This is a way to check the answer to integrals calculations.

Example 2
Calculate the integral $\displaystyle\int x \; \sqrt{x+1} dx$

Solution to Example 2:

Use Integration by Substitution: Let $u = x + 1$ which gives $x = u - 1$.
$\displaystyle\int x \sqrt{x+1} \; dx = \int (u-1) \cdot u^{1/2} \; dx$

The above leads to $\dfrac{du}{dx}=1$ and $du = dx$ and the given integral is equal to
$= \displaystyle\int (u^{3/2}-u^{1/2}) \; du$

We now use property for integral of sum of functions and the formula for integration of power function: $\displaystyle \int x^n dx = \left(\dfrac{1}{n+1}\right) \; x^{n+1} + c$ to obtain
$\displaystyle = (2 / 5) u^{5/2} - (2 / 3) u^{3/2} + c$

We now substitute $u$ by $x + 1$ into the above result to obtain the final result as follows
$\displaystyle\int x \sqrt{x+1} dx = (2 / 5) (x + 1)^{5/2} - (2 / 3) (x + 1)^{3/2} + c$
To check the final answer, differentiate the indefinite integral obtained to obtain the integrand $x \sqrt{x + 1}$ in the given integral.

Example 3
Evaluate the integral $\displaystyle \int \cos^2 x \; dx$

Solution to Example 3
Use the trigonometric identity $\cos^2 x = \dfrac{1+\cos(2x)}{2}$ to rewrite the given integral as

$\displaystyle\int \cos^2 x \; dx = \int \dfrac{1+cos(2x)}{2} \; dx$

Use Integration by Substitution: $u = 2x$ so that $du = 2 dx$ and $dx = du / 2$, and the given integral can be written as
$= \displaystyle \int (1/4)(1+\cos u) \; du$

Integrate to obtain
$= (1 / 4) u + (1 / 4) \sin (u) + c$

Substitute back $u$ by $2 x$ and simplify
$\displaystyle \int \cos^2 x \; dx = x / 2 + (1 / 4) \sin (2 x) + c$
Check the final answer by differentiation.

Example 4
Evaluate the integral $\displaystyle\int x^3 e^{x^4} \; dx$

Solution to Example 4
Use Integration by Substitution: Let $u = x^4$ so that $du / dx = 4 x^3$ which leads to $(1 / 4) du = x^3 dx$, so that the given integral can be written as
$\displaystyle\int x^3 e^{x^4} dx = \int (1 / 4) e^u \; du$

We now use formula for integral of exponential function to write
$\displaystyle\int (1 / 4) e^u \; du = (1 / 4) e^u + c$

Substitute back $u$ by $x^4$ to obtain the final answer
$\displaystyle\int x^3 e^{x^4} dx = (1 / 4) e^{x^4}+ c$

Example 5
Calculate the integral $\displaystyle \int \dfrac{\sin (2x)}{1-\cos^2(x)} \; dx$

Solution to Example 5
Use the trigonometric identities: $\sin (2x) = 2 \sin x \; \cos x$ and $1-\cos^2(x) = \sin^2(x)$ to rewrite the given integral as
$\displaystyle \int \dfrac{\sin (2x)}{1-\cos^2(x)}dx = \displaystyle \int \dfrac{2 \sin x \cos x}{\sin^2(x)}dx$

Simplify and rewrite as
$= \displaystyle \int 2 \dfrac{\cos x}{\sin x} \; dx$

Use the formula of integration $\displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c$ to obtain
$= 2 \ln |\sin \; x|$

Use the log property $\; a \ln x = \ln x^a$ to rewrite the final result as
$\displaystyle \int \dfrac{\sin (2x)}{1-\cos^2(x)}dx = \ln \sin^2 \; x$

Example 6
Calculate the integral $\displaystyle \int (x+\sin x)^2 \; dx$

Solution to Example 6
Expand $\displaystyle (x+\sin x)^2 = x^2 + \sin^2 x + 2 x \sin x$ and apply the sum rule of integrals$\displaystyle \int (f(x) + g(x) + h(x) ) dx = \int f(x) dx + \int g(x) dx + \int h(x) dx$ to rewrite the given integral as
$\displaystyle \int (x+\sin x)^2 \; dx = \int x^2 \; dx + \int \sin^2 x \; dx + \int 2 x \; \sin x \; dx$

Calculate each integral in the sum above
$\displaystyle \int x^2 \; dx = (1/3) x^3 + c$

Use the trigonometric identity $\; \sin^2 x = (1 – \cos (2x)) / 2$ to reduce the power and rewrite the second integral in the sum as
$\displaystyle \int \sin^2 x \; dx = \int \dfrac{1 – \cos (2x)}{2} \; dx = (1/2) x - (1/4) \sin (2x) + c$

The third integral is calculated using the integration by parts: $\int u' v \; dx = u v - \int u v' \; dx$.
Let $v = x$ and $u' = \sin x$ so that $v' = 1$ simplifies calculations and $u = - \cos x$.

$\displaystyle \int 2 x \; \sin x \; dx = 2 (- x \cos x - \int (- cos x) dx ) = - 2 x \cos x + 2 \sin x + c$

The final answer to the given integral is given by the sum of all three integrals calculated above
$\displaystyle \int (x+\sin x)^2 \; dx = (1/3) x^3 + (1/2) x - (1/4) \sin (2x) - 2 x \cos x + 2 \sin x + c$

Example 7
Calculate the integral $\displaystyle \int \dfrac{\sin x}{\sin^2 x - 2 cos x + 2} \; dx$

Solution to Example 7
Use the trigonometric identity $\sin^2 x = 1 - \cos^2 x$ to rewrite the given integral as
$\displaystyle \int \dfrac{\sin x}{\sin^2 x - 2 \cos x + 2} \; dx = \int \dfrac{\sin x}{1 - \cos^2 x - 2 \cos x + 2} \; dx$

Use Integration by Substitution: Let $u = \cos x$ which gives $\dfrac{du}{dx} = - \sin x$ and $du = - \sin x \; dx$ and substitute in the integral
$\displaystyle \int \dfrac{\sin x}{1 - \cos^2 x - 2 \cos x + 2} \; dx = \int \dfrac{1}{u^2 + 2 u - 3} du$

Factor the denominator $u^2 + 2 u - 3 = (u+3)(u-1)$ and use partial fractions decomposition to rewrite $\dfrac{1}{u^2 + 2 u - 3}$ as
$\dfrac{1}{u^2 + 2 u - 3} = \dfrac{A}{u+3} + \dfrac{B}{u+3} \\\\ = \dfrac{1}{4(u-1)}-\dfrac{1}{4(u+3)}$

Substitute in the integral in $u$ and use the sum rule of integrals to write
$\displaystyle \int \dfrac{1}{u^2 + 2 u - 3} du = \int \dfrac{1}{4(u-1)} du - \int \dfrac{1}{4(u+3)} du$

Use formula of integration $\displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c$ to each integral
$= (1/4) (\ln |u-1| - \ln|u+3| + c$

Substitute $u = \cos x$ to obtain the final resul as
$\displaystyle \int \dfrac{\sin x}{\sin^2 x - 2 cos x + 2} \; dx = (1/4) (\ln | \cos x -1| - \ln| \cos x +3| ) + c$

Usin the log properties $\ln \dfrac {X}{Y} = \ln X - \ln Y$ to rewrite the final answer as
$\displaystyle \int \dfrac{\sin x}{\sin^2 x - 2 cos x + 2} \; dx = (1/4) (\ln |\dfrac{ \cos x -1}{\cos x +3} | + c$

Example 8
Calculate the integral $\displaystyle \int \dfrac{1}{x+\sqrt{x+2}} \; dx$

Solution to Example 8
Use Integration by Substitution: Let $u = \sqrt {x + 2}$; square both sides and solve for $x$ to obtain $x = u^2 - 2$.
We also have $\dfrac{du}{dx} = \dfrac{1}{2} (x+2)^{-1/2}$ which gives $dx = 2 (x+2)^{1/2} = 2 u$ . The integral becomes

$\displaystyle \int \dfrac{1}{x+\sqrt{x+2}} \; dx = 2 \int \dfrac {u}{u^2 -2 + u} \; du$

Factor the denominator $u^2 -2 + u = (u+2)(u-1)$ and write the partial fraction of $\dfrac {u}{u^2 -2 + u}$ as
$\dfrac {u}{u^2 -2 + u} = \dfrac{A}{u-1} + \dfrac{B}{u+2}$

Solve for $A$ and $B$ to obtain
$\dfrac {u}{u^2 -2 + u} = \dfrac{1}{3(u-1)} + \dfrac{2}{3(u+2)}$

Substitute in the integral in $u$ and use the sum rule of integrals to write
$\displaystyle 2 \int \dfrac {u}{u^2 -2 + u} \; du = 2 \int \dfrac{1}{3(u-1)} du + 2 \int \dfrac{2}{3(u+2)} du$

Use formula of integration $\displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c$ to each integral
$= (2/3) \ln |u-1| + (4/3) \ln|u+2| + c$

Substitute $u = \sqrt {x + 2}$ to obtain the final resul as
$\displaystyle \int \dfrac{\sin x}{\sin^2 x - 2 cos x + 2} \; dx = (2/3) \ln |\sqrt {x + 2}-1| + (4/3) \ln|\sqrt {x + 2}+2| + c$

Example 9
Evaluate the integral $\displaystyle \int \dfrac{1}{\tan x} \; dx$

Solution to Example 9
Use the trigonometric identity $\; \tan(x) = \dfrac{\sin(x)}{\cos(x)}$ to rewrite the integral as

$\displaystyle \int \dfrac{1}{\tan x} \; dx = \int \dfrac {\cos x}{\sin x} \; dx$

Use formula of integration $\displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c$ to obtain
$= \ln | \sin x | + c$
Hence
$\displaystyle \int \dfrac{1}{\tan x} \; dx = \ln | \sin x | + c$

Example 10
Evaluate the integral $\displaystyle \int \dfrac{1}{x^2 + 2x + 1} \; dx$

Solution to Example 10
Complete the square in the denominator

$\displaystyle \int \dfrac{1}{x^2 + 2x + 1} \; dx = \int \dfrac {1}{(x+1)^2} \; dx$

Use Integration by Substitution: Let $u = x+ 1$ and hence $\dfrac{du}{dx} = 1$ which gives $dx = du$
$= \displaystyle \int \dfrac {1}{u^2} \; du$
Rewrite as
$= \displaystyle \int u^{-2} \; du$

Use the formula for integration of power function: $\displaystyle \int x^n dx = \left(\dfrac{1}{n+1}\right) \; x^{n+1} + c$ to obtain
$= - u^{-1} + c$
$= - \dfrac{1}{u}+ c$

Substitute back: $u = x+ 1$ to write the final result as
$\displaystyle \int \dfrac{1}{x^2 + 2x + 1} \; dx = - \dfrac{1}{x+1} + c$

Example 11
Evaluate the integral $\displaystyle \int \dfrac{1}{x^2+x+1} \; dx$

Solution to Example 11
Note that the denominator $x^2+x+1$ cannot be factored over the rationals and therefore the partial fractions decomposition method cannot be used.
A known integral close to the given integral is $\displaystyle \int \dfrac{1}{x^2+1}dx = \arctan (x) + c$.
Start by completing the square in the denominator

$x^2+x+1 = (x + 1/2)^2 + 3/4$

Use Integration by Substitution: Let $u = x + 1/2$ which gives $dx = du$ and rewrite the integral as
$\displaystyle \int \dfrac{1}{x^2+x+1}dx = \int \dfrac{1}{u^2+3/4} du$

Factor $3/4$ in the denominator
$\displaystyle = \dfrac{4}{3} \int \dfrac{1}{\dfrac{4}{3} u^2+1} du$

Substitute: $w = \dfrac{2}{\sqrt 3} u$ which gives $w^2 = \dfrac{4}{ 3} u^2$ and $\dfrac{dw}{du} = \dfrac{2}{\sqrt 3}$ which may be written as $du = \dfrac{\sqrt 3}{2} dw$ and rewrite the integral as

$\displaystyle \dfrac{1}{3/4} \int \dfrac{1}{\dfrac{4}{3} u^2+1} du = \dfrac{1}{3/4} \dfrac{\sqrt 3}{2} \int \dfrac{1}{w^2+1} dw$

Simplify and rewrite the result as

$\displaystyle \dfrac{1}{3/4} \int \dfrac{1}{\dfrac{4}{3} u^2+1} du = \dfrac{2}{\sqrt{3}} \arctan w$

Substitute $w = \dfrac{2}{\sqrt 3} u$ and $u = x + 1/2$ or directly $w = \dfrac{2}{\sqrt 3} (x+1/2)$ to obtain the final answer as

$\displaystyle \int \dfrac{1}{x^2+x+1}dx = \dfrac{2}{\sqrt{3}} \arctan \left(\dfrac{2}{\sqrt 3} (x+1/2) \right)$

Example 12
Evaluate the integral $\displaystyle \int \dfrac{x^4-2x^2+x}{x^2+x+1} \; dx$

Solution to Example 12
Note that the degree of the numerator is greater than the degree of the denominator and we therefore divide the numerator by the denominator.

$\dfrac{x^4-2x^2+x}{x^2+x+1} = x^2-x-2+\dfrac{4x+2}{x^2+x+1}$

The given integral may be written as
$\displaystyle\int \frac{x^4-2x^2+x}{x^2+x+1}dx = \int \left(x^2-x-2+\dfrac{4x+2}{x^2+x+1} \right) du$

$x^2-x-2$ is a polynomial. $\dfrac{4x+2}{x^2+x+1}$ may be written as

$\dfrac{4x+2}{x^2+x+1} = 2 \dfrac{2x+1}{x^2+x+1}$

Note that the numerator $2x+1$ is the derivative of the denominator $x^2+x+1$ and therefore we use the formula of integration $\displaystyle\int \dfrac{f'(x)}{f(x)} \; dx = \ln | f(x)| +c$ to obtain the final answer

$\displaystyle \int \frac{x^4-2x^2+x}{x^2+x+1}dx = (1/3)x^3 - (1/2)x^2 - 2 x + 2 \ln |x^2+x+1| + c$

Example 13
Evaluate the integral $\displaystyle \int \left(x^3-\dfrac{1}{x^2}\right)^4 \; dx$

Solution to Example 13
Use the binomial theorem $\displaystyle \left(x+y\right)^n=\sum _{i=0}^n\binom{n}{i}x^{\left(n-i\right)}y^i$ to expand the integrand.

$\left(x^3-\dfrac{1}{x^2}\right)^4 = x^{12}-4x^7+6x^2-\dfrac{4}{x^3}+\dfrac{1}{x^8}$

The given integral may be written as
$\displaystyle \int \left(x^3-\dfrac{1}{x^2}\right)^4 \; dx = \int \left(x^{12}-4x^7+6x^2-\dfrac{4}{x^3}+\dfrac{1}{x^8} \right) dx$

Use integration of power function: $\displaystyle \int x^n dx = \left(\dfrac{1}{n+1}\right) \; x^{n+1} + c$ to obtain obtain the final answer

$\displaystyle \left(x^3-\dfrac{1}{x^2}\right)^4 \; dx = \dfrac{x^{13}}{13}-\dfrac{x^8}{2}+2x^3+\dfrac{2}{x^2}-\dfrac{1}{7x^7}+ c$

Example 14
Evaluate the integral $\displaystyle \int \tan^2(x) \; dx$

Solution to Example 14
Use the trigonometric identity $\tan^2 x = \sec^2 x - 1$ to rewrite the integral as.
$\displaystyle \int \tan^2(x) \; dx = \int (\sec^2 x - 1) \; dx \\ = \displaystyle \int \sec^2 x \; dx - \int \; dx$

Use the formula $\displaystyle \int \sec^2 x dx = \tan (x) + c$ to obtain the final answer

$\displaystyle \int \tan^2(x) \; dx = \tan (x) - x + c$

Example 15
Evaluate the integral $\displaystyle \int x^4(4x^5 - 2)^{10} \; dx$

Solution to Example 15
Note that the derivative of $4x^5 - 2$ is equal to $20 x^4$ hence the method Substitution: Let $u = 4x^5 - 2$ which gives $\dfrac{du}{dx} = 20 x^4$ and $dx = \dfrac{du}{20 x^4}$
The integral may be written as

$\displaystyle \int x^4(4x^5 - 2)^{10} \; dx = \int x^4 u^{10} \dfrac{1}{20 x^4} du$

Simplify and write as
$\displaystyle \int x^4(4x^5 - 2)^{10} \; dx = \dfrac{1}{20} \int u^{10} du$

Use integration of power function: $\displaystyle \int x^n dx = \left(\dfrac{1}{n+1}\right) \; x^{n+1} + c$ to obtain
$\displaystyle \int x^4(4x^5 - 2)^{10} \; dx = \dfrac{1}{120} u^{11} + c$

Substitute $u = 4x^5 - 2$
$\displaystyle \int x^4(4x^5 - 2)^{10} \; dx = \dfrac{1}{220} ( 4x^5 - 2 )^{11} + c$

Example 16
Evaluate the integral $\displaystyle \int x^2 \arcsin(x) \; dx$

Solution to Example 16
Integration by parts: $\int w' v \; dx = w v - \int w v' \; dx$. Let $w' = x^2$ hence $w = (1/3) x^3$ and $v = \arcsin(x)$ hence $v' = \dfrac{1}{\sqrt{1-x^2}}$
$\displaystyle \int x^2 \arcsin(x) \; dx = (1/3) x^3 \arcsin(x) - (1/3) \int x^3 \dfrac{1}{\sqrt{1-x^2}} \;dx \qquad (I)$

The integral on the right may be dealt with substitution: Let $u = \sqrt {1-x^2}$ which gives $\dfrac{du}{dx} = -2 x (1/2) (1-x^2)^{-1/2} = - x/u$ or $\; dx = - (u/x) du$
$\displaystyle \int x^3 \dfrac{1}{\sqrt{1-x^2}} \;dx = - \int x^3 \dfrac{1}{u}(u/x) \; du$

Simplify
$\displaystyle = - \int x^2 \; du$

Square both sides of $u = \sqrt {1-x^2}$ and solve to obtain $x^2 = 1 - u^2$ and substitute in the above integral
$= \displaystyle \int (u^2 - 1) \; du$

Calculate the above integral
$= \displaystyle (1/3) u^3 - u + c$

Substitute back $u = \sqrt {1-x^2}$ and substitute in integral (I) to obtain the final answer
$\displaystyle \int x^2 \arcsin(x) \; dx = \dfrac{1}{3} x^3 \arcsin(x) - \dfrac{1}{3} \left( \dfrac{1}{3} \sqrt {1-x^2}^3 - \sqrt {1-x^2} \right) + c$

Example 17
Evaluate the integral $\displaystyle \int \sqrt x \ln x \; dx$

Solution to Example 17
integration by parts: $\int w' v \; dx = w v - \int w v' \; dx$. Let $w' = \sqrt x$ hence $w = (2/3)x^{3/2}$ and $v = \ln x$ hence $v' = 1/x$
$\displaystyle \int \sqrt x \ln x \; dx = (2/3)x^{3/2} \ln x - \int (2/3)x^{3/2} (1/x) \; dx$

Simplify the right side
$\displaystyle \int \sqrt x \ln x \; dx = (2/3)x^{3/2} \ln x - \int (2/3)x^{1/2} \; dx$

Evaluate the integral to obtain the final answer
$\displaystyle \int \sqrt x \ln x \; dx = \dfrac{2}{3} \; x^{3/2} \ln x - \left(\dfrac{2}{3}\right)^2 x^{3/2} + c$

Example 18
Evaluate the integral $\displaystyle \int \dfrac{\sqrt{x+1}}{x} \; dx$

Solution to Example 18
Use Integration by Substitution: Let $u = \sqrt{x+1}$ which gives $\dfrac{du}{dx} = (1/2) (x+1)^{-(1/2)}$ or $dx = \dfrac{1}{ (1/2) (x+1)^{-(1/2)} } du = 2 \; u \; du$.
Solve $u = \sqrt{x+1}$ for $x$ to obtain $x = u^2 - 1$ and rewrite the integral as

$\displaystyle \int \dfrac{\sqrt{x+1}}{x} \; dx = \int \dfrac{u}{u^2 - 1} 2 u \; du \qquad (I)$

Simplify
$\displaystyle \int \dfrac{\sqrt{x+1}}{x} \; dx = 2 \int \dfrac{u^2}{u^2 - 1} \; du$

Divide the numerator by the denominator in $\dfrac{u^2}{u^2 - 1}$
$\dfrac{u^2}{u^2 - 1} = 1 + \dfrac{1}{u^2-1}$

and the partial fractions decomposition of \dfrac{1}{u^2-1} helps in rewriting the integrand $\dfrac{u^2}{u^2 - 1}$ as
$\dfrac{u^2}{u^2 - 1} = 1 - \dfrac{1}{2\left(u+1\right)}+\dfrac{1}{2\left(u-1\right)}$

Substitute and calculate the integral in the right side of (I) .
$\displaystyle 2 \int (1 - \dfrac{1}{2\left(u+1\right)}+\dfrac{1}{2\left(u-1\right)} \; du = 2 (u - \dfrac{1}{2} \ln |u + 1 | + \dfrac{1}{2} \ln |u - 1| ) + c$

Substitute back $u = \sqrt{x+1}$ and use properties of the logarithm to obtain the final answer.
$\displaystyle \int \dfrac{\sqrt{x+1}}{x} \; dx = 2 \sqrt{x+1} + \ln \left(\dfrac{|x|}{(\sqrt{x+1} + 1)^2}\right) + c$

Example 19
Evaluate the integral $\displaystyle \int \sin\left(\sqrt{x}\right) \; dx$

Solution to Example 19
Use Integration by Substitution: Let $u = \sqrt{x}$ which gives $\dfrac{du}{dx} = (1/2) (x)^{-(1/2)}$ or $dx = \dfrac{1}{ (1/2) (x)^{-(1/2)} } du = 2 \; u \; du$.
$\displaystyle \int \sin\left(\sqrt{x}\right) \; dx = 2 \int u \sin u \; du$

Apply integration by parts to $\int u \sin u \; du$: $\int w' v \; dx = w v - \int w v' \; dx$. Let $w' = \sin u$ hence $w = - \cos u$ and $v = u$ hence $v' = 1$
$\displaystyle \int u \sin u \; du = - u \cos u + \int \cos u du = - u \cos u + \sin u + c$

Back substitute $u = \sqrt{x}$ to obain the final answer
$\displaystyle \int \sin\left(\sqrt{x}\right) \; dx = - 2 \sqrt{x} \cos \sqrt{x} +2 \sin \sqrt{x} + c$

Example 20
Evaluate the integral $\displaystyle \int \dfrac{1}{e^x+e^{-x}} \; dx$

Solution to Example 20
Use Integration by Substitution: Let $u = e^x$ which gives $\dfrac{du}{dx} = e^x$ or $dx = \dfrac{1}{ e^x} du = \dfrac{1}{u} du$.

$\displaystyle \int \dfrac{1}{e^x+e^{-x}} \; dx = \int \dfrac{1}{u+1/u} \; \dfrac{1}{u} \; du$

Simplify.
$\displaystyle = \int \dfrac{1}{u^2+1} \; du$

Use the common integral $\int \dfrac{1}{u^2+1}du=\arctan \left(u\right)$ to obtain.
$\displaystyle = \arctan u + c$

Substitute back $u = e^x$ to write the final answer as
$\displaystyle \int \dfrac{1}{e^x+e^{-x}} \; dx = \arctan e^x + c$

Example 21
Evaluate the integral $\displaystyle \int \log_5 x \; dx$

Solution to Example 21
We first use the change of base formula of the log: $\; \log_5 (x) = \dfrac{\ln x }{\ln 5}$ to write the given integral as
$\displaystyle \int \log_5 x \; dx = \dfrac{1}{\ln 5} \int \ln x \; dx$

Apply integration by parts to $\int \ln x \; dx$: $\int w' v \; dx = w v - \int w v' \; dx$. Let $w' = 1$ hence $w = x$ and $v = \ln x$ hence $v' = 1/x$
$\displaystyle \int \ln x \; dx = x \ln x - \int x (1/x) \; dx + c$

Simplify and write the final asnwer as
$\displaystyle \int \log_5 x \; dx = \dfrac{1}{\ln 5} ( x \ln x - x) + c$

Example 22
Evaluate the integral $\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx$

Solution to Example 22
Note that if there is a way to write the expression under the square root as a square, the square root would simplify.
In trigonometry, we have the identity $\sqrt {1 - \sin^2 t} = \sqrt {\cos^2 t} = | \cos t |$
We need to make a change of variable such that the expression under the square root in the given integral would be similar to the example above.

$\sqrt{16 - x^2} = 4 \sqrt {1 - \dfrac{x^2}{16}} = 4 \sqrt {1 - \left(\dfrac{x}{4} \right)^2}$

Use the trigonometric substitution method: Let $\; \dfrac{x}{4} = \sin t$ which gives $x = 4 \sin t$ and $\dfrac{dx}{dt} = 4 \cos t$ or $dx = 4 \cos t \; dt$

$\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx = \int \dfrac{ (4 \sin t)^2 }{4 | \cos t |} \; 4 \cos t dt$

The integral above can only be done if we can simplify $| \cos t |$. For indefinite integrals, we can assume that either $| \cos t | = \cos t$ or $| \cos t | = \cos t$.
For definite integrals we need to study the sign of $\cos t$ over the interval of integration. The given integral is indefinite and we will assume that $\cos t \ge 0$ and therefore $| \cos t | = \cos t$. Hence the integral may simplified and written as

$\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx = 16 \int \sin t^2 \; dt$

Use the trigonometric identity $\sin t^2 = (1/2)(1 - \cos (2t)$ to rewrite the integral as
$\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx = 16 \int (1/2)(1- \cos (2t)t) \; dt$

Calculate the above integral
$\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx = 8 t - 4 \sin (2t) +c$

The substitution $x = 4 \sin t$ made above may be written as $t = \arcsin(x/4)$ which is used in the result above and gives the final answer
$\displaystyle \int \dfrac{x^2}{\sqrt{16 - x^2}} \; dx = 8 \arcsin(x/4) - 4 \sin (2 \arcsin(x/4)) + c$

## Exercises

Use the table of integrals and the properties above to calculate the following integrals. [Note that you may need to use more than one of the above properties and methods for one integral].

1. $\displaystyle \int (\sqrt{x} - \dfrac{x^3}{4} + x \; \ln x ) dx$

2. $\displaystyle \int \sqrt{x+1} dx$

3. $\displaystyle\int \sin^2 x dx$

4. $\displaystyle\int x \cos(x^2) dx$

5. $\displaystyle\int x e^{x^2} dx$

## Solutions to the Above Exercises

1. $\dfrac{2}{3}x^{\dfrac{3}{2}}-\dfrac{x^4}{16}+\dfrac{1}{2}x^2\ln x -\dfrac{x^2}{4}+ c$

2. $(2 / 3) (x+1)^{3/2}+c$

3. $x / 2 - (1/2) \sin x \cos x + c$

4. $(1 / 2) \sin(x^2) + c$

5. $(1 / 2) e^{x^2} + c$

## More References and links

1. integrals and their applications in calculus.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 2, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9998441934585571, "perplexity": 361.3065472682474}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-49/segments/1669446710918.58/warc/CC-MAIN-20221203011523-20221203041523-00585.warc.gz"}