Series to four terms, with an error bound (free preview) | StemPy Lab
Free previewCourse: Standard
Series to four terms, with an error bound
A short series replaces a function by a polynomial, and this lesson asks how good that is. For an alternating series with shrinking terms, the error is smaller than the first term left out. For ex a geometric sum bounds the rest. Series can be put inside series, as in esinx, and counting the lowest power before expanding tells you how many terms to keep.
This is the first lesson of Series, Parameters and First Principles: A Limits and Derivatives Deep Dive, free for everyone to read.
What you will be able to do
write four terms of the series of sinx, cosx, ex and ln(1+x);
say how large the error of a short series can be, and prove it;
expand a function of a function, such as esinx;
count the order of the top and the bottom before you expand.
Where we start
In the course on harder limits you replaced sinx by x−6x3 and found limits such as x3x−sinx→61. Two questions were left open. How many terms are enough? And how wrong is a short series at a real number such as x=0.2? A calculator must answer both, every time you press the sine key. Let us answer them too.
Four terms of each series
For x in radians, and close to 0:
sinx=x−6x3+120x5−5040x7+…
cosx=1−2x2+24x4−720x6+…
ex=1+x+2x2+6x3+…
ln(1+x)=x−2x2+3x3−4x4+…(−1<x≤1)
The numbers in the bottom are factorials: 3!=6, 5!=120, 7!=5040, 6!=720. The logarithm is different. Its bottoms are just 1,2,3,4, and it works only for −1<x≤1.
How wrong is a short series? The alternating bound
Look at the sine series at x=0.2. The terms are 0.2, then −0.001333, then +0.0000027, and so on. Their signs alternate. Each term is smaller than the one before, and they shrink to zero.
The alternating bound. Suppose the terms of a series alternate in sign, each is smaller in size than the one before, and they tend to 0. Stop after some term. Then the error is smaller in size than the first term you left out, and it has the same sign as that term.
Why is this true? Each new term goes back across the true value, by less than the step before. So the partial sums jump from one side of the true value to the other, closer each time. The true value always lies between two neighbouring partial sums, so the error is below the next step.
Example 1. Take two terms of the sine at x=0.2: 0.2−60.23=0.1986667. The first term left out is 1200.25=2.67×10−6. The true value is sin0.2=0.1986693, and the true error is 2.66×10−6. The bound is right, and close.
Example 2. Take three terms of the cosine at x=0.5: 1−0.125+0.0026042=0.8776042. The bound is 7200.56=2.17×10−5. The true error is cos0.5−0.8776042=−2.16×10−5. Its sign is minus, like the sign of the term we left out.
A graph for x from 0 to 1.2 radians. The blue curve is the true error when sin x is replaced by x minus x cubed over 6. The dashed red curve is the bound x to the fifth over 120. Both start at zero and rise slowly, then faster. The red bound stays just above the blue error everywhere, and the two are almost on top of each other for small x. At x = 1 the error is 0.0081 and the bound is 0.0083.
When does the bound apply? It needs the terms to shrink from the start. For the sine and the cosine that is true for 0<x≤1, and in fact a little beyond. For ln(1+x) it is true for 0<x≤1.
The exponential: a geometric bound
For x>0 every term of ex is positive, so the alternating bound does not apply. We bound the rest by a geometric series instead. Stop after the term in xn−1. The rest is
R=n!xnB,
where the bracket B is
B=1+n+1x+(n+1)(n+2)x2+…
Each bracket term is at most (n+1x)k, because n+2, n+3 and so on are all at least n+1. The bracket is therefore below the geometric sum 1−x/(n+1)1, when x<n+1. So
0<R<n!xn⋅n+1−xn+1.
Example 3. Four terms at x=0.5 give 1+0.5+0.125+0.0208333=1.6458333. The bound is 240.54⋅4.55=0.0028935. The true error is e0.5−1.6458333=0.0028879, just below the bound.
A-Level Further Maths and the first year of university meet another bound, the Lagrange form of the remainder. It needs the Mean Value Theorem from the Class 12 chapter. The geometric bound needs only a sum of a geometric series, from the Class 11 chapter on sequences.
Series inside series
A function of a function has a series too. Put one series inside the other and keep only the powers you need.
Example 4: esinx. Let u=sinx=x−6x3+… Then eu=1+u+2u2+6u3+24u4+… Collect the powers of x one at a time.
Power x: only u gives one: x.
Power x2: only 2u2 gives one: 2x2.
Power x3:−6x3 from u, and +6x3 from 6u3. They cancel.
Power x4:2u2 gives 21(−62x4)=−6x4, and 24u4 gives 24x4. The total is −8x4.
So esinx=1+x+2x2−8x4+…, and x→0limx4esinx−1−x−2x2=−81.
Example 5: (1+x)1/x near 0. Write it as eln(1+x)/x. The exponent is 1−2x+3x2−… So (1+x)1/x=e⋅ev with v=−2x+3x2. Then ev=1+v+2v2=1−2x+3x2+8x2+… The x2 part is 248+3=2411. So
(1+x)1/x=e(1−2x+2411x2−…).
This gives x→0limx2(1+x)1/x−e+2ex=2411e.
Count the order before you expand
How many terms should you keep? Find the lowest power of x in the bottom first. Then expand the top only that far.
The order of an expression near 0 is its lowest power of x with a non-zero number in front. For example, 1−cosx has order 2, and x−sinx has order 3.
In a product, the orders add. In a quotient, they subtract.
Example 6.x→0limx5(x−sinx)(1−cosx). The top has order 3+2=5, the same as the bottom. Its x5 part is 61⋅21=121, so the limit is 121. You never needed more than one term of each bracket.
Example 7, a surprise.tan(sinx) and sin(tanx) agree in the terms x, x3 and x5. Their difference starts at x7: x→0limx7tan(sinx)−sin(tanx)=301. L'Hôpital's rule would need seven rounds of differentiation here. A computer algebra program does the series in a moment, and so can you, with patience.
Practise with new numbers
Try it in Python
The program replaces sinx by two terms, x−6x3, at four points. It prints the true error beside the alternating bound 120x5.
Common mistakes
Using the alternating bound for ex with x>0. Its terms do not alternate. Use the geometric bound.
Forgetting that the logarithm series stops working.ln(1+x) needs −1<x≤1. For ln3, write ln3=ln4+ln0.75 or use another trick.
Dropping a cross term. In esinx, the x4 term comes from 2u2 as well as from 24u4.
Expanding too little. If the bottom has order 5, every bracket on top must be carried to its own share of x5.
Alternating series with shrinking terms: the error is below the first term left out, with its sign.
For ex stopped before xn: the rest is below n!xn⋅n+1−xn+1 when 0<x<n+1.
Orders add in a product. Expand each part only as far as the bottom needs.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
How many terms of the sine series are needed at x=1 so that the alternating bound is below 0.0001?
Ravi uses 1+x+2x2 for e0.1. Give the geometric bound on his error.
Find the first two non-zero terms of ln(1+sinx).
What is the order of (ex−1−x)sin2x near 0, and what is the number in front of that power?
Asha takes two terms of the logarithm series at x=1 and writes ln2≈1−21=0.5. She says the error is below 31. Is she right? Why is this a slow way to find ln2?
References
OpenStax, Calculus Volume 2, section 5.5 on alternating series and the remainder estimate, and section 6.3 on Taylor and Maclaurin series.
NCERT, Mathematics Textbook for Class XI, the chapter on sequences and series, for the sum of a geometric series.
Liked this lesson? There is more
Series, Parameters and First Principles: A Limits and Derivatives Deep Dive is a Standard course. It adds 2 more lessons, practice and tests on top of the free chapter.
12Problems2Python Labs1Question Set1Mock Test
Limits beyond L'Hôpital: loops, parameters and sums: L'Hôpital's rule can go round in circles, stay silent, or make a limit look worse, and then algebra or a substitution finishes the job. A limit with unknown numbers exists only when the lower terms of the top vanish: setting them to zero gives the numbers. Sums with the greatest integer are squeezed by
t−1<[t]≤t
, and some products telescope.
First principles at corners, jumps and in equations: The derivative at a point is the limit of the difference quotient. A corner or a jump shows up when the limits from the right and from the left differ. A product ∣x−a∣φ(x) is smooth at a exactly when φ(a)=0. Functional equations such as f(x+y)=f(x)+f(y) give their derivative straight from the definition.