# 007B Sample Midterm 3, Problem 5 Detailed Solution

Evaluate the following integrals.

(a)   $\int x\sin x~dx$ (b)   $\int {\frac {1}{(x-3)(x-2)}}~dx$ Background Information:
1. Integration by parts tells us that
$\int u~dv=uv-\int v~du.$ 2. Through partial fraction decomposition, we can write the fraction
${\frac {1}{(x+1)(x+2)}}={\frac {A}{x+1}}+{\frac {B}{x+2}}$ for some constants $A,B.$ Solution:

(a)

Step 1:
We proceed using integration by parts.
Let  $u=x$ and  $dv=\sin x~dx.$ Then,  $du=dx$ and  $v=-\cos x.$ Therefore, we have
$\int x\sin x~dx=-x\cos x+\int \cos x~dx.$ Step 2:
We integrate to get
${\begin{array}{rcl}\displaystyle {\int x\sin x~dx}&=&\displaystyle {-x\cos x+\int \cos x~dx}\\&&\\&=&\displaystyle {-x\cos x+\sin x+C.}\end{array}}$ (b)

Step 1:
We need to use partial fraction decomposition for this integral.
We start by letting
${\frac {1}{(x-3)(x+2)}}={\frac {A}{x-3}}+{\frac {B}{x+2}}.$ Multiplying both sides of the last equation by  $(x-3)(x+2),$ we get
$1=A(x+2)+B(x-3).$ If we let  $x=3,$ the last equation becomes  $1=5A.$ Thus,  $A={\frac {1}{5}}.$ If we let  $x=-2,$ then we get  $1=(-5)B.$ Thus,  $B=-{\frac {1}{5}}.$ So, in summation, we have
${\frac {1}{(x-3)(x+2)}}={\frac {\frac {1}{5}}{x-3}}+{\frac {-{\frac {1}{5}}}{x+2}}.$ Step 2:
Now, we have

$\int {\frac {1}{(x-3)(x+2)}}~dx=\int {\frac {\frac {1}{5}}{x-3}}~dx+\int {\frac {-{\frac {1}{5}}}{x+2}}~dx.$ Now, we use  $u$ -substitution to evaluate these integrals.
For the first integral, we substitute  $u=x-3.$ For the second integral, the substitution is  $t=x+2.$ Then, we integrate to get

${\begin{array}{rcl}\displaystyle {\int {\frac {1}{(x-3)(x+2)}}~dx}&=&\displaystyle {{\frac {1}{5}}\int {\frac {1}{u}}~du-{\frac {1}{5}}\int {\frac {1}{t}}~dt}\\&&\\&=&\displaystyle {{\frac {1}{5}}\ln |u|-{\frac {1}{5}}\ln |t|+C}\\&&\\&=&\displaystyle {{\frac {1}{5}}\ln |x-3|-{\frac {1}{5}}\ln |x+2|+C.}\end{array}}$ (a)     $-x\cos x+\sin x+C$ (b)     ${\frac {1}{5}}\ln |x-3|-{\frac {1}{5}}\ln |x+2|+C$ 