Using a differential force in the derivation of hydrostatic equilibrium in a star
The whole exercise illustrates the usefulness of vectors in addressing problems.

$$\vec{F_g} = -\frac{GM(r)\delta m}{r^2}\ \hat{r}$$
$$\vec{F_P} = -\left(\frac{dP}{dr}\right) \delta r \delta A\ \hat{r}$$
$$\vec{F_P} + \vec{F_g} = 0$$
leads to the scalar equation of hydrostatic equilibrium
$$ \frac{dP}{dr}=- \rho g,$$
where $\vec{g}= -g\hat{r}$.