Answer
$y=2\sin x\ln \sin x+2\sin x$
Work Step by Step
We are given:
$(\sin x)y'-y\cos x=\sin 2x$
$(\sin x)y'-y\cos x=2\sin x \cos x$
Divide both sides by $\sin x$
$\frac{dy}{dx}-y\cot x=2 \cos x$
Integrating factor:
$I(t)=e^{\int -\cot xdx}dt=e^{-\ln \sin x}=\frac{1}{\sin x}=\csc x$
Multiply both sides by the intergrating factor:
$\csc x\frac{dy}{dx}-y\csc x\cot x=2 \csc x\cos x$
$\frac{d}{dx}(y \csc x)=2\cot x$
Integrate both sides:
$y \csc x=2\ln \sin x+c$
$y=2\sin x\ln \sin x+c\sin x$
Since $y(\frac{\pi}{2})=2$
$2=2\sin (\frac{\pi}{2})\ln \sin (\frac{\pi}{2})+c\sin (\frac{\pi}{2})$
Solve for $c$:
$c=2$
Hence general solution is $y=2\sin x\ln \sin x+2\sin x$