Finding solution of $y' = \frac{(y^2 - 4yt + 6t^2)}{t^2}$ with initial condition $y(2) = 4$ Concerning the ordinary differential equation
$$y' = \frac{(y^2 - 4yt + 6t^2)}{t^2}$$
with initial condition $y(2) = 4$.
My text book gives the solution as $y = 2t$, and so does MATLAB.
However, I only see the following :
\begin{align}
v &= \frac{y}{t}\\
y' &= v^2 - 4v + 6\\
tv' + v &= v^2 - 4v + 6\\
tv'&= v^2 - 5v + 6\\
\end{align}
\begin{align}
\frac{dv}{(v-3)(v-2)} &= \frac{dt}{t}\\
\frac{dv}{(v-3)} - \frac{dv}{(v-2)} &= \frac{dt}{t}\\
\ln(|v-3|) - \ln(|v-2|) &= \ln(|t|) + c\\
\frac{v-3}{v-2} = te^{c}\\
\end{align}
which then reduces to
$$v = \frac{3 - 2te^{c}}{1-te^{c}}$$
and
$$y = \frac{t(3 - 2te^{c})}{1-te^{c}}$$
There must be at least some logic to this, because several online calculators (for example WolframAlpha) give the same result. But nevertheless it seems wrong, as the initial condition implies
$4 - 8e^{c} = 6 - 8e^{c}$?
Can someone please explain to me how to arrive at $y=2t$, and where I would have gone wrong?

You've shown
$$ tv' = v^2 - 5v + 6 = (v-2)(v-3).$$
and since $v = y/t$, the initial condition gives $v(2)  =2$. Thus
$$\frac{dv}{(v-3)(v-2)} = \frac{dt}{t}$$
cannot be done since $v-2$ is at the bottom.
This is exactly the case where sometimes separation of variable does not work: indeed for a simple problem like
$$ y' = y, \ \ \ y(0) = 0,$$
you cannot use separation of variable to find the solution (which is $y(t) = 0$).
To "find" the solution $y = 2t$, you simply observe that $v(t) = 2$ is a solution, and then from the uniqueness theorem to ODE, it is THE solution.
