Let sinx = R(asinx+bcosx) + S(acosx-bsinx) + T = (Rb+Sa)cosx + (Ra-Sb)sinx + T
Rb+Sa=0,Ra-Sb=1,T=0
S=-Rb/a
Ra-(-Rb/a)b=1,R=a/(a²+b²)
S=-b/(a²+b²)
I = ∫ sinx/(asinx+bcosx) dx
= [a/(a²+b²)]∫ (asinx+bcosx)/(asinx+bcosx) dx + [-b/(a²+b²)]∫ (acosx-bsinx)/(asinx+bcosx) dx
= [a/(a²+b²)]∫ dx - [b/(a²+b²)]∫ d(asinx+bcosx)/(asinx+bcosx)
= [a/(a²+b²)]x - [b/(a²+b²)]ln| asinx+bcosx | + C
∫ x²/(x²+2x+2) dx
= ∫ [(x²+2x+2)-(2x+2)]/(x²+2x+2) dx
= ∫ (x²+2x+2)/(x²+2x+2) dx - ∫ (2x+2)/(x²+2x+2) dx
= ∫ dx - ∫ d(x²+2x+2)/(x²+2x+2)
= x - ln| x²+2x+2 | + C