I have started to work through Herbert Goldstein's, Charles Poole's and John Safko's Classical mechanics, and I am having a bit of trouble with one of the problems (chapter 1 problem 16). The problem is as follows:
A particle moves in a plane under the influence of a force, acting toward a center of force, whose magnitude is
$$F=\frac1{r^2}\left(1-\frac{\dot{r}^2-2\ddot{r}r}{c^2}\right)$$
where $r$ is the distance of the particle to the center of force. Find the generalized potential that will result in such a force, and from that the Lagrangian for the motion in a plane.
I was looking through the solution on chegg for this problem, and I can't seem to understand one step they took. I understand how to obtain the lagrangian and equations of motion once I have the generalized potential, but I can't figure out how they got the potential. This is the way that they solve for it:
I understand how they obtained the first term in Lagrange's equation (i.e. $-\frac{\partial}{\partial{r}}\left(\frac{1}{r}+\frac{\dot{r}^2}{c^2r}\right)$), but I can't figure out how they obtained the second term ($\frac{d}{dt}\frac{\partial}{\partial{\dot{r}}}\left(\frac{1}{r}+\frac{\dot{r}^2}{c^2r}\right)$). When I try to extract $\frac{d}{dt}\frac{\partial}{\partial{\dot{r}}}$ from $\frac{2\ddot{r}}{c^2r^2}-\frac{2\dot{r}^2}{c^2r^2}$, I can't get what they are getting. Does anyone know how they solved for the generalized potential here, or know a better way to do so? I know from what I have done in electromagnetism that the potential of a field can be found through a line integral of the force from $-\infty$ to r, but when I approach the problem that way, I get a natural log term at the end. Any help with how to approach this problem would be very appreciated!