This is the Chain Rule of differentiation. If $f$ is a function of $u$, and $u$ is a function of $x$, then the derivative of $f$ with respect to $x$ is the derivative of $g$ with respect to $u$ multiplied by the derivative of $u$ with respect to $x$.