# 007B Sample Midterm 3, Problem 5 Detailed Solution

Evaluate the following integrals.

(a)   ${\displaystyle \int x\sin x~dx}$

(b)   ${\displaystyle \int {\frac {1}{(x-3)(x-2)}}~dx}$

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

Solution:

(a)

Step 1:
We proceed using integration by parts.
Let  ${\displaystyle u=x}$  and  ${\displaystyle dv=\sin x~dx.}$
Then,  ${\displaystyle du=dx}$  and  ${\displaystyle v=-\cos x.}$
Therefore, we have
${\displaystyle \int x\sin x~dx=-x\cos x+\int \cos x~dx.}$
Step 2:
We integrate to get
${\displaystyle {\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
${\displaystyle {\frac {1}{(x-3)(x+2)}}={\frac {A}{x-3}}+{\frac {B}{x+2}}.}$
Multiplying both sides of the last equation by  ${\displaystyle (x-3)(x+2),}$
we get
${\displaystyle 1=A(x+2)+B(x-3).}$
If we let  ${\displaystyle x=3,}$  the last equation becomes  ${\displaystyle 1=5A.}$  Thus,  ${\displaystyle A={\frac {1}{5}}.}$
If we let  ${\displaystyle x=-2,}$  then we get  ${\displaystyle 1=(-5)B.}$  Thus,  ${\displaystyle B=-{\frac {1}{5}}.}$
So, in summation, we have
${\displaystyle {\frac {1}{(x-3)(x+2)}}={\frac {\frac {1}{5}}{x-3}}+{\frac {-{\frac {1}{5}}}{x+2}}.}$
Step 2:
Now, we have

${\displaystyle \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  ${\displaystyle u}$-substitution to evaluate these integrals.
For the first integral, we substitute  ${\displaystyle u=x-3.}$
For the second integral, the substitution is  ${\displaystyle t=x+2.}$
Then, we integrate to get

${\displaystyle {\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)     ${\displaystyle -x\cos x+\sin x+C}$
(b)     ${\displaystyle {\frac {1}{5}}\ln |x-3|-{\frac {1}{5}}\ln |x+2|+C}$