# 007B Sample Midterm 2, Problem 5 Detailed Solution

Evaluate the integral:

${\displaystyle \int {\frac {4x}{(x+1)(x^{2}+1)}}~dx}$

Background Information:
Through partial fraction decomposition, we can write
${\displaystyle {\frac {1}{(x+1)(x^{2}+1)}}={\frac {A}{x+1}}+{\frac {Bx+C}{x^{2}+1}}}$
for some constants ${\displaystyle A,B.}$

Solution:

Step 1:
We need to use partial fraction decomposition for this integral.
To start, we let
${\displaystyle {\frac {4x}{(x+1)(x^{2}+1)}}={\frac {A}{x+1}}+{\frac {Bx+C}{x^{2}+1}}.}$
Multiplying both sides of the last equation by  ${\displaystyle (x+1)(x^{2}+1),}$
we get
${\displaystyle 4x=A(x^{2}+1)+(Bx+C)(x+1).}$
Step 2:
If we let  ${\displaystyle x=-1,}$  the last equation becomes  ${\displaystyle -4=2A.}$  So,  ${\displaystyle A=-2.}$
If we let  ${\displaystyle x=0,}$  then we get  ${\displaystyle 0=A+C.}$  Thus,  ${\displaystyle C=-A=2.}$
Finally, if we let  ${\displaystyle x=1,}$  we get  ${\displaystyle 4=2A+2B+2C.}$
Plugging in  ${\displaystyle A=-2}$  and  ${\displaystyle C=2,}$  we get  ${\displaystyle B=2.}$
So, in summation, we have
${\displaystyle {\frac {4x}{(x+1)(x^{2}+1)}}={\frac {-2}{x+1}}+{\frac {2x+2}{x^{2}+1}}.}$
Step 3:
Now, we have

${\displaystyle {\begin{array}{rcl}\displaystyle {\int {\frac {4x}{(x+1)(x^{2}+1)}}~dx}&=&\displaystyle {\int {\frac {-2}{x+1}}~dx+\int {\frac {2x+2}{x^{2}+1}}~dx}\\&&\\&=&\displaystyle {\int {\frac {-2}{x+1}}~dx+\int {\frac {2x}{x^{2}+1}}~dx+\int {\frac {2}{x^{2}+1}}~dx}\\&&\\&=&\displaystyle {\int {\frac {-2}{x+1}}~dx+\int {\frac {2x}{x^{2}+1}}~dx+2\arctan(x).}\end{array}}}$

For the remaining integrals, we use  ${\displaystyle u}$-substitution.
For the first integral, we substitute  ${\displaystyle u=x+1.}$
For the second integral, the substitution is  ${\displaystyle t=x^{2}+1.}$
Then, we integrate to get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int {\frac {4x}{(x+1)(x^{2}+1)}}~dx}&=&\displaystyle {\int {\frac {-2}{u}}~du+\int {\frac {1}{t}}~dt+2\arctan(x)}\\&&\\&=&\displaystyle {-2\ln |u|+\ln |t|+2\arctan(x)+C}\\&&\\&=&\displaystyle {-2\ln |x+1|+\ln |x^{2}+1|+2\arctan(x)+C.}\end{array}}}$

${\displaystyle -2\ln |x+1|+\ln |x^{2}+1|+2\arctan(x)+C}$