## Calculus 10th Edition

$y=\cos x$ is not a solution to the given differential equation.
We will find $y'$ and substitute it along with $y$ into the given differential equation. $$y'=(\cos x)' = -\sin x.$$ Now by substituting we get: The Left side: $$xy'-2y=-x\sin x-2\cos x$$ The Right side is just $$x^3e^x.$$ The Left side is NOT equal to the right side for every $x$ so $y=\cos x$ is not a solution to the given differential equation.