Taylor Series
The idea behind Taylor Series is that any well-behaving Function (e.g. Continuous Functions) can be represented as a sum of Polynomials
Taylor and Maclaurin Series
A Taylor Series of f(x) at x=0 is
- f(x)=∞∑k=0f(k)(0)k!xk
- where f(k)(0) is kth Derivative of f evaluated at x=0
- this kind of Taylor Series about x=0 is sometimes called Maclaurin Series
Taylor Series of f(x) at x=a is
- f(x)=∞∑k=0f(k)(a)k!(x−a)k
- this is the general form
Expansion as an Operator
Taylor Expansion is the process of turning a function to a Taylor Series
- can think of it as an operator that takes a function and returns a Series
-

Examples
Famous expansions:
Approximation
Taylor Series are used for approximations
Exponential
- as we add more terms, we are closer and closer to the function
-
(source: [1])
- order n approximation is shown with n dots
Trigonometric Functions:
-
(source: [2])
-
(source: [3])
- by taking only polynomials of odd (even) powers, we get cosines or sines
Approximation near the expansion point 0:
- Note that these approximations work best near 0
- It's clear from the sin/cos graphs - the more away from 0, need more terms
Computing Taylor Series
How to compute Taylor Series?
There are several ways of doing it
- This is the straightforward way:
- use the definitions and compute all the Derivatives
- if a function is complex, it may be hard
Substitution
Example: 1xsin(x2)
- hard to take derivatives
- but we know the expansion of sinx, so
- 1xsin(x2)=1x((x2)−13!(x2)3+15!(x2)5− ...)= ...
- ... =x−13!x5+15!x9− ...=∞∑k=0(−1)kx4k+1(2k+1)!
Combination
cos2x=cosx⋅cosx
- expand each one separately
- cosx⋅cosx=(1−12!x2+14!x4− ...)(1−12!x2+14!x4− ...)= ...
- ... =1⋅1+1(−12!x2)+1(14!x4)+ ... −12x2⋅1−12x2(−12!x2)−12x2(14!x4)− ... = ...
- ... =1−x2+13x4−245x6+ ...
- since cos2x=1−sin2x, we also obtained the expansion of sin2x!
Higher Order Terms
Instead of writing "..." can just say "HOT" meaning "Higher order terms":
- ex=1+x+12x2+13!x3+HOT
- we mean that we don't care what terms are there - it's fine to consider just leading terms for some purposes
- it can simplify our calculations
For example:
- f(x)=1−2xesin(x2)
- How can we Taylor Expand it?
- sin(x2)=x2−13!(x2)3+HOT=x2−13!x6+HOT
- esin(x2)=1+(x2−13!x6+HOT)+12!(x2−13!x6+HOT)2+13!(x2+HOT)3+HOT=1+x2+12x4+HOT
- so f(x)=1−2xesin(x2)=1−2x(1+x2+12x4+HOT)
To show what behavior HOTs have, we use Orders of Growth: the Big-O notation:
- ex11−x=(1+x+O(x2))⋅(1+x+O(x2))= ...
- ... =(1+x)2+2(1+x)O(x)+(O(x2))2=1+2x+O(x2)+O(x3)+O(x4)=1+2x+O(x2)
Series = adding an infinite number of terms
- it can be dangerous
- Problem: not all functions can be expressed as sum of Polynomial Functions, i.e. as f(x)=∑ckxk
for example, natural Logarithm:
-

- lnx is not even defined at x=0
- polynomials are too simple to capture all the complexity of lnx
Taylor Series has a convergence domain on which the series is well behaved
- for many functions, e.g. ex, sinx, cosx, sinhx, etc, the domain is R=(−∞,∞)
Within the domain of convergence you can do with series whatever you want:
- rearrange terms
- differentiate/integrate
- combine
For example, ln(1+x)
- ln(1+x)=∫11+xdx
- ln(1+x)=∫(∞∑k=0(−x)k)dx= ...
- can rearrange integral and sum:
- ... =∞∑k=0(∫(−x)kdx)= ...
- ... =∞∑k=0(−1)kxk+1k+1+C= ...
- C=0 because ln1=0, so we have
- ln(1+x)=∞∑k=1(−1)k+1xkk=x−12x2+13x3−14x4+ ...
- no factorials involved!
Convergence domain:
- we used Geometric Series here, so we must be in the domain of convergence of this series
- which is |x|<1
- Taylor Series approximates well only on the domain of convergence
-

- outside of the domain, we don't get better approximation when we add more terms!
Another example: arctanx
- arctanx=∫11+x2dx
- we also have a Geometric Series here, with −x2, so
- arctanx=∫11+x2dx=∫∞∑k=0(−x2)kdx= ...
- ... =∫∞∑k=0(−1)kx2kdx=∞∑k=0(∫(−1)kx2kdx)= ...
- ... =∞∑k=0(−1)k2k+1x2k+1+C
- C=0 because arctan0=0
- so arctanx=x−13x3+15x5−17x7+ ...
-

- the domain of convergence is also |x|<1
Expansion Points
- Maclaurin Series give good approximation at points near 0.
- But what if we want to have good approximations at some other points?
- In many applications 0 is not the most interesting point
Taylor Series of f(x) at x=a is
- f(x)=∞∑k=0f(k)(a)k!(x−a)k=f(a)+dfdx|a(x−a)+12!d2fdx2|a(x−a)2+13!d3fdx3|a(x−a)3+ ...
- this is polynomial in (x−a) instead of just x
Approximation
- The bigger |a−x| is, the more high-order terms we need to have good approximation
- Taylor Series converge only within the domain of convergence - so need to stay within the domain
Example:
- estimate √10
- √x expanded at x=a is √x=√a+12√a(x−a)−18√a3(x−a)2+HOT
- let's approximate it at a=1:
- √x=1+12(x−1)−18(x−1)2+HOT
- for x=10, we get ≈−4.122
- bad approximation! a=1 is far from x=10, so need more derivatives to approximate better
- let's consider a=9 (√9=3)
- √x=3+16(x−9)−1216(x−9)2≈−4.122
- for x=10 we get 3+1/6−1/216≈3.1620 (real is 3.1623)
- quite close!
- so it's important to select a which is close to the value x where you want to approximate f(x)
Taylor Expansion via Decomposition
Be careful with expansion points when doing Taylor Expansion via decomposition
Expand about the correct value!
For example, compute expansion for ecosx about x=0
- we have: 0→cos(⋅)→e(⋅)→
- first, we expand about 0
- but for e, we don't expand about 0 - we expand about cos0=1!
- cosx=1−12!x2+14!x4− ...
- eu=e+e(u−1)+12!e(u−1)2+ ...
Sources