Solve the differential equation: $\;$ $\sin x \dfrac{dy}{dx} - y = \cos^2 x \times \sin x \times \tan \left(\dfrac{x}{2}\right)$
Given differential equation is: $\;$ $\sin x \dfrac{dy}{dx} - y = \cos^2 x \times \sin x \times \tan \left(\dfrac{x}{2}\right)$
i.e. $\;$ $\dfrac{dy}{dx} - \dfrac{1}{\sin x} \times y = \cos^2 x \times \tan \left(\dfrac{x}{2}\right)$ $\;\;\; \cdots \; (1)$
Equation $(1)$ is a linear differential equation of the form $\;$ $\dfrac{dy}{dx} + P y = Q$ $\;\;\; \cdots \; (2)$
Comparing equation $(1)$ with the standard differential equation gives
$P = \dfrac{-1}{\sin x} = - \text{cosec }x$, $\;$ $Q = \cos^2 x \times \tan \left(\dfrac{x}{2}\right)$
Integrating factor I.F $= e^{\int P dx}$
$\begin{aligned}
\therefore \; I.F & = e^{\int - \text{cosec }x \; dx} \\\\
& = e^{- \log \left|\tan \left(x/2\right)\right|} \\\\
& = e^{\log \left|\tan \left(x / 2\right)\right|^{-1}} \\\\
& = \left[\tan \left(\dfrac{x}{2}\right)\right]^{-1} \\\\
& = \cot \left(\dfrac{x}{2}\right)
\end{aligned}$
The general solution of equation $(2)$ is
$y \; e^{\int P \; dx} = \displaystyle \int Q \; e^{\int P \; dx} \; dx$
$\therefore \;$ The solution of equation $(1)$ is
$y \; \cot \left(\dfrac{x}{2}\right) = \displaystyle \int \cos^2 x \times \tan \left(\dfrac{x}{2}\right) \times \cot \left(\dfrac{x}{2}\right) \; dx$
i.e. $\;$ $y \cot \left(\dfrac{x}{2}\right) = \displaystyle \int cos^2 x \; dx$
i.e. $\;$ $y \cot \left(\dfrac{x}{2}\right) = \displaystyle \int \left(\dfrac{1 + \cos 2x}{2}\right) \; dx$
i.e. $\;$ $y \cot \left(\dfrac{x}{2}\right) = \dfrac{1}{2} \left[\displaystyle \int dx + \displaystyle \int \cos 2x \; dx\right]$
i.e. $\;$ $y \cot \left(\dfrac{x}{2}\right) = \dfrac{x}{2} + \dfrac{\sin 2x}{4} + C$
where $\;$ $C$ is the constant of integration.