For our Classical Mechanics class, I'm reading Chapter 1 of Goldstein, et al. Now I come across Eq. (1.50). To put it in context:
$$\begin{align*} \sum_i{\dot{\mathbf{p}_i} \cdot \delta\mathbf{r}_i}&=\sum_i{m_i\ddot{\mathbf{r}}_i \cdot \delta{\mathbf{r}_i}}\\ &=\sum_{i,j}{m_i\ddot{\mathbf{r}}_i} \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j \end{align*}$$
Consider now the relation Eq. (1.50): $$\begin{align*} \sum_{i,j}{m_i\ddot{\mathbf{r}}_i} \cdot \frac{\partial\mathbf{r}_i}{\partial q_j}&= \sum_i{\left[ \frac{d}{dt} \left( m_i\dot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \right) - m_i\dot{\mathbf{r}}_i \frac{d}{dt} \left( \frac{\partial \mathbf{r}_i}{\partial q_j} \right) \right]} \end{align*}$$
I'm at a loss for how he resolved it that way. He goes on to explain that we can interchange the differentiation with respect to $t$ and $q_j$. My question is: Why is there a subtraction in Eq. (1.50)?