## Thursday, June 24, 2010

### Calculus: symbolic differentiation as the limit of numerical differentiation

Prerequisites: limits.

Consider as our simple example, the function $$y = f(x) = x^2$$. What is the slope "m" of the tangent line at the point x = 2? Give numerical approximations for various values of the spacing $$h= 1, 1/2, 1/4$$ and use the concepts of limits to get the exact slope or derivative at x = 2. The formulas for numerical approximations are:

1. The "forward" differentiaion approximation formula, $$m = \frac{f(x+h) - f(x)}{h}$$.
2. The "backward" differentiation approximation formula, $$m = \frac{f(x) - f(x-h)}{h}$$.
3. The "central" differentiation approximation formula, $$m = \frac{f(x+h)-f(x-h)}{2h}$$.

We tabulate the results of the approximations.

hforwardbackwardcentral
1$$m= \frac{(2+1)^2 - 2^2}{1}= 5$$$$m=\frac{2^2 - (2-1)^2}{1}=3$$ $$m= \frac{(2+1)^2 - (2-1)^2}{2} = 4$$
1/2$$m= \frac{(2+1/2)^2 - 2^2}{1}= 4.5$$$$m=\frac{2^2 - (2-1/2)^2}{1}=4.5$$ $$m= \frac{(2+1/2)^2 - (2-1/2)^2}{2} = 4$$
1/4$$m= \frac{(2+1/4)^2 - 2^2}{1}= 4.25$$$$m=\frac{2^2 - (2-1/4)^2}{1}= 3.75$$ $$m= \frac{(2+1/4)^2 - (2-1/4)^2}{1/2} = 4$$

Now what is the value when $$h \to 0$$? This can be obtained by computing limits.
$$\lim_{h\to 0}\frac{f(x+h) - f(x)}{h}; \lim_{h\to 0} \frac{f(x) - f(x-h)}{h};\lim_{h \to 0} \frac{f(x+h)-f(x-h)}{2h}$$

We shall compute the limit for the forward formula and leave the other two as graded seatworks.
$$\lim_{h\to 0}\frac{f(x+h) - f(x)}{h} = \lim_{h\to 0}\frac{(x+h)^2 - x^2}{h}=\lim_{h\to 0}\frac{x^2 + 2xh + h^2- x^2}{h}$$
$$=\lim_{h\to 0}\frac{2xh + h^2}{h}=lim_{h\to 0} {2x + h}= \lim_{h\to 0}2x + \lim_{h\to 0} h = 2x + 0 = 2x.$$ Thus the forward formula gives 2x as the slope of the tangent line at any point x in the graph $$f(x) = x^2$$.

Surprisingly the central formula approximation gives the "exact" answer but it will never be guaranteed that it will give the correct answer for any function. What we can say here is that the numerical central formula is in general more accurate than the other two.

Students should be able to do the limits for the bacward and central formulas. They might be surprised that both give the same results as the forward formula.