solving the differential equation $y'=2xy$, $y(0)=2$

Solution 1:

Whenever you solve a separable ODE, you should begin by identifying any stationary solutions to the equation. Provided you have uniqueness, any other solutions will never cross the stationary solutions, so that all solutions are either completely stationary or can be found by separation of variables. Without uniqueness, problems can arise; you might consider the problem $y'=y^{2/3},y(0)=0$ for an example.

In your particular problem, the possible solutions to the original DE are the one you found using separation of variables, as well as $y=0$. Your equation has unique solutions, so with your initial condition, you will not hit zero, and so the division is legitimate.

Solution 2:

In addition to having the nice explanation by @Ian you can look at the particular example. When you start your trajectory at $y(0)=2$ you see that for small positive values of $x$ the equations gives $y'(x)=2xy(x)>0$ since $x>0$ and $y(x)$ is nearly $2$. Since the derivative is positive, the function is increasing, thus, $y(x)$ stays above $2$ all the time for $x>0$.