# Integrate the function$\frac{1}{1+\cot x}$

$\begin{array}{1 1} \frac{x}{2}-\frac{1}{2} \log(\sin x+\cos x)+c \\ \frac{x}{2}+\frac{1}{2} \log(\sin x+\cos x)+c \\ \frac{x}{2}-\frac{1}{2} \log(\sin x-\cos x)+c \\ \frac{x}{2}+\frac{1}{2} \log(\sin x-\cos x)+c\end{array}$

Toolbox:
• Method of substitution :
• Given f(x)dx can be transformed into another form by changing independent variable x to t by substituting x=g(t).
• Consider $I=\int f(x)dx.$
• Put x=g(t) so that $\frac{dx}{dt}=g'(t).$
• $\Rightarrow$dx=g'(t)dt.
• Thus $I=\int f(g(t).g'(t))dt.$
Given $I=\int \frac{1}{1+\cot x}dx=\int\frac{1}{1+\frac{\cos x}{\sin x}}dx=\int\frac{\sin x}{\sin x+\cos x}.$

Multiply and divide by 2

$I=\frac{1}{2}\int\frac{2\sin x}{\sin x+\cos x}dx.$

Add and subtract cos x in the numerator

$I=\frac{1}{2}\int\frac{(\sin x+\cos x)+(\sin x-\cos x)}{\sin x+\cos x}dx.$

Now separating the terms we get,

$I=\frac{1}{2}\int dx+\frac{1}{2}\int\frac{(\sin x-\cos x)}{\sin x+\cos x}dx.$

$\;\;\;=\frac{1}{2}(x)+\frac{1}{2}\int \frac{\sin x-\cos x}{\sin x+\cos x}dx.$
Put $\sin x+\cos x=t.$

$(\cos x-\sin x)dx=dt.$

$-(\sin x-\cos x)dx=dt.$

$(\sin x-\cos x)dx=-dt.$

Substituting for x and dx we get,

$I=\frac{x}{2}+\frac{1}{2}\int\frac{-dt}{t}.$

On integrating we get,

$I=\frac{x}{2}-\frac{1}{2}(log t)+c.$

Substituting back for t we get,

$I=\frac{x}{2}-\frac{1}{2}log(\sin x+\cos x)+c.$