solve $y'(x)=xy(x)$ without separating the variables and integrating the question asks to solve
$$y'(x)=xy(x)
  \\ y(2)=3
 $$
without seperating the variables and integrating. The given hint states: If the function y satisfies the differential equation, differentiate
$$y(x)\exp(-x^2/2)$$ and use the result to find $y(x)$.
now i can easily solve this IVP by separating the variables and integrating, but I don't seem to get the appropriate result by following the method described in the exercise. If i differentiate the given expression i get:
$$\dfrac {dy}{dx}= y'(x)\exp(-x^2/2) -xy(x)\exp(-x^2/2)$$ but i have no idea how i can find $y(x)$ by using this result.
 A: You're almost there factorize the exponential term:
$$(y(x)\exp(-x^2/2))'=\exp(-x^2/2)(y'-xy)$$
Since $y'-xy=0$
$$(y(x)\exp(-x^2/2))'=0$$
Integrate, apply the initial condition and you're done.
A: Since you are finding $y'(x) = xy(x)$, using separation of variable(i.e. u-sub) is probably the easiest way. But in general, you can solve something like
$$ y'(x) + f(x)y(x) = g(x)$$
even when $g(x) \neq 0$. This method is known as the integration factor method. The thought is finding M(x) such that LHS after multiplying $M(x)$
$$ y'(x)M(x) + f(x)y(x)M(x)$$
become
$$ (y(x)M(x))' = y'(x)M(x) + y(x)M'(x)$$
i.e. $M'(x) = f(x)M(x)$. Such $M$ is apparently in the shape of $e^{-\int f(x) dx}$ by separation of variable. In this case,
$$ M = e^{-\frac{x^2}{2}}$$
and hence
$$ (y(x)e^{-\frac{x^2}{2}})' =  y'(x)e^{-\frac{x^2}{2}} - xy(x)e^{-\frac{x^2}{2}} = (y'(x) - xy(x)) e^{-\frac{x^2}{2}} = 0$$
i.e.
$$ y(x) = ce^{-\frac{x^2}{2}} $$
and you may solve it using the initial condition.
A: Note that
\begin{align}
\frac{d}{dx}\left(y(x)\exp\left(-\frac{x^2}{2}\right)\right)&=y'(x)\exp\left(-\frac{x^2}{2}\right)-xy(x)\exp\left(-\frac{x^2}{2}\right) \\[5pt]
&= y'(x)\exp\left(-\frac{x^2}{2}\right)-y'(x)\exp\left(-\frac{x^2}{2}\right) \\[5pt]
&= 0 \, .
\end{align}
Hence, $y(x)\exp\left(-\dfrac{x^2}{2}\right)\equiv c$ for some $c\in\mathbb R$. Plugging in $x=2$, we get that $3\exp(-2)=c$, and therefore
$$
y(x)=c\exp\left(\frac{x^2}{2}\right)=3\exp\left(\frac{x^2}{2}-2\right) \, .
$$
The hint might be described as something of a "cheat" though! It is not obvious that $y(x)\exp\left(-\dfrac{x^2}{2}\right)$ is a constant unless you already know the solution to the differential equation.
