By the method of partial fractions,
x2+x+1(x2+1)(x+2)=Ax+2+Bx+Cx2+1
⇒x2+x+1=A(x2+1)+(Bx+C)(x+2)
Put x=0⇒1=A+2C .........(1)
Put x=1⇒3=2A+3B+3C
Put A=1−2C from (1) in 2A+3B+3C=3 we get
⇒2(1−2C)+3B+3C=3
⇒2−4C+3B+3C=3
⇒3B−C=1 .........(2)
Put x=−1
⇒1−1+1=2A+(−B+C)(1)
⇒2A−B+C=1
⇒2(1−2C)−B+C=1 since A=1−2C
⇒2−4C−B+C=1
⇒−3C−B=−1
⇒3C+B=1
⇒B=1−3C .......(3)
Put (3) in (2) we get 3(1−3C)−C=1
⇒3−9C−C=1 or 10C=2
∴C=210=15
⇒B=1−3C=1−35=25 from (2)
Put C=15 in (1) we get
A=1−2C=1−25=35
∴A=35,B=25 and C=15
Now,∫x2+x+1(x2+2)(x+1)dx
=∫Adxx+1+∫Bx+Cx2+2dx
=35∫dxx+1+15∫2x+1x2+2dx
=35∫dxx+1+15∫2xx2+2dx+15∫dxx2+(√2)2
=35log|x+1|+15log∣∣x2+2∣∣+15×1√2tan−1x√2+c
=35log|x+1|+15log∣∣x2+2∣∣+15√2tan−1x√2+c