1
0
Fork 0
mathematics-physics-wiki/docs/en/mathematics/calculus/taylor-polynomials.md

197 lines
6.3 KiB
Markdown
Raw Normal View History

2023-09-23 12:46:18 +02:00
# Taylor polynomials
## Linearization
A function $f(x)$ about $x = a$ may be linearized into
$$
P_1(x) = f(a) + f'(a)(x-a),
$$
obtaining a polynomial that matches the value and derivative of $f$ at $x = a$.
## Taylor's theorem
Even better approximations of $f(x)$ can be obtained by using higher degree polynomials if $f^{n+1}(t)$ exists for all $t$ in an interval containing $a$ and $x$. Thereby matching more derivatives at $x = a$,
$$
P_n(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2+ ... + \frac{f^{(n)}(a)}{n!}(x-a)^n.
$$
Then the error $E_n(x) = f(x) - P_n(x)$ in the approximation $f(x) \approx P_n(x)$ is given by
$$
E_n(a) = \frac{f^{(n+1)}(s)}{(n+1)!}(x-a)^{n+1},
$$
where $s$ is some number between $a$ and $x$. The resulting formula
$$
f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + ... + \frac{f^{(n)}(a)}{n!}(x-a)^n + \frac{f^{(n+1)}(s)}{(n+1)!}(x-a)^{n+1},
$$
for some $s$ between $a$ and $x$, is called **Taylor's formula with Lagrange remainder**; the Lagrange is the error term $E_n(x)$.
**Proof:**
Observe that the case $n=0$ of Taylor's formula, namely
$$
f(x) = P_0(x) + E_0(x) = f(a) + \frac{f'(s)}{1!}(x-a),
$$
is just the [Mean-value theorem](differentation.md#mean-value-theorem) for some $s$ between $a$ and $x$
$$
\frac{f(x) - f(a)}{x-a} = f'(s).
$$
Using induction to prove for $n > 0$. Suppose $n = k-1$ where $k \geq 1$ is an integer, then
$$
E_{k-1}(x) = \frac{f^{(k)}(s)}{k!}(x-a)^k,
$$
where $s$ is some number between $a$ and $x$. Consider the next higher case: $n=k$. Applying the [Generalized Mean-value theorem](differentation.md/#generalized-mean-value-theorem) to the functions $E_k(t)$ and $(t-a)^{k+1}$ on $[a,x]$. Since $E_k(a)=0$, a number $u$ in $(a,x)$ is obtained such that
$$
\frac{E_k(x) - E_k(a)}{(x-a^{k+1}) - (a-a)^{k+1}}= \frac{E_k(x)}{(x-a)^{k+1}} = \frac{E_k'(u)}{(k+1)(u - a)^k}.
$$
Since
$$
\begin{array}{ll}
E_k'(u)&=\frac{d}{dx}(f(x)-f(a)-f'(a)(x-a)-\frac{f''(a)}{2!}(t-a)^2-...-\frac{f^{(k)}(a)}{k!}(t-a)^k)|_{x=u} \\
&= f'(u) - f'(a) - f''(a)(u-a)-...-\frac{f^{(k)}(a)}{(k-1)!}(u-a)^{k-1}
\end{array}
$$
is just $E_{k-1}(u)$ for the function $f'$ instead of $f$. By the induction assumption it is equal to
$$
\frac{(f')^{(k)}(s)}{k!}(u-a)^k = \frac{f^{(k+1)}(s)}{k!}(u-a)^k
$$
for some $s$ between $a$ and $u$. Therefore,
$$
E_k(x) = \frac{f^{(k+1)}(s)}{(k+1)!}(x-a)^{k+1}
$$
## Big-O notation
$f(x) = O(u(x))$ for $x \to a$ if and only if there exists a $k > 0$ such that
$$
|f(x)| \leq k|u(x)|
$$
For all $x$ in the open interval around $x=a$.
The following properties follow from the definition:
1. If $f(x) = O(u(x))$ as $x \to a$, then $Cf(x) = O(u(x))$ as $x \to a$ for any value of the constant $C$.
2. If $f(x) = O(u(x))$ as $x \to a$ and $g(x) = O(u(x))$ as $x \to a$, then $f(x) \pm g(x) = O(u(x))$ as $x \to a$.
3. If $f(x) = O((x-a)^ku(x))$ as $x \to a$, then $\frac{f(x)}{(x-a)^k} = O(u(x))$ as $x \to a$ for any constant $k$.
If $f(x) = Q_n(x) + O((x-a)^{n+1})$ as $x \to a$, where $Q_n$ is a polynomial of degree at most $n$, then $Q_n(x) = P_n(x)$.
**Proof:** Follows from the properties of the big-O notation
Let $P_n$ be the Taylor polynomial, then properties 1 and 2 of big-O imply
that $R_n(x) = Q_n(x) - P_n(x) = O((x - a)^{n+1})$ as $x \to a$. It must be shown that $R_n(x)$ is identically zero so that $Q_n(x) = P_n(x)$ for all $x$. $R_n(x)$ may be written in the form
$$
R_n(x) = c_0 + c_1(x-a) + c_2(x-a)^2 + ... + c_n(x-a)^n
$$
If $R_n(x)$ is not identically zero, then there is a smallest coefficient $c_k$ $k \leq n$, such that $c_k \neq 0$, but $c_j = 0$ for $0 \leq j \leq k -1$
$$
R_n(x) = (x-a)^k(c_k + c_{k+1}(x-a) + ... + c_n(x-a)^{n-k}).
$$
Therefore,
$$
\lim_{x \to a} \frac{R_n(x)}{(x-a)^k} = c_k \neq 0.
$$
However, by property 3
$$
\frac{R_n(x)}{(x-a)^k} = O((x-a)^{n+1-k}).
$$
Since $n+1-k > 0$, $\frac{R_n(x)}{(x-a)^k} \to 0$ as $x \to a$. This contradiction shows that $R_n(x)$ must be
identically zero.
## Maclaurin formulas
Some Maclaurin formulas with errors in big-O notation. These may be used in constructing Taylor polynomials from compsite functions. As $x \to 0$
1. $$\frac{1}{1-x} = 1 + x + ... + x^n + O(x^{n+1}),$$
2. $$\ln(1+x) = x - \frac{x^2}{2} + \frac{x^3}{3} - ... + (-1)^{n-1}\frac{x^n}{n} + O(x^{n+1}),$$
3. $$e^x = 1 + x + \frac{x^2}{2!} + ... + \frac{x^n}{n!} + O(x^{n+1}),$$
4. $$\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - ... + (-1)^n\frac{x^{2n+1}}{(2n+1)!} + O(x^{2n+3}),$$
5. $$\cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - ... + (-1)^n\frac{x^{2n}}{(2n)!} + O(x^{2n+1}),$$
6. $$\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} - ... + (-1)^n\frac{x^{2n+1}}{2n+1} + O(x^{2n+3}).$$
### Example
Construct $P_4(x)$ for $f(x) = e^{\sin x}$ around $x=0$.
$$
e^{\sin x} \approx 1 + (x - \frac{x^3}{3!} + \frac{x^5}{5!}) + \frac{1}{2!}(x - \frac{x^3}{3!} + \frac{x^5}{5!})^2 + \frac{1}{3!}(x - \frac{x^3}{3!} + \frac{x^5}{5!})^3
$$
$$
\begin{array}{ll}
P_4(x) &= 1 + x \frac{1}{2}x^2 + (-\frac{1}{6} + \frac{1}{6})x^3 + (-\frac{1}{6} + \frac{1}{4!})x^4 + O(x^5), \\
&= 1 + x \frac{1}{2}x^2 - \frac{1}{8}x^4 + O(x^5).
\end{array}
$$
## Evaluating limits with Taylor polynomials
Taylor and Macluarin polynomials provide a method for evaluating limits of indeterminate forms.
### Example
Determine the limit $\lim_{x \to 0} \frac{x \arctan x - \ln(1+x^2)}{x \sin x - x^2}$.
$$
\begin{array}{ll}
x \sin x - x^2 \approx x^2 - \frac{x^4}{6} + O(x^6) - x^2 = - \frac{x^4}{6} + O(x^6) \\
x \arctan x - \ln(1+x^2) \approx x^2 - \frac{x^4}{3} + O(x^6) - x^2 + \frac{x^4}{2} + O(x^6) = \frac{x^4}{6} + O(x^6)
\end{array}
$$
$$
\lim_{x \to 0} \frac{\frac{x^4}{6} + O(x^6)}{- \frac{x^4}{6} + O(x^6)} = -1
$$
## L'Hostpital's rule
Suppose the function $f$ and $g$ are differentiable on the interval $(a,b)$, and $g'(x) \neq 0$ there. Also suppose that $\lim_{x \downarrow a} f(x) = \lim_{x \downarrow a} g(x) = 0$ then
$$
\lim_{x \downarrow a} \frac{f(x)}{g(x)} = \lim_{x \downarrow a} \frac{f'(x)}{g'(x)} = L.
$$
The outcome is exactly the same as using Taylor polynomials.
**Proof:** using Taylor polynomials around $x = a$.
$$
\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f(a) + f'(a)(x - a) + \frac{f''(a)}{2}(x-a)^2 + O((x-a)^3)}{g(a) + g'(a)(x-a) + \frac{g''(a)}{2}(x-a)^2 + O((x-a)^3)}.
$$
If $f(a)$ and $g(a)$ are both zero
$$
\lim_{x \to a} \frac{f'(a)(x - a) + \frac{f''(a)}{2}(x-a)^2 + O((x-a)^3)}{g'(a)(x-a) + \frac{g''(a)}{2}(x-a)^2 + O((x-a)^3)},
$$
enzovoort.