How to understand "integrating" an ODE more rigorously? I'm dealing with an ODE that looks like this (coming from mechanics):
$$\ddot{r} = \frac{a}{r^3}+b
$$
The text suggests that the "first integral" of this equation can be found, by which, looking around in other sources, I think is meant the following:
$$
\frac{1}{2}\dot{r}^2 = -\frac{a}{2r^2}+br + C
$$
Now I'm trying to "reverse-engineer" the way this can be reached from the original equation, and I understand that an integral over $dr$ was taken of both sides. The right side is clearer, but I can sort of handwave my way into understanding the left side (please correct if wrong):
$$
\frac{d}{dr}\frac{1}{2}\dot{r}^2 = \frac{1}{2}\frac{d(\dot{r}^2)}{dt}\frac{dt}{dr} = \dot{r}\ddot{r}\frac{dt}{dr} = \dot{r}\ddot{r}\frac{1}{\dot{r}} = \ddot{r}
$$
But the math student in me rebels against all this. As someone who knows basic real analysis, but next to nothing about ODEs, I don't really understand what I'm doing here, and would love some help making it more rigorous. In particular:


*

*What does it mean to take integrals over $dr$ when $r(t)$ is the unknown function here and not an independent variable? What am I actually doing in strict mathematical language? Is there a name for this technique?

*What does it mean to take $\frac{d\dot{r}}{dr}$? Do I need some sort of justification to use $t$ as an intermediate variable in a chain rule application (somewhat perversely to my naive mind)? 
P.S. If relevant, can you recommend books/articles that help understand what on earth is going on from the strict mundane basic-analysis point of view when I do those things?
 A: The integral meant here is an integral over time. The procedure is quite common in physical applications, and can be applied for every so-called conservative force equation, i.e. an equation of the form $\ddot{x} = f(x)$.
The first step is to multiply both sides of the equation by $\dot{r}$, yielding
\begin{equation}
 \dot{r} \ddot{r} = \frac{a \dot{r}}{r^3} + b \dot{r}. \tag{1}
\end{equation}
Now, you can realise that every term can be recognised as a time derivative of something, so that you can write $(1)$ as
\begin{equation}
 \frac{\text{d}}{\text{d} t} (\frac{1}{2} \dot{r}^2) = \frac{\text{d}}{\text{d} t} (\frac{-a}{2 r^2} + b r). \tag{2}
\end{equation}
If you have two functions whose derivatives identically concide (i.e. $\dot{F} = \dot{G}$), then it follows that those functions must be equal to each other, up to a constant (i.e. $F(t) = G(t) + c$). Therefore, we conclude that
\begin{equation}
 \frac{1}{2} \dot{r}^2 = \frac{-a}{2 r^2} + b r + c.
\end{equation}
Here, $c$ is a free parameter, so this 'integration procedure' yields a family of equations. Usually, this parameter is fixed by physically relevant boundary conditions. 
For more information, I would advise to search for Hamiltonian systems, conservative systems, energy, etc. These things should be covered by any decent differential equations text.
