Chain Rule Motivation

The chain rule motivation relies on using the approximation
g(x+h) ≈ g(x) + h g’(x)

g[x_]:=(x-1)x(x+1)
lg[x_,a_]:=g[a]+g'[a](x-a)
Manipulate[
Show[
Plot[{g[x],lg[x,a]},{x,-2,2},PlotRange->{-6,6},
PlotStyle->{{Blue,Thick},{Black}},PlotLabel->g[a]+g'[a](x-a)],
ListPlot[{{a,g[a]}}]
],
{a,-2,2}
]

Here I add in the local absolute error:

g[x_]:=(x-1)x(x+1)
lg[x_,a_]:=g[a]+g'[a](x-a)
Manipulate[
Show[
Plot[{g[x],lg[x,a],Abs[g[x]-lg[x,a]]},{x,-2,2},PlotRange->{-6,6},
PlotStyle->{{Blue,Thick},{Black},{Gray,Dashed}},PlotLabel->g[a]+g'[a](x-a)],
ListPlot[{{a,g[a]}}]
],
{a,-2,2}
]