\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

\begin{description}
\item[(i)]
$\ds\int x \sin x \,dx$

\item[(ii)]
$\ds\int_0^1 x^2 \exp(x) \,dx$

\item[(iii)]
$\ds\int \arctan x \,dx$

\item[(iv)]
$\ds\int \exp(2x) \cos(3x) \,dx$

\end{description}

\medskip

{\bf Answer}

(i)

$\ds\int x \sin x \,dx$

Use integration by parts

$$\begin{array} {cc} u=x & \ds\frac{dv}{dx}=\sin x\\
\ds\frac{du}{dx}=1 & v=-\cos x \end{array}$$

NB forget arbitrary constants at this stage

Now

$\ds\int\left(u\ds\frac{dv}{dx}\right)dx =
uv-\ds\int\left(v\ds\frac{du}{dx}\right)\,dx+const$

$\begin{array} {rcl} \Rightarrow \ds\int x \sin x \,dx & = &
-x\cos x + \ds\int \cos x \,dx +c\\ & = & \un{-x\cos x +\sin x +c}
\end{array}$

Check by differentiation.

(ii)

$\ds\int_0^1 x^2 \exp(x) \,dx$

Use integration by parts

$$\begin{array} {cc} u=x^2 & \ds\frac{dv}{dx}=e^x\\
\ds\frac{du}{dx}=2x & v=e^x \end{array}$$

Therefore $\left. \begin{array} {rcl} \ds\int_0^1 x^2e^x \,dx & =
& [uv]_0^1-\ds\int_0^1 \left(v \ds\frac{du}{dx}\right) \,dx\\ & =
& [x^2e^x]_0^1-2\ds\int_0^1 x e^x \,dx \end{array} \right\}\ \ \
A$

The second integral can also be evaluated by parts again:

Consider $\ds\int_0^1 2x e^x \,dx$

New $u,\ v$: $\left.\begin{array} {cc} u=2x &
\ds\frac{dv}{dx}=e^x\\ \ds\frac{du}{dx}=2 & v=e^x
\end{array}\right\}\ \ \ \ B$

So $\ds\int_0^1 2x e^x \,dx = [2x e^x]_0^1-\ds\int_0^1 2 e^x \,dx$
Can be checked easily.

Collect $A$ and $B$ together

$\begin{array} {rcl} \ds\int_0^1 x^2e^{2x} \,dx & = &
[x^2e^x]_0^1-\left\{[2xe^x]_0^1-2\ds\int_0^1 e^x \,dx\right\}\\ &
= & [x^2e^x-2xe^x]_0^1+2\ds\int_0^1e^x \,dx\\ & = & (1 \cdot e^1-2
\cdot 1 \cdot e^1)-(0-0)+2[e^x]_0^1\\ & = & -e+2[e^1-e^0]\\ & = &
-e+2(e-1)\\ & = & \un{e-2} \end{array}$

(iii)

$\ds\int \arctan x \,dx$

Integrate by parts: \lq\lq$\arctan x = 1 \times \arctan x$"

$$\begin{array} {cc} u=\arctan x & \ds\frac{dv}{dx}=1\\
\ds\frac{du}{dx}=\ds\frac{1}{1+x^2} & v=x \end{array}$$ (standard
result)

Therefore

$\begin{array} {rcl} \ds\int \arctan x & = &
uv-\ds\int\ds\frac{du}{dx} \,dx\\ & = & (x \arctan
x)-\ds\int\ds\frac{x}{1+x^2} \,dx\\ & & \ds\frac{f'}{f}\
\rm{integral:\ can\ spot\ answer\ or\ do\ by}\ x \times v
\\& = & \un{x \arctan x-\ds\frac{1}{2}\log (1+x^2)=c} \end{array}$

(iv)

$I=\ds\int \exp(2x) \cos(3x) \,dx$

Integrate by parts

$$\begin{array} {cc} u=cos 3x & \ds\frac{dv}{dx}=e^{2x}\\
\ds\frac{du}{dx}=-3\sin 3x & v=\ds\frac{e^{2x}}{2} \end{array}$$

$A:\ \begin{array} {rcl} I=\ds\int e^{2x}\cos 3x \,dx & = &
\ds\frac{e^{2x}}{2}\cos 3x-\ds\int\left(-\ds\frac{3}{2} \sin 3x
e^{2x}\right) \,dx\\ & = & \ds\frac{e^{2x}}{2}\cos
3x+\ds\frac{3}{2}\ds\int e^{2x}\sin 3x \,dx \end{array}$

Still difficult to do, but repeat integration by parts:

$\ds\int e^{2x} \sin 3x \,dx$

New $u,\ v$: $$\begin{array} {cc} u=\sin 3x &
\ds\frac{dv}{dx}=e^{2x}\\ \ds\frac{du}{dx}=3\cos 3x &
v=\ds\frac{e^{2x}}{2}\end{array}$$

$B:\ \ds\int e^{2x} \sin 3x \,dx = \ds\frac{e^{2x}}{2}\sin
3x-\ds\int\ds\frac{3}{2}e^{2x}\cos 3x \,dx$

Original integral back again! oh dear? No good!

Combine $A$ and $B$:

$\begin{array} {rcl} I=\ds\frac{e^{2x}}{2}\cos 3x+\ds\frac{3}{2}\
\ B\\ & = & \ds\frac{e^{2x}}{2}\cos 3x + \ds\frac{e^{2x}}{2}\cos
3x + \ds\frac{3}{2}\left[\ds\frac{e^{2x} \sin
3x}{2}-\ds\frac{3}{2}I\right]\\ & \Rightarrow & \ds\frac{1}{2}
e^{2x} \cos 3x + \ds\frac{3}{4} e^{2x}\sin 3x-\ds\frac{9}{4}I
\end{array}$

This is an equation in the unknown $I$!

Solve for $I$:

$\begin{array} {rcl} \ds\frac{13}{4}I & = &
\ds\frac{1}{2}e^{2x}\cos 3x+\ds\frac{3}{4}e^{2x}\sin 3x\\ &
\Rightarrow & \ds\int e^{2x} \cos 3x \,dx = \un{\ds\frac{2}{13}
e^{2x} \left(\cos 3x+\ds\frac{3}{2} \sin 3x\right)+c} \end{array}$

NB Don't forget arbitrary constant at end.

Check by differentiation.
\end{document}
