Derivatives of composite functions
If $f$ and $g$ are functions and $h=f \circ g$ so that\\
$h(x) = f(g(x))$ then \\
$h'(x) = \frac{dh(x)}{dx} = f'(g(x)) g'(x)$ \\
Examples
\begin{xmpl}
For fixed $x$ consider:
\begin{eqnarray*}
f(p) &=& \ln(p^{x} (1-p)^{n-x})\\
&=& \ln p^{x} + \ln(1-p)^{n-x}\\%ln of a product is the sum of ln
&=& x \ln p + (n-x) \ln (1-p)\\
\end{eqnarray*}
\begin{eqnarray*}
f'(p)&=& x \frac{1}{p} + \frac{n-x}{1-p}(-1)\\
&=& \frac{x}{p} - \frac{n-x}{1-p}\\
\end{eqnarray*}
\end{xmpl}
\begin{xmpl}
$f(b) = (y-bx)^2$ ($y,x$ fixed)\\
\begin{eqnarray*}
f'(b)&=& 2 (y-bx) (-x)\\
&=& -2x (y-bx)\\
&=&(-2xy) + (2x^2)b
\end{eqnarray*}
\end{xmpl}