Indefinite Integration

Evaluate $\displaystyle \int \dfrac{1 + \sin x}{\sin x \left(1 + \cos x\right)} \; dx$


$\begin{aligned} \text{Let } I & = \int \dfrac{1 + \sin x}{\sin x \left(1 + \cos x\right)} \; dx \\\\ & = \int \dfrac{dx}{\sin x \left(1 + \cos x\right)} + \int \dfrac{dx}{1 + \cos x} \;\;\; \cdots \; (1) \end{aligned}$

$\begin{aligned} \text{Let } I_1 & = \int \dfrac{dx}{\sin x \left(1 + \cos x\right)} \\\\ & = \int \dfrac{\sin x \; dx}{\sin^2 x \left(1 + \cos x\right)} \\\\ & = \int \dfrac{\sin x \; dx}{\left(1 - \cos^2 x\right) \left(1 + \cos x\right)} \\\\ & = \int \dfrac{\sin x \; dx}{\left(1 - \cos x\right) \left(1 + \cos x\right)^2} \;\;\; \cdots \; (2) \end{aligned}$

Let $\cos x = u$ $\;\;\; \cdots \; (3)$

Differentiating equation $(3)$ gives

$- \sin x \; dx = du$ $\implies$ $\sin x \; dx = - du$ $\;\;\; \cdots \; (3a)$

$\therefore$ $\;$ In view of equations $(3)$ and $(3a)$, equation $(2)$ becomes

$I_1 = \displaystyle \int \dfrac{- du}{\left(1 - u\right) \left(1 + u\right)^2}$ $\;\;\; \cdots \; (4)$

Let $\dfrac{-1}{\left(1 - u\right) \left(1 + u\right)^2} = \dfrac{A}{1 - u} + \dfrac{B}{1 + u} + \dfrac{C}{\left(1 + u\right)^2}$ $\;\;\; \cdots \; (5)$

$\begin{aligned} \implies \; -1 & = A \left(1 + u\right)^2 + B \left(1 - u\right) \left(1 + u\right) + C \left(1 - u\right) \\\\ & = u^2 A + 2 u A + B - u^2 B + C - u C \\\\ & = u^2 \left(A - B\right) + u \left(2 A - C\right) + \left(A + B + C\right) \end{aligned}$

Comparing the coefficients of the $u^2$ term gives

$A - B = 0$ $\implies$ $A = B$ $\;\;\; \cdots \; (5a)$

Comparing the coefficients of the $u$ term gives

$2 A - C = 0$ $\implies$ $C = 2 A$ $\;\;\; \cdots \; (5b)$

Comparing the constant term gives

$-1 = A + B + C$ $\implies$ $-1 = A + A + 2 A$ $\;\;\;$ [by equations $(5a)$ and $(5b)$]

$\implies$ $4 A = -1$ $\implies$ $A = \dfrac{-1}{4}$

$\therefore$ $\;$ From equation $(5a)$, $B = \dfrac{-1}{4}$

From equation $(5b)$, $C = 2 \times \left(\dfrac{-1}{4}\right) = \dfrac{-1}{2}$

Substituting the values of A, B and C in equation $(5)$ gives

$\dfrac{-1}{\left(1 - u\right) \left(1 + u\right)^2} = \dfrac{-1}{4 \left(1 - u\right)} - \dfrac{1}{4 \left(1 + u\right)} - \dfrac{1}{2 \left(1 + u\right)^2}$ $\;\;\; \cdots \; (6)$

$\therefore$ $\;$ We have from equations $(4)$ and $(6)$

$\begin{aligned} I_1 & = \dfrac{-1}{4} \int \dfrac{du}{1 - u} - \dfrac{1}{4} \int \dfrac{du}{1 + u} - \dfrac{1}{2} \int \dfrac{du}{\left(1 + u\right)^2} \\\\ & = \dfrac{1}{4} \log \left|1 - u\right| - \dfrac{1}{4} \log \left|u + 1\right| + \dfrac{1}{2 \left(1 + u\right)} + c_1 \\\\ & = \dfrac{1}{4} \log \left|\dfrac{1 - u}{u + 1}\right| + \dfrac{1}{2 \left(1 + u\right)} + c_1 \\\\ & = \dfrac{1}{4} \log \left|\dfrac{1 - \cos x}{\cos x + 1}\right| + \dfrac{1}{2 \left(1 + \cos x\right)} + c_1 \;\;\; \left[\text{by equation } (3)\right] \\\\ & = \dfrac{1}{4} \log \left|\dfrac{2 \sin^2 \left(\dfrac{x}{2}\right)}{2 \cos^2 \left(\dfrac{x}{2}\right)}\right| + \dfrac{1}{2 \times 2 \cos^2 \left(\dfrac{x}{2}\right)} + c_1 \\\\ & = \dfrac{1}{4} \log \left|\tan^2 \left(\dfrac{x}{2}\right)\right| + \dfrac{1}{4} \sec^2 \left(\dfrac{x}{2}\right) + c_1 \;\;\; \cdots \; (7) \end{aligned}$

$\begin{aligned} \text{Let } I_2 & = \int \dfrac{dx}{1 + \cos x} \\\\ & = \int \dfrac{dx}{2 \cos^2 \left(\dfrac{x}{2}\right)} \\\\ & = \dfrac{1}{2} \int \sec^2 \left(\dfrac{x}{2}\right) \; dx \\\\ & = \dfrac{1}{2} \tan \left(\dfrac{x}{2}\right) \times 2 + c_2 \\\\ & = \tan \left(\dfrac{x}{2}\right) + c_2 \;\;\; \cdots \; (8) \end{aligned}$

$\therefore$ $\;$ In view of equations $(7)$ and $(8)$, equation $(1)$ becomes

$I = \dfrac{1}{4} \log \left|\tan^2 \left(\dfrac{x}{2}\right)\right| + \dfrac{1}{4} \sec^2 \left(\dfrac{x}{2}\right) + \tan \left(\dfrac{x}{2}\right) + c$

where $c = c_1 + c_2$