It is instructive to compute the Taylor series for several of the elementary functions. We take up this task in the present section.
We compute the first few derivatives of f (x) = sin(x) :
f'(x) | = cos(x) | ||
f ^{(2)}(x) | = - sin(x) | ||
f ^{(3)}(x) | = - cos(x) | ||
f ^{(4)}(x) | = sin(x) |
At this point, we have arrived back at sin(x) , and the pattern will repeat itself. Evaluating the derivatives at 0 , we find that
f (0) | = 0 | ||
f'(0) | = 1 | ||
f ^{(2)}(0) | = 0 | ||
f ^{(3)}(0) | = - 1 | ||
f ^{(4)}(0) | = 0 |
and so on. This allows us to write down the first few terms of the Taylor series for f (x) = sin(x) at 0 :
x - + - + ^{ ... } |
Below, we plot the graph of sin(x) , together with the graphs of its Taylor polynomials p _{1}(x) , p _{3}(x) , and p _{5}(x) .
We can write the entire Taylor series as
x ^{2n+1} |
This series has infinite radius of convergence. Noting that | f ^{(n)}(x)|≤1 for all n≥ 0 (since f ^{(n)}(x) is equal to sin(x) , cos(x) , -sin(x) , or -cos(x) ), we get a bound on the remainder term:
| r _{n}(x)| = x ^{n} ≤| x|^{n} |
Since = 0 for all real numbers x , we have | r _{n}(x)| = 0 , so the Taylor series for f (x) = sin(x) converges to f (x) for all x .
The situation with g(x) = cos(x) is similar. The first few derivatives at 0 are
g(0) | = 1 | ||
g'(0) | = 0 | ||
g ^{(2)}(0) | = - 1 | ||
g ^{(3)}(0) | = 0 | ||
g ^{(4)}(0) | = 1 |
so the Taylor series at 0 looks like
1 - + - + ^{ ... } = x ^{2n} |
Again the radius of convergence is infinite, and the same estimate applies to the remainder term as for the sine function, so cos(x) coincides with the function represented by its Taylor series for all x .
The exponential function has perhaps the simplest Taylor series of all. If f (x) = e ^{x} , then f ^{(n)}(x) = e ^{x} for all n≥ 0 , so the Taylor series for f at 0 is just
1 + x + + + ^{ ... } = |
since e ^{0} = 1 . For any given x , the remainder term satisfies the inequality
| r _{n}(x)| = e ^{c} = e ^{c} |
for some c between 0 and x . Since c≤x implies e ^{c}≤e ^{x} , a constant, and = 0 , we once again have that | r _{n}(x)| = 0 , so the function defined by the Taylor series for f (x) = e ^{x} is equal to f (x) for all x .
This time, since log(0) is not defined, we choose instead to find the Taylor series for f (x) = log(x) at x = 1 . We compute the first few derivatives below:
f'(x) | = | ||
f ^{(2)}(x) | = - | ||
f ^{(3)}(x) | = | ||
f ^{(2)}(x) | = - |
Thus
f ^{(n)}(x) = (- 1)^{n-1} |
for n≥1 , so
f ^{(n)}(1) = (- 1)^{n-1}(n - 1)! |
and the Taylor series for f (x) = log(x) at x = 1 is
(x - 1) - + - + ^{ ... } = (- 1)^{n-1} |
In this case, it turns out that the series only converges (to the value log(x) ) for x in the interval (0, 2) , i.e. the radius of convergence is 1 . Letting y = x - 1 , we may write
log(1 + y) = y - + - + ^{ ... } |
for y in the interval (- 1, 1) .