# Math Insight

### Applet: The chain rule for linear functions

The linear functions $g(x)=ax+b$ (thick blue line on left) and $f(x)=cx+d$ (thin cyan line on left) are composed to form the linear function $h(x)=f(g(x))=c(ax+b)+d =cax+cb+d$ (green line on right). For this linear case, the derivatives of $f$, $g$ and $h$ are simply the slopes of the lines: $f'(x)=c$, $g'(x)=a$, and $h'$ is just the product of $f'$ and $g'$: $h'(x)=ac$. In this case of linear functions, the chain rule is quite simple since the slopes are independent of the points where they are evaluated. Nonetheless, to prepare for the nonlinear case where slopes do depend on location, the relevant slopes to calculate $h'(x)$ at $x=x_0$ (represented by the red points on the x-axes) are tracked by the green points on the function graphs.

The green point on the graph of $h$ in the right panel illustrates the point on the graph whose height is $h(x_0)$, as labeled on the vertical axis. The left panel illustrates the points on the graphs of $f$ and $g$ that are needed to calculate $h(x_0)=f(g(x_0))$. One first evaluates $g(x_0)$, shown by the green diamond on the graph of $g$. One then evaluates $f(x)$ at $x=g(x_0)$. The value of $g(x_0)$ is the height of the green diamond, as illustrated by the point on the vertical axis. To translate the value of $g(x_0)$ from the vertical to the horizontal axis, one can shift horizontally to the point $(g(x_0),g(x_0))$ on the $x=y$ line (the gray diagonal line). Then one simply moves vertically to the graph of $f$ to calculate $h(x_0)=f(g(x_0))$, which is labeled on the vertical axis. The relevant slopes of $g$ and $f$ are those calculated at the points needed to evaluate $f(g(x_0))$, i.e., the slope of $g$ at $x=x_0$ and the slope of $f$ at $x=g(x_0)$. Therefore, the derivative of $h$ at $x=x_0$ is the product of these slopes: $h'(x_0) = f'(g(x_0)) g'(x_0)$.

You can change the parameter values by entering values in the boxes; you can also change $x_0$ by dragging one of the red points on the $x$-axes. You can zoom in, zoom out, or pan the axes by clicking the corresponding buttons.

Applet file: chain_rule_linear_functions.ggb