
The Taylor Series: Polynomials That Copy a Curve#
A calculator finds $\sin 0.5$ without a stored table of angles. It adds a short list of powers of $0.5$. That list is a Taylor polynomial. At one chosen input, the polynomial matches the function’s height, its slope, and the way that slope bends. More powers make the match closer.
The input where the match is forced is the center. Every graph in this article uses the center $0$.
Functions, Equations, and Their Shapes shows what a line, a parabola, and a wave look like. Opening a Power: Where the Coefficients Come From finds the numbers in front of a power when the exponent is a positive integer. This article builds those numbers from the function itself.
1. Height, slope, and bend#
Take $e^x$, the exponential curve. At $x = 0$ its height is $1$. Its slope at every point equals its height, so the slope at $0$ is also $1$. The bend is the rate at which that slope changes. The slope equals the height, so the bend is $e^x$ again, and the bend at $0$ is $1$.
Three short polynomials use those facts.
The constant $y = 1$ matches the height only.
The line $y = 1 + x$ matches the height and the slope.
The parabola $y = 1 + x + \frac{x^2}{2}$ matches the height, the slope, and the bend. The $2$ in the denominator is the count from §2.
The highest power in a polynomial is its degree. The next polynomial keeps every match made so far and adds powers through $x^6$, so its degree is $6$:
\[ 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24} + \frac{x^5}{120} + \frac{x^6}{720} \]Every curve passes through the point $(0, 1)$. Away from $0$ they separate, until enough powers are kept. The violet polynomial stops at $x^6$. At $x = 2$ it reads about $7.356$, and $e^2$ is about $7.389$. The gap is about $0.03$, too small to see on this scale.
The dashed line is flat. The blue line has the right slope at $0$ and then stays straight, while $e^x$ bends up. The teal curve has the right bend at $0$ and still falls behind by $x = 2$: it reads $5$, and $e^2$ is about $7.389$.
2. The recipe#
Write a polynomial in powers of $x$:
\[ p(x) = c_0 + c_1 x + c_2 x^2 + c_3 x^3 + \cdots \]Choose each coefficient so that $p$ and the function $f$ share a height at $0$, then the slope, then each later rate of change.
At $x = 0$, $p(0) = c_0$. Match the height: $c_0 = f(0)$.
The derivative of a function is its slope. The derivative of $c_1 x$ is $c_1$. Every higher power still contains a factor $x$, so those terms add nothing to the slope at $0$. The slope of $p$ at $0$ is $c_1$. Match the function: $c_1 = f’(0)$. The mark $f’(0)$ means the slope of $f$ at $0$.
Differentiate again. The derivative of the slope is the bend. The second derivative of $c_2 x^2$ is $2c_2$. Higher powers still contribute $0$ at $x = 0$. So $2c_2 = f’’(0)$, and $c_2 = f’’(0)/2$. The mark $f’’(0)$ means the bend at $0$. That is the $2$ under $x^2$ in §1.
One more step fixes the pattern. The third derivative of $c_3 x^3$ is $3 \times 2 \times 1 \times c_3 = 6c_3$. So $c_3 = f’’’(0)/6$. The number $6$ is $3!$, read “three factorial.” In general $n!$ means $n \times (n-1) \times \cdots \times 1$, and $0! = 1$.
Differentiating $x^n$ brings down $n$, then $n-1$, and so on. After $n$ steps the count in front is $n!$. Dividing by $n!$ leaves the derivative itself as the coefficient.
The series at center $0$ is
\[ f(x) = f(0) + f'(0)\, x + \frac{f''(0)}{2!} x^2 + \frac{f'''(0)}{3!} x^3 + \cdots \]The term that carries $x^n$ is the $n$th derivative at $0$, times $x^n$, divided by $n!$.
The same match at a different center $a$ uses powers of $(x - a)$, and reads every derivative at $a$:
\[ f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \frac{f'''(a)}{3!}(x-a)^3 + \cdots \]This list is the Taylor series of $f$ at $a$. When $a = 0$ the two lists are the same, and the series is also called a Maclaurin series. A sum that stops after a chosen power is a Taylor polynomial. The graphs here are Taylor polynomials at $0$.
3. The number e#
Every derivative of $e^x$ is $e^x$ again. At $0$, every one of them equals $1$. Every coefficient is $1$ divided by a factorial.
\[ e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots \]The violet curve in §1 is this list stopped at $x^6$.
Set $x = 1$. Then $e^1 = e$:
\[ e = 1 + 1 + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} + \frac{1}{120} + \frac{1}{720} + \cdots \]| Last power kept | Sum | Still short of e |
|---|---|---|
| constant 1 | 1 | 1.718282 |
| x | 2 | 0.718282 |
| x²/2 | 2.5 | 0.218282 |
| x³/6 | 2.666667 | 0.051615 |
| x⁴/24 | 2.708333 | 0.009948 |
| x⁶/720 | 2.718056 | 0.000226 |
| x¹⁰ / 3,628,800 | 2.718282 | 0.000000027 |
The number $e$ is about $2.718281828$. The sum through $x^{10}$ agrees with $e$ through the first eight digits.
A larger input needs more powers. $e^3$ is about $20.0855$. The sum through $x^5$ is $18.4$. Through $x^{10}$ it is about $20.080$, still short by about $0.006$. Through $x^{15}$ the gap is a few millionths. The factorial still overtakes $x^n$. It overtakes later when $|x|$ is larger. For $e^x$, sine, and cosine, that overtaking happens for every fixed real $x$, so the series equals the function everywhere on the number line.
4. Sine and cosine#
Sine and cosine are the wave functions in Six Trigonometric Functions — One Diagram. On the unit circle, sine is the vertical coordinate and cosine is the horizontal coordinate.
The angle in these series is in radians. One radian is the angle that cuts an arc as long as the radius. A full turn is $2\pi$ radians, about $6.2832$, not $360$ degrees. In degrees, the slope of sine at $0$ is not $1$, and the series below do not hold.
Two slope facts, true in radians, build both series. The slope of $\sin x$ is $\cos x$. The slope of $\cos x$ is $-\sin x$.
Start from sine at $0$. The height $\sin 0$ is $0$. The slope is $\cos 0 = 1$. The bend is the slope of that slope, so it is $-\sin x$, and the bend at $0$ is $0$. The next derivative is $-\cos x$, which equals $-1$ at $0$. Then the values repeat: $0$, $1$, $0$, $-1$.
The even steps are $0$ at $x = 0$, so the even powers are absent. Sine is an odd function, $\sin(-x) = -\sin x$, and an odd function is built from odd powers. The two facts agree.
\[ \sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \]\[ \cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots \]The orange line is the first term, $y = x$. It is the tangent line at $0$. For a small angle in radians, sine is close to the angle itself. At $0.1$ radians the line says $0.1$, and $\sin 0.1$ is about $0.099833$. The next term, $-x^3/6$, is about $-0.000167$ and closes almost all of that gap.
The blue curve stops at $x^5$. It follows the wave near $0$, then runs off. The teal curve stops at $x^9$ and stays with the wave out to about $\pi$, then leaves. The violet curve stops at $x^{17}$. From $-2\pi$ to $2\pi$ it sits on the sine wave. At $x = 2\pi$ the gap is about $0.011$.
A polynomial does not repeat. Sine does, every $2\pi$. Past this window the violet curve leaves as well. More terms follow the wave farther. A calculator does not add terms until a large angle is copied. It folds the angle into a short range, then uses a short polynomial. §8 is that fold.
The same list, term by term, gives a value. Here $x = 0.5$ radians, about $28.65$ degrees. $\sin 0.5$ is about $0.47942554$.
| Last power kept | Sum | Difference from sin 0.5 |
|---|---|---|
| x | 0.5 | 0.020574 |
| x³ | 0.47916667 | 0.000259 |
| x⁵ | 0.47942708 | 0.000001545 |
| x⁷ | 0.47942553 | 0.000000005 |
The signs alternate, and the terms shrink from the start. For this series, once the terms are shrinking, the difference is smaller than the first term you leave out. After $x^3$ the next term is about $0.000260$, and the difference is $0.000259$. After $x^5$ the next term is about $0.00000155$, and the difference is $0.000001545$.
5. A series for pi#
The angle whose tangent is $1$ is $\pi/4$ radians, half of a right angle. Tangent is sine divided by cosine. The inverse, written $\arctan x$, is the angle in radians whose tangent equals $x$.
The recipe at $0$ gives
\[ \arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + \cdots \]The first derivative of $\arctan x$ is $1/(1+x^2)$. At $0$ that derivative equals $1$, so the first term is $x$. The second derivative is $0$ at $0$. The third derivative is $-2$ at $0$, and $-2/3! = -1/3$, which is the next term. Later odd powers follow the same pattern. The sign alternates. In the written series the denominator is the power itself. The factorial from the recipe cancels a factorial hidden in the derivative, and that cancellation repeats at each later odd power.
The series equals $\arctan x$ for every $x$ from $-1$ to $1$, ends included. At $x = 1$,
\[ \frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots \]\[ \pi = 4\left(1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots\right) \]The terms shrink slowly. Ten terms give about $3.042$, which differs from $\pi$ by about $0.100$. One hundred terms give about $3.132$, off by about $0.010$. One thousand terms give about $3.141$, off by about $0.001$. The series is equal to $\pi$. It is a slow way to get digits.
A faster route uses the same series at small inputs, where powers shrink quickly. An identity published by John Machin in 1706 is
\[ \pi = 16\arctan\frac{1}{5} - 4\arctan\frac{1}{239} \]Two terms of $\arctan(1/5)$, and the first term of $\arctan(1/239)$, already show the arithmetic. Since $(1/5)^3/3 = 1/375$,
\[ 16\left(\frac{1}{5} - \frac{1}{375}\right) - \frac{4}{239} \approx 3.140597 \]That estimate differs from $\pi$ by about $0.001$, the accuracy that a thousand terms of the slow series reached. Four terms in each arctan series give about $3.14159177$, short of $\pi$ by less than one millionth.
6. Where the copy stops#
For $e^x$, $\sin x$, and $\cos x$, the series equals the function at every real $x$. Other functions have a wall.
\[ \frac{1}{1-x} = 1 + x + x^2 + x^3 + \cdots \]This is the Taylor series of $1/(1-x)$ at $0$. A finite piece has an exact product:
\[ (1-x)\left(1 + x + x^2 + \cdots + x^n\right) = 1 - x^{n+1} \]The polynomial sum is $(1 - x^{n+1})/(1-x)$. When $-1 < x < 1$, the power $x^{n+1}$ goes to $0$ as $n$ grows, and the sum goes to $1/(1-x)$. When $|x| > 1$, that power grows, and the polynomial leaves the function. At $x = 1$ the function $1/(1-x)$ is undefined. At $x = -1$ the function equals $1/2$, but the terms are $1, -1, 1, -1, \ldots$ and do not settle.
The heavy curve is drawn in two pieces because it breaks at $x = 1$. Between $-1$ and $1$, higher polynomials pull onto that curve. As $x$ approaches $1$ from the left, the curve climbs without a bound. On the right of the dashed line the function is negative. The polynomials are built from powers that fit the curve on the left of the line, and on the right they run off upward.
At $x = 2$ the function equals $-1$. The polynomials give $1$, then $1+2 = 3$, then $1+2+4 = 7$, then $1+2+4+8 = 15$, and so on. Each new power makes the miss larger. At $x = 1/2$ the function equals $2$, and the same polynomials move toward $2$: $1$, $1.5$, $1.75$, $1.875$.
7. A root, and a power that stops#
Opening a Power: Where the Coefficients Come From expands $(x+y)^n$ when $n$ is a positive integer. The list stops.
The Taylor recipe gives those same coefficients, and it keeps going when the power is not a positive integer. For $-1 < x < 1$,
\[ (1+x)^a = 1 + ax + \frac{a(a-1)}{2!}x^2 + \frac{a(a-1)(a-2)}{3!}x^3 + \cdots \]If $a$ is a positive integer, the product $a(a-1)(a-2)\cdots$ hits $0$, and every later term is $0$. The stopped list is the binomial expansion of $(1+x)^a$. For $a = 4$, the coefficient of $x^2$ is $4 \times 3 / 2 = 6$, the same count as $\binom{4}{2}$ in that article.
If $a = 1/2$, the product never hits $0$. The list is the series for the square root:
\[ \sqrt{1+x} = 1 + \frac{1}{2}x - \frac{1}{8}x^2 + \frac{1}{16}x^3 - \cdots \]It copies the root for $-1 < x < 1$. Take $x = 0.21$. Then $\sqrt{1.21} = 1.1$.
The constant $1$ differs from the root by $0.1$. Adding $x/2 = 0.105$ gives $1.105$, which overshoots by $0.005$. Subtracting $x^2/8 = 0.0055125$ gives $1.0994875$, short by about $0.000513$. Adding $x^3/16 \approx 0.000579$ gives about $1.100066$, over the root by about $0.000066$. The corrections alternate, and they shrink.
8. What a calculator keeps#
The series is a method. The stored object is a short list of operations.
For sine, the angle is converted to radians. Sine repeats every $2\pi$, and $\sin(\pi - x) = \sin x$, so any angle can be folded into the range from $0$ to $\pi/2$. Cosine reduces to that same range. The polynomial then sees a small input, where a few powers are enough. The table in §4 is that situation. At $0.5$ radians, the term in $x^5$ leaves a difference of about $0.000002$.
For $e^x$, the series at $0$ is enough. More powers are kept when $|x|$ is large, as the sums for $e^3$ in §3 show. One saving is to compute a careful value of $e$ and use it for the whole-number part of the input, then use the series only on a fractional part between $0$ and $1$.
The first step of the recipe is used on its own all over applied mathematics. The line
\[ y = f(a) + f'(a)(x-a) \]is the tangent line at $x = a$. It is the Taylor polynomial of degree $1$. In a small step away from $a$, the function moves like that line. The next power corrects the bend.
For the functions in this article, inside the intervals named above, adding terms closes the gap. The practical test is the next term. When it is much smaller than the last term you kept, and the terms are shrinking, the polynomial has settled for that input. When the terms are growing, either the input is outside the interval where the series copies the function, or a large input still needs more powers.
Hashtags#
#TaylorSeries #MaclaurinSeries #PowerSeries #Polynomials #SineAndCosine #Exponential #Pi #BinomialTheorem #Approximation #Mathematics #MathForML #Calculus

Comments: