$\left[x \sin ^{2}\left(\frac{y}{x}-y\right)\right] d x+x d y=0 ; y=\frac{\pi}{4}$ when $x=1$
$\left[x \sin ^{2}\left(\frac{y}{x}\right)-y\right] d x+x d y=0$
$\Rightarrow \frac{d y}{d x}=\frac{-\left[x \sin ^{2}\left(\frac{y}{x}\right)-y\right]}{x}$ ...(1)
Let $F(x, y)=\frac{-\left[x \sin ^{2}\left(\frac{y}{x}\right)-y\right]}{x}$.
$\therefore F(\lambda x, \lambda y)=\frac{-\left[\lambda x \cdot \sin ^{2}\left(\frac{\lambda x}{\lambda y}\right)-\lambda y\right]}{\lambda x}=\frac{-\left[x \sin ^{2}\left(\frac{y}{x}\right)-y\right]}{x}=\lambda^{0} \cdot F(x, y)$
Therefore, the given differential equation is a homogeneous equation.
To solve this differential equation, we make the substitution as:
y = vx
$\Rightarrow \frac{d}{d x}(y)=\frac{d}{d x}(v x)$
$\Rightarrow \frac{d y}{d x}=v+x=\frac{d v}{d x}$
Substituting the values of $y$ and $\frac{d y}{d x}$ in equation (1), we get:
$v+x \frac{d v}{d x}=\frac{-\left[x \sin ^{2} v-v x\right]}{x}$
$\Rightarrow v+x \frac{d v}{d x}=-\left[\sin ^{2} v-v\right]=v-\sin ^{2} v$
$\Rightarrow x \frac{d v}{d x}=-\sin ^{2} v$
$\Rightarrow \frac{d v}{\sin ^{2} v}=-\frac{d x}{d x}$
$\Rightarrow \operatorname{cosec}^{2} v d v=-\frac{d x}{x}$
Integrating both sides, we get:
$-\cot v=-\log |x|-\mathrm{C}$
$\Rightarrow \cot v=\log |x|+\mathrm{C}$
$\Rightarrow \cot \left(\frac{y}{x}\right)=\log |x|+\log \mathrm{C}$
$\Rightarrow \cot \left(\frac{y}{x}\right)=\log |\mathrm{C} x|$ ...(2)
Now, $y=\frac{\pi}{4}$ at $x=1$
$\Rightarrow \cot \left(\frac{\pi}{4}\right)=\log |\mathrm{C}|$
$\Rightarrow \mathrm{I}=\log \mathrm{C}$
$\Rightarrow \mathrm{C}=e^{1}=e$
Substituting C = e in equation (2), we get:
$\cot \left(\frac{y}{x}\right)=\log |e x|$
This is the required solution of the given differential equation.