Question:
$\frac{d y}{d x}+\sec x y=\tan x\left(0 \leq x<\frac{\pi}{2}\right)$
Solution:
The given differential equation is:
$\frac{d y}{d x}+p y=Q$ (where $p=\sec x$ and $Q=\tan x$ )
Now, I.F $=e^{\int p d x}=e^{\int \sec x d x}=e^{\log (\sec x+\tan x)}=\sec x+\tan x$.
The general solution of the given differential equation is given by the relation,
$y($ I.F. $)=\int($ Q $\times$ I.F. $) d x+\mathrm{C}$
$\Rightarrow y(\sec x+\tan x)=\int \tan x(\sec x+\tan x) d x+\mathrm{C}$
$\Rightarrow y(\sec x+\tan x)=\int \sec x \tan x d x+\int \tan ^{2} x d x+\mathrm{C}$
$\Rightarrow y(\sec x+\tan x)=\sec x+\int\left(\sec ^{2} x-1\right) d x+\mathrm{C}$
$\Rightarrow y(\sec x+\tan x)=\sec x+\tan x-x+\mathrm{C}$