[tex]\underbrace{(y^2\cos x-3x^2y-4x)}_M\,\mathrm dx+\underbrace{(2y\sin x-x^3+\ln y)}_N\,\mathrm dy=0[/tex]
The ODE is exact if [tex]M_y=N_x[/tex]. We have
[tex]M_y=2y\cos x-3x^2[/tex]
[tex]N_x=2y\cos x-3x^2[/tex]
and so the equation is indeed exact. So we're looking for a solution of the form [tex]\Psi(x,y)=C[/tex], noting that the total differential for this solution is
[tex]\Psi_x\,\mathrm dx+\Psi_y\,\mathrm dy=0[/tex]
which corresponds to
[tex]\begin{cases}\Psi_x=M\\\Psi_y=N\end{cases}[/tex]
In the first PDE, we can integrate both sides with respect to [tex]x[/tex] to get
[tex]\displaystyle\int\Psi_x\,\mathrm dx=\int(y^2\cos x-3x^2y-4x)\,\mathrm dx[/tex]
[tex]\implies\Psi(x,y)=y^2\sin x-x^3y-2x^2+f(y)[/tex]
where [tex]f(y)[/tex] is assumed to be a function of [tex]y[/tex] alone. Then differentiating with respect to [tex]y[/tex] gives us
[tex]\Psi_y=2y\sin x-x^3+f'(y)=2y\sin x-x^3+\ln y[/tex]
[tex]\implies f'(y)=\ln y[/tex]
[tex]\implies f(y)=y\ln y-y+C[/tex]
So the general solution is
[tex]\Psi(x,y)=y^2\sin x-x^3y-2x^2+y\ln y-y+C=C[/tex]
or simply
[tex]y^2\sin x-x^3y-2x^2+y\ln y-y=C[/tex]
Given that [tex]y(0)=e[/tex], we have
[tex]e^2\sin0-0^3\cdot e-2\cdot0^2+e\ln e-e=C[/tex]
[tex]\implies C=0[/tex]
so the particular solution to the IVP is
[tex]y^2\sin x-x^3y-2x^2+y\ln y-y=0[/tex]