$\frac{d y}{d x}+2 y \tan x=\sin x ; y=0$ when $x=\frac{\pi}{3}$
The given differential equation is $\frac{d y}{d x}+2 y \tan x=\sin x$.
This is a linear equation of the form:
$\frac{d y}{d x}+p y=Q$ (where $p=2 \tan x$ and $Q=\sin x$ )
$\frac{d y}{d x}+p y=Q($ where $p=2 \tan x$ and $Q=\sin x)$
Now, I.F $=e^{\int p d x}=e^{\int 2 \tan x d x}=e^{2 \log |\sec x|}=e^{\log \left(\sec ^{2} x\right)}=\sec ^{2} x$
The general solution of the given differential equation is given by the relation,
$y(\mathrm{I.F} .)=\int(\mathrm{Q} \times \mathrm{I.F}) d x+\mathrm{C}$
$\Rightarrow y\left(\sec ^{2} x\right)=\int\left(\sin x \cdot \sec ^{2} x\right) d x+\mathrm{C}$
$\Rightarrow y \sec ^{2} x=\int(\sec x \cdot \tan x) d x+\mathrm{C}$
$\Rightarrow y \sec ^{2} x=\sec x+\mathrm{C}$ ...(1)
Now, $y=0$ at $x=\frac{\pi}{3}$.
Therefore,
$0 \times \sec ^{2} \frac{\pi}{3}=\sec \frac{\pi}{3}+\mathrm{C}$
$\Rightarrow 0=2+\mathrm{C}$
$\Rightarrow \mathrm{C}=-2$
Substituting C = –2 in equation (1), we get:
$y \sec ^{2} x=\sec x-2$
$\Rightarrow y=\cos x-2 \cos ^{2} x$
Hence, the required solution of the given differential equation is $y=\cos x-2 \cos ^{2} x$.