In my intro differential equations class we have often used the "equivalence" stated in title. It seems to me that somehow, the intermediate step $$ \frac{dx}{f(x)} = g(y)dy$$ is being used, in which case $dx$ and $dy$ are being used as numbers from a fraction! The equivalence is intuitively clear to me, but I would like to know what the justification for this informal process is. How would one give rigor to this equivalence?
To be clear, I am looking for a formal treatment as well as some motivation as to why we can work with $dx$'s in this manner.
I talk about this as integration by substitution to avoid talking about differentials.
Take \begin{equation} \frac{dy}{dx} = f(y)g(x) \implies \frac{1}{f(y)} \frac{dy}{dx} = g(x) \end{equation} then we integrate over $x$
\begin{equation} \int \frac{1}{f(y)} \frac{dy}{dx} dx= \int g(x)dx. \end{equation} Since we're thinking of $y$ as a function of $x$, we 'integrate by substitution' or perform '$u$-substitution'.
\begin{equation} \int \frac{1}{f(y(x))} \frac{dy}{dx} dx= \int\frac{dy}{f(y)}. \end{equation}
This is simply the integral equivalent of the chain rule.