When given this simple differential equation and a condition, $$\frac{dy}{dx}=e^{2x-y} \hspace{1em} , \hspace{1em} C_1 : y(0)=0$$
Using separation of variables,
$$\frac{dy}{dx}=e^{2x}\cdot e^{-y} \Rightarrow \ \frac{dy}{e^{-y}}=e^{2x} \ dx$$
$$\int e^{y} \ dy= \int e^{2x} \ dx \Rightarrow \ e^{y} = \frac{e^{2x}}{2} +c $$
Solving for c ,
$$e^{0} = \frac{e^{2(0)}}{2} + c \ \Rightarrow 1 = \frac{1}{2} +c $$
$$ c = \frac{1}{2}$$
Solving for y ,
$$e^y = \frac{e^{2x}}{2} + \frac{1}{2} \ \Rightarrow e^y = \frac{1}{2}(e^{2x} + 1) $$
$$y = \ln\left(\frac{1}{2}\right) + \ln\left(e^{2x} + 1\right) $$
Finally,
$$\boxed{y=\ln\left(e^{2x} + 1\right) -\ln(2)}$$
Question: In the above example we can see that the method of separation of variables indeed works in solving our differential equation, but why? What actually is going on when the method of separation of variables is used?