Why is it incorrect to integrate both sides of $\frac{dy}{dx}=y$ to get $y=\frac{y^2}{2}+c$? I know that when we have the D.E. $\frac{dy}{dx}=y$, we divide by $y$, and after integration we get the answer we all know. Supposedly, integrating both sides of an equation should return a true statement about the function at hand. But, when we integrate directly $$\frac{dy}{dx}=y$$
we get
$$y=\frac{y^2}{2}+c$$ which is not true for $y=e^x$.
What is the error in integrating both sides of the equation?
When I have $\frac{dy}{y}=dt$ I am also integrating on different variables on each side.
 A: To integrate the right side properly with respect to $y$, you need to treat $x$ as if it were dependent on $y$.
$$\frac{dy}{dx} = y \implies \frac{dx(y)}{dy} = \frac1y \implies \int \frac{dx(y)}{dy}\,dy = \int\frac{dy}y \implies x(y) = \ln|y| + C$$
Then solving for $y$ as a function of $x$,
$$x = \ln|y(x)| + C \implies \ln|y(x)| = x+C \implies y(x) = e^{x+C} = Ce^x$$
A: On the RHS you will get integration of $y$ with respect to $x$ but how can you integrate $y$ with respect to $x$ unless you can express $y$ as a function of $x$.
A: The integration process  $\int f\ dx$ encountered here (while solving an ODE) precisely requires $f$  to be the function in variable $x$. The things like $\int f(y)dx$ or $\int f(y)dx$ is meaningless; unless $f$ is a function of two variables $x$ and $y$ which you generally encounter in solving a partial differential equation.
A: $$\frac{dy}{dx}=y$$
Detail steps of integration :
$$\int \frac{dy}{dx}dx=\int y\:dx$$
$$\int dy=\int y\:dx$$
$$y=\int y\:dx$$
Your mistake is to write $\quad \int y\:dx=\frac12 y^2+c\quad$ which is false
because $\quad  \frac12 y^2+c=\int y\:dy\quad$ which is not $\int y\:dx$ .
$$\boxed{\int y\:dx\neq \int y\:dy}$$
You can correctly integrate in expressing $\int y(x)dx$ or alternatively $\int x(y)dy$. How to correctly proceed is already shown in the other answers. No need to repeat it here.
A: A rigorous way to solve this ODE is the following:
$$
y'(x)=y(x) \quad\Longleftrightarrow\quad 
\mathrm{e}^{-x}y'(x)-\mathrm{e}^{-x}y(x)=0
\quad\Longleftrightarrow\quad 
\big(\mathrm{e}^{-x}y(x)\big)'=0
$$
which means that the function $\mathrm{e}^{-x}y(x)$ is constant, i.e., there exists a $c\in\mathbb R$, such that
$$
\mathrm{e}^{-x}y(x)=c \quad\Longleftrightarrow\quad 
y(x)=c\,\mathrm{e}^{-x}.
$$
