∫(3+4sin(x)+2cos(x)3+2sin(x)+cos(x))dx.
Observe that the numerator and the denominator are very similar. The numerator is almost exactly double the denominator.
Therefore, add 3 and take away 3 from the numerator in order to lead to nice cancellation.
∫(6+4sin(x)+2cos(x)−33+2sin(x)+cos(x))dx,
∫(2(3+2sin(x)+cos(x))3+2sin(x)+cos(x))−33+2sin(x)+cos(x)dx,
∫(2−33+2sin(x)+cos(x))dx,
2x−3∫13+2sin(x)+cos(x)dx.
Now we just have to solve,
∫13+2sin(x)+cos(x)dx.
Often a useful substitution for tricky trigonometric integrals is a substitution called the tangent half angle substitution or the Weierstrass substitution. It is particularly useful for dealing with rational functions of sin(x) and cos(x), as we have here.
The substitution is the following,
t=tan(12x).
With this substitution,
dtdx=12⋅sec2(12x).
Using the identity sec2(θ)=1+tan2(θ),
dtdx=12⋅(1+tan2(12x)),
dtdx=12⋅(1+t2).
We conclude that,
dx=21+t2dt.
Consider by the half angle identity for sine,
sin(x)=2sin(x2)cos(x2)
sin(x)=2cos2(x2)⋅(sin(x2)cos(x2))
sin(x)=2tan(x2)sec2(x)
sin(x)=2t1+t2.
Similarly,
cos(x)=cos2(x2)−sin2(x2)
cos(x)=cos2(x2)⎛⎝1−(sin(x2)cos(x2))2⎞⎠
cos(x)=1−tan2(x2)sec2(x2)
cos(x)=1−t21+t2.
Substituting, ∫13+2sin(x)+cos(x)dx, is transformed to,
∫13+2t1+t2+1−t21+t2⋅21+t2dt
2∫13(1+t2)+2t+1−t2dt
2∫12t2+2t+4dt
∫1t2+2t+2dt.
The quadratic in t in the denominator is irreducible (cannot be factored without the use of complex numbers), meaning that this is an arctangent integral in t.
∫1(1+t)2+1dt=arctan(t+1)+C
Then, reversing the substitution,
∫13+2sin(x)+cos(x)dx=arctan(tan(12x)+1)+C.
We conclude that,
∫(3+4sin(x)+2cos(x)3+2sin(x)+cos(x))dx=2x−3arctan(tan(12x)+1)+K.
Incidentally, you can read more about the tangent half angle substitution here.