Introducing derivatives and integrals to solve for physics equations I recently came across this line of reasoning in a physics textbook:

I'm having trouble following this. On the left hand side of line 2, how do we get $2\frac{dx}{dt} \frac{d^2x}{dt^2} = \frac{d (dx/dt)^2}{dt}$? Looks like it might be the chain rule, but I'm a bit uncomfortable throwing these $dx$ and $dt$ terms around like this.
Then on line 3, we seem to be multiplying both sides by $\int dt$, but over a different interval? How does this work?
 A: Edit (I'm going to use $v$ and $\dot{x}$ interchangeably... sometimes it is convenient to use $v$ and other times it is convenient to use $\dot{x}$): 
So starting from
$$\frac{d}{{dt}}\left( {{{\dot x}^2}} \right) = \frac{d}{{dt}}\left[ {{{\left( {\frac{{dx}}{{dt}}} \right)}^2}} \right]$$
...we'll let
$$v = \frac{{dx}}{{dt}} = \dot x$$
...and we'll let
$$h\left( v \right) = {v^2} = {\left( {\frac{{dx}}{{dt}}} \right)^2} = {{\dot x}^2}$$
From the definitions of v and h, plus the first equation, we get:
$$\frac{{dh\left( v \right)}}{{dt}} =\frac{d}{{dt}}\left( {{{\dot x}^2}} \right) = \frac{d}{{dt}}\left[ {{{\left( {\frac{{dx}}{{dt}}} \right)}^2}} \right] = \frac{d}{{dt}}\left( {{v^2}} \right) $$
Using the equation above... and the chain rule:
$$\frac{{dh}}{{dt}} = \frac{{dh}}{{dv}}\frac{{dv}}{{dt}}$$
...it follows that:
$$\frac{{dh}}{{dt}} = \frac{d}{{dt}}\left( {{{\dot x}^2}} \right) = \frac{d}{{dt}}\left( {{v^2}} \right) = \frac{{dh}}{{dv}}\frac{{dv}}{{dt}} = \underbrace {\frac{d}{{dv}}\left( {{v^2}} \right)}_{2v}\underbrace {\frac{{dv}}{{dt}}}_{\frac{d}{{dt}}\left( {\frac{{dx}}{{dt}}} \right) = \frac{{{d^2}x}}{{d{t^2}}} = \ddot x} = 2v\ddot x = 2\dot x\ddot x$$
Next... the integral on the left side of the bottom equation you posted...Remembering that $h(v) = v^2$ and $\frac{dh}{dt} = \frac{d}{dt}\left(\dot{x}\right)$... from the fundamental theorem of calculus
...
$$\int_{{t_i}}^{{t_f}} {\frac{{dh}}{{dt}}dt = h\left( {{t_f}} \right) - h\left( {{t_i}} \right)} = {v^2}\left( {{t_f}} \right) - {v^2}\left( {{t_i}} \right)  $$
Going back to the chain rule...
$$\frac{{dh}}{{dt}} = \frac{{dh}}{{dv}}\frac{{dv}}{{dt}} = \frac{d}{{dt}}\left( {{v^2}} \right) = \frac{d}{{dt}}{\left( {\dot x} \right)^2}$$
...from the chain rule and the fundamental theorem of calculus...
$$\int_{{t_i}}^{{t_f}} {\frac{{dh\left( {v\left( t \right)} \right)}}{{dt}}dt = \int_{{t_i}}^{{t_f}} {\frac{{dh}}{{dv}}\frac{{dv}}{{dt}}dt}  = \int_{{t_i}}^{{t_f}} {\frac{d}{{dt}}{{\left( {\dot x} \right)}^2}dt}  = h\left( {v\left( {{t_f}} \right)} \right) - h\left( {v\left( {{t_i}} \right)} \right)}  \\ =  {v^2_f}\left( {{t_f}} \right) - {v^2_i}\left( {{t_i}} \right)$$
But thanks to the chain rule... we can basically act like the differentials in the derivatives above multiply like fractions..(and use what is called 'integration by substitution')
$$\int_{{t_i}}^{{t_f}} {\frac{{dh}}{{dv}}\frac{{dv}}{{dt}}dt}  = \int_{{t_i}}^{{t_f}} {dh}  = \int_{{t_i}}^{{t_f}} {\frac{{dh}}{{dt}}dt}  = \int_{{t_i}}^{{t_f}} {\frac{d}{{dt}}\left[ {{{\left( {\dot x} \right)}^2}} \right] = } \int_{{v_i}}^{{v_f}} {\frac{d}{{dt}}\left[ {{{\left( {\dot x} \right)}^2}} \right]dt}  = \left. {{{\left( {\dot x} \right)}^2}} \right|_{{v_i}}^{{v_f}} = \left. {{v^2}} \right|_{{v_o}}^{{v_f}} = v_f^2 - v_o^2$$
For the integral on the right side of the third equation... since $g \sin{\theta}$ is a constant...if $b = g\sin{\theta}$... From the fundamental theorem of calculus, 
$$b\int_{{t_0}}^{{t_f}} {\frac{{dx}}{{dt}}dt}  = \left. {bx} \right|_{{t_0}}^{{t_f}} = b\left[ {x\left( {{t_f}} \right) - x\left( {{t_o}} \right)} \right] = b\left[ {{x_f} - {x_0}} \right]$$
But we could get the same answer by using sloppy notation and 'cancelling out' the dt's as follows:
$$b\int_{{t_0}}^{{t_f}} {\frac{{dx}}{{dt}}dt}   = b\int_{{x_0}}^{{x_f}} {dx}  = \left. {bx} \right|_{{x_o}}^{{x_f}} = b\left[ {{x_f} - {x_o}} \right]$$
Is the text that you posted by from Classical Dynamics of Particles and Systems by Marion and Norton. I was assigned that book when I took an upper level classical mechanics course. Hated it. If you're looking for additional texts at a similar level, here's some recommendations. 
Classical Mechanics by John Taylor 
[Analytical Mechanics by Grant Fowles and George Cassidy (you can buy the international edition for about $12) 
Classical Mechanics by R. Douglas Gregory 
Classical Mechanics by Tom Kibble (costs just $30 new) 
Introduction to Classical Mechanics by David Morin
