\begin {align*} y^{\prime }+y\cot \left ( x\right ) & =\cos x\\ y\left ( 0\right ) & =0 \end {align*}
In normal form the ode is \[ y^{\prime }+p\left ( x\right ) y=q\left ( x\right ) \] Hence \(p=\cot (x)\). Because \(\cot \left ( x\right ) \) is \(\frac {1}{\tan \left ( x\right ) }\) which is not deļ¬ned at \(x=0\) then uniqueness and existence theory do not apply. Here we have \(p=\cot \left ( x\right ) ,q=\cos \left ( x\right ) \). Therefore the integrating factor is \begin {align*} \mu & =e^{\int p\left ( x\right ) dx}\\ & =e^{\int \cot \left ( x\right ) dx}\\ & =e^{\ln \left ( \sin x\right ) }\\ & =\sin x \end {align*}
Then the ode becomes\begin {align*} \frac {d}{dx}\left ( y\mu \right ) & =\mu \cos x\\ \frac {d}{dx}\left ( y\sin x\right ) & =\sin x\cos x\\ y\sin x & =\int \sin x\cos x\ dx+c_{1}\\ y & =\frac {1}{\sin x}c_{1}+\frac {1}{\sin x}\int \sin x\cos x\ dx\\ & =\frac {1}{\sin x}c_{1}+\frac {1}{\sin x}\frac {\sin ^{2}x}{2}\\ & =\frac {1}{\sin x}c_{1}+\frac {\sin x}{2}\\ y\sin x & =c_{1}+\frac {1}{2}\sin x \end {align*}
At \(y\left ( 0\right ) =0\) the above results \(c_{1}=0\). Hence the solution is\[ y=\frac {\sin x}{2}\]