Integrate the following functions.
∫1(1+cotx)dx.
Let I=∫1(1+cotx)dx=∫11+cosxsinxdx
=∫1sinx+cosxsinxdx=∫sinx(sinx+cosx)dx=12∫2(sinx)sinx+cosxdx=12∫sinx+sinx+cosx−cosxsinx+cosxdx
[add and subtract cos x in numerator]
=12∫(sinx+cosx)+(sinx−cosx)(sinx+cosx)dx=12[∫(sinx+cosx)(sinx+cosx)dx+∫(sinx−cosx)sinx+cosxdx]=12[∫1dx+∫(sinx−cosx)sinx+cosxdx]
Let sinx+cosx=t⇒cosx−sinx=dtdx
⇒dx=dt−[sinx−cosx]∴I=12[∫1dx+∫(sinx−cosx)tdt−[sinx−cosx]]=12[∫1dx−∫1tdt]=12[x−log|t|]+C=12[x−log|sinx+cosx|]+C