202004241907 Homework 1 (Q2)

(a) State the Mean Value Theorem and the Taylor’s Theorem.

(b) Find an O(h^4) and an O(h^5) approximation to \cos h. Compare those approximate values to the actual value 0.9950042 when h=0.1. Correct answers in this question to seven decimal places.


Solution.

(a)

Theorem. (Mean-Value Theorem) Suppose f\in C[a,b], and f'(x) exists on (a,b). For every x\in [a,b] and some x_0\in [a,b],

f(x)=f(x_0)+f'(\eta (x))(x-x_0)

where \eta (x) is between x_0 and x.

Theorem. (Taylor’s Theorem) Suppose f\in C^n[a,b], and f^{(n+1)} exists on (a,b). For every x\in (a,b) and some x_0\in [a,b], there exists a number \eta (x) between x_0 and x with f(x)=P_n(x)+R_n(x), where

P_n(x)=f(x_0)+f'(x_0)(x-x_0)+ \displaystyle{\frac{f''(x_0)}{2!}}(x-x_0)^2+\cdots + \displaystyle{\frac{f^{(n)}(x_0)}{n!}(x-x_0)^n}, and

R_n(x)=\displaystyle{\frac{f^{(n+1)}(\eta (x))}{(n+1)!}}(x-x_0)^{n+1}.

(b) Let f(x)=\cos x. Then we have f'(x)=-\sin x, f''(x)=-\cos x, f'''(x)=\sin x, f^{(4)}(x)=\cos x, f^{(5)}(x)=-\sin x, etc. By Taylor expansion of \cos x at x_0, we have

\cos x=\cos x_0+(-\sin x_0)(x-x_0)+\displaystyle{\frac{-\cos x_0}{2!}}(x-x_0)^2+\displaystyle{\frac{\sin x_0}{3!}}(x-x_0)^3+\displaystyle{\frac{\cos x_0}{4!}}(x-x_0)^4+\displaystyle{\frac{-\sin x_0}{5!}}(x-x_0)^5+\cdots

Now letting x_0=0, we obtain further that

\cos x=1-\displaystyle{\frac{x^2}{2!}}+\displaystyle{\frac{x^4}{4!}}+\cdots =\displaystyle{\sum_{n=0}^\infty \frac{(-1)^n}{(2n)!}x^{2n}}

Thus, the O(h^4) approximation to \cos h is in the form of

\cos h=1-\displaystyle{\frac{h^2}{2!}}+O(h^4)

where O(h^4) is the higher-order terms \displaystyle{\sum_{n=2}^\infty \frac{(-1)^n}{(2n)!}h^{2n}}.

And the O(h^5) approximation to \cos h is in the form of

\cos h=1-\displaystyle{\frac{h^2}{2!}}+\displaystyle{\frac{h^4}{4!}}+O(h^5)

where O(h^5) is the higher-order terms \displaystyle{\sum_{n=3}^\infty \frac{(-1)^n}{(2n)!}h^{2n}}.

Then, when h=0.1, \cos h in the O(h^4) approximation would be

\cos 0.1=1-\displaystyle{\frac{0.1^2}{2!}}=0.995;

whereas in the O(h^5) approximation,

\cos 0.1=1-\displaystyle{\frac{0.1^2}{2!}}+\displaystyle{\frac{0.1^4}{4!}}=0.995004166\approx 0.9950042\enspace \textrm{(corr. to 7 d.p.)}.

Given the actual value \cos h=0.9950042, the O(h^4) approximation has an absolute error of |0.9950042-0.995|=0.0000042 and a relative error of \displaystyle{\frac{|0.9950042-0.995|}{|0.9950042|}}=4.2210877\times 10^{-6}. And the O(h^5) approximation has an absolute error of |0.9950042-0.9950042|=0 and thus a relative error of zero.


Remark. The 0 error is owing to the correction of 7 decimal places in both the direct computation of \cos 0.1 and its O(h^5) approximation.