# Calculus/Integration/Solutions

## Integration of Polynomials

Evaluate the following:

1. ${\displaystyle \int (x^{2}-2)^{2}\,dx}$
{\displaystyle {\begin{aligned}\int (x^{2}-2)^{2}dx&=\int (x^{4}-4x^{2}+4)dx\\&=\mathbf {{\frac {x^{5}}{5}}-{\frac {4x^{3}}{3}}+4x+C} \end{aligned}}}
{\displaystyle {\begin{aligned}\int (x^{2}-2)^{2}dx&=\int (x^{4}-4x^{2}+4)dx\\&=\mathbf {{\frac {x^{5}}{5}}-{\frac {4x^{3}}{3}}+4x+C} \end{aligned}}}
2. ${\displaystyle \int 8x^{3}\,dx}$
{\displaystyle {\begin{aligned}\int 8x^{3}dx&={\frac {8x^{4}}{4}}+C\\&=\mathbf {2x^{4}+C} \end{aligned}}}
{\displaystyle {\begin{aligned}\int 8x^{3}dx&={\frac {8x^{4}}{4}}+C\\&=\mathbf {2x^{4}+C} \end{aligned}}}
3. ${\displaystyle \int (4x^{2}+11x^{3})\,dx}$
${\displaystyle \int (4x^{2}+11x^{3})dx=\mathbf {{\frac {4x^{3}}{3}}+{\frac {11x^{4}}{4}}+C} }$
${\displaystyle \int (4x^{2}+11x^{3})dx=\mathbf {{\frac {4x^{3}}{3}}+{\frac {11x^{4}}{4}}+C} }$
4. ${\displaystyle \int (31x^{32}+4x^{3}-9x^{4})\,dx}$
{\displaystyle {\begin{aligned}\int (31x^{32}+4x^{3}-9x^{4})dx&={\frac {31x^{33}}{33}}+{\frac {4x^{4}}{4}}-{\frac {9x^{5}}{5}}+C\\&=\mathbf {{\frac {31x^{33}}{33}}+x^{4}-{\frac {9x^{5}}{5}}+C} \end{aligned}}}
{\displaystyle {\begin{aligned}\int (31x^{32}+4x^{3}-9x^{4})dx&={\frac {31x^{33}}{33}}+{\frac {4x^{4}}{4}}-{\frac {9x^{5}}{5}}+C\\&=\mathbf {{\frac {31x^{33}}{33}}+x^{4}-{\frac {9x^{5}}{5}}+C} \end{aligned}}}
5. ${\displaystyle \int 5x^{-2}\,dx}$
{\displaystyle {\begin{aligned}\int 5x^{-2}dx&={\frac {5x^{-1}}{-1}}+C\\&=\mathbf {-{\frac {5}{x}}+C} \end{aligned}}}
{\displaystyle {\begin{aligned}\int 5x^{-2}dx&={\frac {5x^{-1}}{-1}}+C\\&=\mathbf {-{\frac {5}{x}}+C} \end{aligned}}}

## Indefinite Integration

Find the general antiderivative of the following:

6. ${\displaystyle \int (\cos x+\sin x)\,dx}$
${\displaystyle \int (\cos x+\sin x)\,dx=\mathbf {\sin x-\cos x+C} }$
${\displaystyle \int (\cos x+\sin x)\,dx=\mathbf {\sin x-\cos x+C} }$
7. ${\displaystyle \int 3\sin x\,dx}$
${\displaystyle \int 3\sin x\,dx=\mathbf {-3\cos(x)+C} }$
${\displaystyle \int 3\sin x\,dx=\mathbf {-3\cos(x)+C} }$
8. ${\displaystyle \int (1+\tan ^{2}x)\,dx}$
{\displaystyle {\begin{aligned}\int (1+\tan ^{2}x)dx&=\int \sec ^{2}xdx\\&=\mathbf {\tan x+C} \end{aligned}}}
{\displaystyle {\begin{aligned}\int (1+\tan ^{2}x)dx&=\int \sec ^{2}xdx\\&=\mathbf {\tan x+C} \end{aligned}}}
9. ${\displaystyle \int (3x-\sec ^{2}x)\,dx}$
${\displaystyle \int (3x-\sec ^{2}x)\,dx=\mathbf {{\frac {3x^{2}}{2}}-\tan x+C} }$
${\displaystyle \int (3x-\sec ^{2}x)\,dx=\mathbf {{\frac {3x^{2}}{2}}-\tan x+C} }$
10. ${\displaystyle \int -e^{x}\,dx}$
${\displaystyle \int -e^{x}\,dx=\mathbf {-e^{x}+C} }$
${\displaystyle \int -e^{x}\,dx=\mathbf {-e^{x}+C} }$
11. ${\displaystyle \int 8e^{x}\,dx}$
${\displaystyle \int 8e^{x}\,dx=\mathbf {8e^{x}+C} }$
${\displaystyle \int 8e^{x}\,dx=\mathbf {8e^{x}+C} }$
12. ${\displaystyle \int {\frac {1}{7x}}\,dx}$
${\displaystyle \int {\frac {1}{7x}}\,dx=\mathbf {{\frac {1}{7}}\ln |x|+C} }$
${\displaystyle \int {\frac {1}{7x}}\,dx=\mathbf {{\frac {1}{7}}\ln |x|+C} }$

## Integration by Substitution

Find the anti-derivative or compute the integral depending on whether the integral is indefinite or definite.

13. ${\displaystyle \int _{0}^{\pi /2}\sin(x)\cos(x)\,dx}$
Notice that
{\displaystyle {\begin{aligned}\sin(2x)&=2\sin(x)\cos(x)\\{\frac {1}{2}}\sin(2x)&=\sin(x)\cos(x)\end{aligned}}}

By this,

${\displaystyle \int _{0}^{\pi /2}\sin(x)\cos(x)\,dx=\int _{0}^{\pi /2}{\frac {1}{2}}\sin(2x)\,dx}$ .

Let

${\displaystyle u=2x,\qquad du=2\,dx\implies {\frac {1}{2}}du=dx}$ .
${\displaystyle u(0)=0,\qquad u(\pi /2)=\pi }$

Then,

{\displaystyle {\begin{aligned}\int _{0}^{\pi /2}{\frac {1}{2}}\sin(2x)\,dx&={\frac {1}{2}}\int _{0}^{\pi }{\frac {1}{2}}\sin(u)\,du\\&=-{\frac {1}{4}}\left(\cos(\pi )-\cos(0)\right)\\&=\mathbf {\frac {1}{2}} \end{aligned}}}
Notice that
{\displaystyle {\begin{aligned}\sin(2x)&=2\sin(x)\cos(x)\\{\frac {1}{2}}\sin(2x)&=\sin(x)\cos(x)\end{aligned}}}

By this,

${\displaystyle \int _{0}^{\pi /2}\sin(x)\cos(x)\,dx=\int _{0}^{\pi /2}{\frac {1}{2}}\sin(2x)\,dx}$ .

Let

${\displaystyle u=2x,\qquad du=2\,dx\implies {\frac {1}{2}}du=dx}$ .
${\displaystyle u(0)=0,\qquad u(\pi /2)=\pi }$

Then,

{\displaystyle {\begin{aligned}\int _{0}^{\pi /2}{\frac {1}{2}}\sin(2x)\,dx&={\frac {1}{2}}\int _{0}^{\pi }{\frac {1}{2}}\sin(u)\,du\\&=-{\frac {1}{4}}\left(\cos(\pi )-\cos(0)\right)\\&=\mathbf {\frac {1}{2}} \end{aligned}}}
14. ${\displaystyle \int _{0}^{\pi /4}\tan(x)\,dx}$ .
Rewrite the integral into an equivalent form to help us find the substitution:
${\displaystyle \int _{0}^{\pi /4}\tan(x)\,dx=\int _{0}^{\pi /4}{\frac {\sin(x)}{\cos(x)}}\,dx}$

Let

${\displaystyle u=\cos(x),\qquad -du=\sin(x)\,dx}$ .
${\displaystyle u(0)=1,\qquad u(\pi /4)={\frac {1}{\sqrt {2}}}}$ .

Apply all this information to find the original integral:

{\displaystyle {\begin{aligned}\int _{0}^{\pi /4}{\frac {\sin(x)}{\cos(x)}}\,dx&=-\int _{1}^{1/{\sqrt {2}}}{\frac {1}{u}}\,du\\&=\int _{1/{\sqrt {2}}}^{1}{\frac {1}{u}}\,du\\&=\ln(1)-\ln \left({\frac {1}{\sqrt {2}}}\right)\\&=0+\ln \left({\sqrt {2}}\right)\\&=\mathbf {\frac {\ln(2)}{2}} \end{aligned}}}
Rewrite the integral into an equivalent form to help us find the substitution:
${\displaystyle \int _{0}^{\pi /4}\tan(x)\,dx=\int _{0}^{\pi /4}{\frac {\sin(x)}{\cos(x)}}\,dx}$

Let

${\displaystyle u=\cos(x),\qquad -du=\sin(x)\,dx}$ .
${\displaystyle u(0)=1,\qquad u(\pi /4)={\frac {1}{\sqrt {2}}}}$ .

Apply all this information to find the original integral:

{\displaystyle {\begin{aligned}\int _{0}^{\pi /4}{\frac {\sin(x)}{\cos(x)}}\,dx&=-\int _{1}^{1/{\sqrt {2}}}{\frac {1}{u}}\,du\\&=\int _{1/{\sqrt {2}}}^{1}{\frac {1}{u}}\,du\\&=\ln(1)-\ln \left({\frac {1}{\sqrt {2}}}\right)\\&=0+\ln \left({\sqrt {2}}\right)\\&=\mathbf {\frac {\ln(2)}{2}} \end{aligned}}}
15. ${\displaystyle \int _{1/2}^{1}{\frac {e^{\sqrt {2x-1}}}{\sqrt {2x-1}}}\,dx}$ .
Let
${\displaystyle u={\sqrt {2x-1}},\qquad du={\frac {1}{\sqrt {2x-1}}}\,dx}$ .
${\displaystyle u(1/2)=0,\qquad u(1)=1}$ .

Then,

{\displaystyle {\begin{aligned}\int _{1/2}^{1}{\frac {e^{\sqrt {2x-1}}}{\sqrt {2x-1}}}\,dx&=\int _{0}^{1}e^{u}\,du\\&=e^{1}-e^{0}\\&=\mathbf {e-1} \end{aligned}}}
Let
${\displaystyle u={\sqrt {2x-1}},\qquad du={\frac {1}{\sqrt {2x-1}}}\,dx}$ .
${\displaystyle u(1/2)=0,\qquad u(1)=1}$ .

Then,

{\displaystyle {\begin{aligned}\int _{1/2}^{1}{\frac {e^{\sqrt {2x-1}}}{\sqrt {2x-1}}}\,dx&=\int _{0}^{1}e^{u}\,du\\&=e^{1}-e^{0}\\&=\mathbf {e-1} \end{aligned}}}
16. ${\displaystyle \int _{-3}^{-{\sqrt {6}}}{\frac {8x}{\sqrt {x^{2}-5}}}\,dx}$ .
Let
${\displaystyle u=x^{2}-5,\qquad du=2x\,dx}$ .
${\displaystyle u\left(-3\right)=4,\qquad u(-{\sqrt {6}})=1}$ .

Then,

{\displaystyle {\begin{aligned}\int _{-3}^{-{\sqrt {6}}}{\frac {8x}{\sqrt {x^{2}-5}}}\,dx&=4\int _{-3}^{-{\sqrt {6}}}{\frac {2x}{\sqrt {x^{2}-5}}}\,dx\\&=4\int _{4}^{1}{\frac {1}{\sqrt {u}}}\,du\\&=-4\int _{1}^{4}u^{-1/2}\,du\\&=-8\left({\sqrt {4}}-{\sqrt {1}}\right)\,du\\&=-8\left(2-1\right)\\&=\mathbf {-8} \end{aligned}}}
Let
${\displaystyle u=x^{2}-5,\qquad du=2x\,dx}$ .
${\displaystyle u\left(-3\right)=4,\qquad u(-{\sqrt {6}})=1}$ .

Then,

{\displaystyle {\begin{aligned}\int _{-3}^{-{\sqrt {6}}}{\frac {8x}{\sqrt {x^{2}-5}}}\,dx&=4\int _{-3}^{-{\sqrt {6}}}{\frac {2x}{\sqrt {x^{2}-5}}}\,dx\\&=4\int _{4}^{1}{\frac {1}{\sqrt {u}}}\,du\\&=-4\int _{1}^{4}u^{-1/2}\,du\\&=-8\left({\sqrt {4}}-{\sqrt {1}}\right)\,du\\&=-8\left(2-1\right)\\&=\mathbf {-8} \end{aligned}}}
17. ${\displaystyle \int -{\frac {3}{2}}{\sqrt {\frac {2}{e^{3x-2}}}}\,dx}$ .
It may be easier to see what to substitute once the integrand is written in an equivalent form.
${\displaystyle \int -{\frac {3}{2}}{\sqrt {\frac {2}{e^{3x-2}}}}\,dx=\int -{\frac {3{\sqrt {2}}}{2}}e^{-{\frac {1}{2}}(3x-2)}\,dx}$

From there, it becomes obvious to let

${\displaystyle u=-{\frac {1}{2}}(3x-2),\qquad du=-{\frac {3}{2}}\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int -{\frac {3{\sqrt {2}}}{2}}e^{-{\frac {1}{2}}(3x-2)}\,dx&=\int {\sqrt {2}}e^{u}\,du\\&={\sqrt {2}}e^{u}+C\\&={\sqrt {2}}e^{-{\frac {1}{2}}(3x-2)}+C\\&=\mathbf {{\sqrt {\frac {2}{e^{3x-2}}}}+C} \end{aligned}}}
It may be easier to see what to substitute once the integrand is written in an equivalent form.
${\displaystyle \int -{\frac {3}{2}}{\sqrt {\frac {2}{e^{3x-2}}}}\,dx=\int -{\frac {3{\sqrt {2}}}{2}}e^{-{\frac {1}{2}}(3x-2)}\,dx}$

From there, it becomes obvious to let

${\displaystyle u=-{\frac {1}{2}}(3x-2),\qquad du=-{\frac {3}{2}}\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int -{\frac {3{\sqrt {2}}}{2}}e^{-{\frac {1}{2}}(3x-2)}\,dx&=\int {\sqrt {2}}e^{u}\,du\\&={\sqrt {2}}e^{u}+C\\&={\sqrt {2}}e^{-{\frac {1}{2}}(3x-2)}+C\\&=\mathbf {{\sqrt {\frac {2}{e^{3x-2}}}}+C} \end{aligned}}}
18. ${\displaystyle \int {\frac {x\sec \left({\sqrt {x^{2}-5}}\right)\tan \left({\sqrt {x^{2}-5}}\right)}{50{\sqrt {x^{2}-5}}}}\,dx}$ .
Let
${\displaystyle u={\sqrt {x^{2}-5}},\qquad du={\frac {x}{\sqrt {x^{2}-5}}}\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int {\frac {x\sec \left({\sqrt {x^{2}-5}}\right)\tan \left({\sqrt {x^{2}-5}}\right)}{50{\sqrt {x^{2}-5}}}}\,dx&=\int {\frac {1}{50}}\sec(u)\tan(u)\,du\\&={\frac {1}{50}}\sec(u)+C\\&=\mathbf {{\frac {\sec \left({\sqrt {x^{2}-5}}\right)}{50}}+C} \end{aligned}}}
Let
${\displaystyle u={\sqrt {x^{2}-5}},\qquad du={\frac {x}{\sqrt {x^{2}-5}}}\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int {\frac {x\sec \left({\sqrt {x^{2}-5}}\right)\tan \left({\sqrt {x^{2}-5}}\right)}{50{\sqrt {x^{2}-5}}}}\,dx&=\int {\frac {1}{50}}\sec(u)\tan(u)\,du\\&={\frac {1}{50}}\sec(u)+C\\&=\mathbf {{\frac {\sec \left({\sqrt {x^{2}-5}}\right)}{50}}+C} \end{aligned}}}
19. ${\displaystyle \int {\frac {2\sec ^{2}\left(\ln(x)\right)\tan \left(\ln(x)\right)}{x}}\,dx}$ .
Let
${\displaystyle u=\ln(x),\qquad du={\frac {1}{x}}\,dx}$ .

Then,

${\displaystyle \int {\frac {2\sec ^{2}\left(\ln(x)\right)\tan \left(\ln(x)\right)}{x}}\,dx=\int 2\sec ^{2}(u)\tan(u)\,du}$ .

Let

${\displaystyle v=\tan(u),\qquad dv=\sec ^{2}(u)\,du}$ .

Therefore,

{\displaystyle {\begin{aligned}\int 2\sec ^{2}(u)\tan(u)\,du&=\int 2v\,dv\\&=v^{2}+C\\&=\tan ^{2}(u)+C\\&=\mathbf {\tan ^{2}\left(\ln(x)\right)+C} \end{aligned}}}

Alternatively, this could all be done with one substitution if one realized that

${\displaystyle {\frac {d}{dx}}\left(\tan \left[\ln(x)\right]\right)={\frac {\sec ^{2}\left(\ln(x)\right)}{x}}}$ .
Let
${\displaystyle u=\ln(x),\qquad du={\frac {1}{x}}\,dx}$ .

Then,

${\displaystyle \int {\frac {2\sec ^{2}\left(\ln(x)\right)\tan \left(\ln(x)\right)}{x}}\,dx=\int 2\sec ^{2}(u)\tan(u)\,du}$ .

Let

${\displaystyle v=\tan(u),\qquad dv=\sec ^{2}(u)\,du}$ .

Therefore,

{\displaystyle {\begin{aligned}\int 2\sec ^{2}(u)\tan(u)\,du&=\int 2v\,dv\\&=v^{2}+C\\&=\tan ^{2}(u)+C\\&=\mathbf {\tan ^{2}\left(\ln(x)\right)+C} \end{aligned}}}

Alternatively, this could all be done with one substitution if one realized that

${\displaystyle {\frac {d}{dx}}\left(\tan \left[\ln(x)\right]\right)={\frac {\sec ^{2}\left(\ln(x)\right)}{x}}}$ .
20. ${\displaystyle \int \left(e^{x}-1\right)x^{e^{x}-2}+x^{e^{x}-1}e^{x}\ln(x)\,dx}$ .
It may be easier to see what to substitute once the integrand is written in an equivalent form.
{\displaystyle {\begin{aligned}\int \left(e^{x}-1\right)x^{e^{x}-2}+x^{e^{x}-1}e^{x}\ln(x)\,dx&=\int x^{e^{x}-1}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx\\&=\int e^{\left(e^{x}-1\right)\ln(x)}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx\end{aligned}}}

From there, let

${\displaystyle u=\left(e^{x}-1\right)\ln(x),\qquad du=\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int e^{\left(e^{x}-1\right)\ln(x)}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx&=\int e^{u}\,du\\&=e^{u}+C\\&=e^{\left(e^{x}-1\right)\ln(x)}+C\\&=\mathbf {x^{e^{x}-1}+C} \end{aligned}}}
It may be easier to see what to substitute once the integrand is written in an equivalent form.
{\displaystyle {\begin{aligned}\int \left(e^{x}-1\right)x^{e^{x}-2}+x^{e^{x}-1}e^{x}\ln(x)\,dx&=\int x^{e^{x}-1}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx\\&=\int e^{\left(e^{x}-1\right)\ln(x)}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx\end{aligned}}}

From there, let

${\displaystyle u=\left(e^{x}-1\right)\ln(x),\qquad du=\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int e^{\left(e^{x}-1\right)\ln(x)}\left({\frac {e^{x}-1}{x}}+e^{x}\ln(x)\right)\,dx&=\int e^{u}\,du\\&=e^{u}+C\\&=e^{\left(e^{x}-1\right)\ln(x)}+C\\&=\mathbf {x^{e^{x}-1}+C} \end{aligned}}}
21. ${\displaystyle \int 2\sec ^{2}\left(\ln \left(x^{2}+{\frac {2}{x}}\right)\right){\frac {x^{3}-1}{x^{4}+2x}}\,dx}$ .
Let
${\displaystyle u=\ln \left(x^{2}+{\frac {2}{x}}\right),\qquad du=2{\frac {x^{3}-1}{x^{4}+2x}}\,dx\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int 2\sec ^{2}\left(\ln \left(x^{2}+{\frac {2}{x}}\right)\right){\frac {x^{3}-1}{x^{4}+2x}}\,dx&=\int \sec ^{2}(u)\,du\\&=\tan(u)+C\\&=\mathbf {\tan \left(\ln \left(x^{2}+{\frac {2}{x}}\right)\right)+C} \end{aligned}}}
Let
${\displaystyle u=\ln \left(x^{2}+{\frac {2}{x}}\right),\qquad du=2{\frac {x^{3}-1}{x^{4}+2x}}\,dx\,dx}$ .

Then,

{\displaystyle {\begin{aligned}\int 2\sec ^{2}\left(\ln \left(x^{2}+{\frac {2}{x}}\right)\right){\frac {x^{3}-1}{x^{4}+2x}}\,dx&=\int \sec ^{2}(u)\,du\\&=\tan(u)+C\\&=\mathbf {\tan \left(\ln \left(x^{2}+{\frac {2}{x}}\right)\right)+C} \end{aligned}}}

## Integration by parts

30. Consider the integral ${\displaystyle \int \sin(x)\cos(x)\,dx}$ . Find the integral in two different ways. (a) Integrate by parts with ${\displaystyle u=\sin(x)}$  and ${\displaystyle v'=\cos(x)}$ . (b) Integrate by parts with ${\displaystyle u=\cos(x)}$  and ${\displaystyle v'=\sin(x)}$ . Compare your answers. Are they the same?
(a)
${\displaystyle u=\sin x;\qquad du=\cos xdx}$
${\displaystyle v=\sin x;\qquad dv=\cos xdx}$
${\displaystyle {\begin{array}{ccc}\int \sin x\cos xdx=\sin ^{2}x-\int \sin x\cos xdx&\implies &2\int \sin x\cos xdx=\sin ^{2}x\\&\implies &\int \sin x\cos xdx=\mathbf {\frac {\sin ^{2}x}{2}} \end{array}}}$

(b)

${\displaystyle u=\cos x;\qquad du=-\sin xdx}$
${\displaystyle v=-\cos x\qquad dv=\sin xdx}$
${\displaystyle {\begin{array}{ccc}\int \sin x\cos xdx=-\cos ^{2}x-\int \sin x\cos xdx&\implies &2\int \sin x\cos xdx=-\cos ^{2}x\\&\implies &\int \sin x\cos xdx=\mathbf {-{\frac {\cos ^{2}x}{2}}} \end{array}}}$

Notice that the answers in parts (a) and (b) are not equal. However, since indefinite integrals include a constant term, we expect that the answers we found will differ by a constant. Indeed

${\displaystyle {\frac {\sin ^{2}x}{2}}-(-{\frac {\cos ^{2}x}{2}})={\frac {\sin ^{2}x+\cos ^{2}x}{2}}={\frac {1}{2}}}$
(a)
${\displaystyle u=\sin x;\qquad du=\cos xdx}$
${\displaystyle v=\sin x;\qquad dv=\cos xdx}$
${\displaystyle {\begin{array}{ccc}\int \sin x\cos xdx=\sin ^{2}x-\int \sin x\cos xdx&\implies &2\int \sin x\cos xdx=\sin ^{2}x\\&\implies &\int \sin x\cos xdx=\mathbf {\frac {\sin ^{2}x}{2}} \end{array}}}$

(b)

${\displaystyle u=\cos x;\qquad du=-\sin xdx}$
${\displaystyle v=-\cos x\qquad dv=\sin xdx}$
${\displaystyle {\begin{array}{ccc}\int \sin x\cos xdx=-\cos ^{2}x-\int \sin x\cos xdx&\implies &2\int \sin x\cos xdx=-\cos ^{2}x\\&\implies &\int \sin x\cos xdx=\mathbf {-{\frac {\cos ^{2}x}{2}}} \end{array}}}$

Notice that the answers in parts (a) and (b) are not equal. However, since indefinite integrals include a constant term, we expect that the answers we found will differ by a constant. Indeed

${\displaystyle {\frac {\sin ^{2}x}{2}}-(-{\frac {\cos ^{2}x}{2}})={\frac {\sin ^{2}x+\cos ^{2}x}{2}}={\frac {1}{2}}}$

## Integration by Trigonometric Substitution

40. ${\displaystyle \int {\frac {1}{x^{2}+a^{2}}}\,dx}$
Let
${\displaystyle x=a\tan \theta ;\qquad dx=a\sec ^{2}\theta d\theta }$

Then

{\displaystyle {\begin{aligned}\int {\frac {1}{x^{2}+a^{2}}}dx&=\int {\frac {a\sec ^{2}\theta d\theta }{a^{2}(\tan ^{2}\theta +1)}}\\&=\int {\frac {\sec ^{2}\theta d\theta }{a\sec ^{2}\theta }}\\&={\frac {1}{a}}\int d\theta \\&={\frac {\theta }{a}}+C\\&=\mathbf {{\frac {1}{a}}\arctan {\frac {x}{a}}+C} \end{aligned}}}
Let
${\displaystyle x=a\tan \theta ;\qquad dx=a\sec ^{2}\theta d\theta }$

Then

{\displaystyle {\begin{aligned}\int {\frac {1}{x^{2}+a^{2}}}dx&=\int {\frac {a\sec ^{2}\theta d\theta }{a^{2}(\tan ^{2}\theta +1)}}\\&=\int {\frac {\sec ^{2}\theta d\theta }{a\sec ^{2}\theta }}\\&={\frac {1}{a}}\int d\theta \\&={\frac {\theta }{a}}+C\\&=\mathbf {{\frac {1}{a}}\arctan {\frac {x}{a}}+C} \end{aligned}}}