Is $dy = -\frac{1}{x^2}dx$ a valid rearrangement of $\frac{dy}{dx} = -\frac{1}{x^2}$? $$ y = \frac{1}{x}$$
$$\frac{dy}{dx} = -\frac{1}{x^2}$$
Is $$dy = -\frac{1}{x^2}dx$$ a valid rearrangement of $\frac{dy}{dx} = -\frac{1}{x^2}$? That is, is that a  mathematically meaningful/legitimate operation? 
 A: This is a deceptively challenging and deep question whose answer depends on many things. Specific issues include


*

*You ask if it's "mathematically meaningful/legitimate" to use. What does it mean to be meaningful? On the face of it, this is a type of operation done by hundreds of thousands of students learning things like $u$-substitution all the time. In these cases, the result coming out is correct, so some might be tempted to call this "shorthand," though perhaps not completely correct. Is it meaningful and legitimate?

*Part of the answer depends on the level of sophistication of the audience. In beginning calculus courses, the short answer is that $\frac{dy}{dx}$ is not a fraction and shouldn't be treated like one. We chose fraction-notation because in many ways it behaves like a fraction. The chain rule is an excellent example of this. You might read the answers to Is $\frac{\textrm{d}y}{\textrm{d}x}$ not a ratio? to get a better understanding.

*At higher sophistication, one might view $dx$ as a "differential" (or higher still, a "differential form"). With this level of understanding and machinery, one can conclude that it's a perfectly reasonable set of rearrangements. You might read How misleading is it to regard $\frac{dy}{dx}$ as a fraction from MO.

*But before you think that really, it's totally reasonable, you should also know that similar lines of thinking do not apply for multivariable calculus or analysis. So this is somehow confounded.
A: It is meaningful and legitimate, and in fact, it is how many differential equations are solved. Granted, it's confusing because calculus is usually taught in such a way that $\frac{d}{dx}[\ ]$ is an operator and not a variable, but when you have $\frac{dy}{dx}$ in an equation you need to solve, you can take $dy$ and $dx$ to mean an infinitesimal quantity of $y$ and $x$ respectively.
Infinitesimals weren't formally introduced until the 1950s, but they were what Leibniz had in mind in his formulation of calculus. It just couldn't be explained in a rigorous way until the development of model theory. Mathematicians used this kind of technique anyway, because it is much quicker than using the definition of derivative based on limits every time you want to to calculus. That's how it's taught in the modern curriculum. Start with the rigorous definition of a derivative, and then use these techniques that are explained in a not-so-rigorous manner.
To continue with your example, if you integrate both sides of your equation, you get
$$\int dy = \int \frac{-1}{x^2} dx,$$
$$y = \frac{1}{x} + c,$$
and your original equation satisfies this.
