$\frac{dx}{dy}+x \cot y =2y+y^2 \cot y$
The solution for the given differential equation
$xe^{\int pdy}=\int Q e^{\int pdy}dy+c$
Here $P=\cot y\;and\;Q=2y+y^2\cot y$
$\int pdy=\int \cot y \qquad =log |\sin y|$
Therefore $xe^{log|\sin y|}=\int (2y+y^2\cot y).e^{\log|\sin y|}dy+c$
=>$ x \sin y=\int (2y+y^2 \cot y).\sin y \;dy +c$
=>$ x \sin y=\int 2y \sin y\; dy +\int y^2 \cos y dy+c$
$ x \sin y=\int 2y \sin y dy+\int y^2 \cos y \;dy+c$
Consider $\int y^2 \cos y\; dy$
Let $u=y^2 \qquad dv=\cos y\; dy$
$du=2y\;dy \qquad v=\sin y$
Therefore $x \sin y= \int 2y \sin y\; dy+y^2 \sin y-2 \int y\sin y \;dy+c$
=>$ x\sin y=y^2 \sin y+c$
When $x=0\;and\;y=\pi/2$
$0=\frac{\pi^2}{4}.\sin (\pi/2)+c$
Therefore $c=-\frac{\pi^2}{4}$
Substituting for c
$x \sin y=y^2 \sin y-\frac{\pi^2}{4}$
=>$\sin y(x-y^2)=\frac{-\pi^2}{4}$
$\sin y(x-y^2)+\frac{\pi^2}{4}=0$