# Taylor Series

In first year calculus, we learn three ways of doing approximations: linear approximation, quadratic approximation and Taylor Series. Many students believed they are three different topics (and they are taught as three different topics in many classes) but the underlying ideas are very similar.

## Definition

The Taylor series of a real or complex number function ƒ(x) that is infinitely differentiable in a neighbourhood of a real or complex a, is the power series

${\displaystyle f(a)+{\frac {f'(a)}{1!}}(x-a)+{\frac {f''(a)}{2!}}(x-a)^{2}+{\frac {f^{(3)}(a)}{3!}}(x-a)^{3}+\cdots }$

which in a more compact form can be written as

${\displaystyle \sum _{n=0}^{\infty }{\frac {f^{(n)}(a)}{n!}}\,(x-a)^{n}}$

where n! denotes the factorial of n and ƒ (n)(a) denotes the nth derivative of ƒ evaluated at the point a; the zeroth derivative of ƒ is defined to be ƒ itself and (xa)0 and 0! are both defined to be 1.

In the particular case where a = 0, the series is also called a Maclaurin series.

#### Linear Approximation

Linear approximation uses a straight line (a constant first derivative) to approximate an unknown function. [Wiki page on linear approximation] The formula for linear approximation is f(x) = f(a) + f'(a) (x - a)

• Q: Using linear approximation, find the value of sin 61 degrees, given sin 60 degrees = square root 3 / 2, cos 60 degrees = 1/2 and 1 degree is approximately 0.01745 radians.
• A: We just need to find the elements in the linear equation formula. We set a = 60, x = 61, and f(x) = sin x. Then, f(a) = sin 60 = sqrt(3)/2, f'(x) = cos x, and so f'(a) = cos 60 = 1/2. Now, sin61 = sin60 + cos60 rad(61-60) = sqrt(3)/2 + 1/2 (0.01745). Note that we have to convert the degree to radian in the answer.
• Q: Use linear approximation to show that the each function below can be approximated by the given

expression when |x| is small (i.e. when x is close to 0). (a) sinx ~ x; (b) ex ~ 1 + x; (c) ln(1 + x) ~ x

We'll start with part (b). If we want to use linear approx to approx ex, what we want to do is to find the elements in its formula. We set a = 0 because we want |x| small, and f(x), of course, is ex. So f(a) = f(0) = e0 = 1, and f'(x) = ex, meaning f'(a) = 1. The linear approx formula is f(x) = 1 + 1(x - 0) = 1 + x. Done.

let's try part (c). Again, a = 0, f(x) = ln(1 + x), so f'(x) = 1/(1 + x), f'(a) = 1/(1 + 0) = 1; f(a) = 0. Now f(x) = 0 + 1(x - 0) = x. Done.

### Newton's method

The formula for linear approximation is f(x) = f(a) + f'(a) (x - a). It is intended to be use to find f(x) given information at a. However, we can also use it to find the root of an equation, x, if we set f(x) = 0 and do some algebra: 0 = f(a) + f'(a) (x - a) --> x = a - f(a)/f'(a). This is essentially the formula for Newton's method, which is written in the form x2 = x1 - f(x1)/f'(x1) to emphasize its iterative nature.

• Q: Find the roots for each of the following cubic equations using Newton’s method:

f(x) = x3 + 3x − 1 = 0

*A: With Newton's method. we can start with "any" random initial guess to arrive at the answer. However, we can narrow down the range of the answer and save a few steps of the iteration by using Intermediate Value Theorem.

If we put x = 0, f(x) = -1; if we put x = 1, f(x) = 5. By IVT, we know that this continuous function must have a root between x = 0 and x = 1, so we can start Newton's method with initial guess of x = 0, x = 1, or x = 1/2 (again, it doesn't matter because any random guess will work).

• Q: Find the intersection of y1 = e-x and y2 = ln(x).
• A: Use Newton's method to solve f(x) = e-x - ln(x). Solvable if x = 1.5, not solvable for x = 1.3.
• Q: Find, correct to 5 decimal places the x coordinate of the point on the curve y=ln(x) which is closest to the origin. use the newton method.
• A: For any point A = (x, y), its distance to the origin is D = (x2 + y2)^(1/2). We know the point A is on y = ln x, so distance from A to the origin is (x2 + (ln x)2)1/2. To find the closest point, we minimize the distance. Note that since minimizing the distance is the same as minimizing the square of a distance, so we will minimize D2 = x2 + (lnx)2 by differentiation. We get D' = 2x + 2/x lnx = 0. Then we use Newton's method to solve for x. For Newton's method, f(x) = 2x + 2/x lnx, and f'(x) = 2 + (2 - 2lnx)/x2.

Quadratic approximation uses a parabola (a constant second derivative, and a linear first derivative) to approximate an unknown function. The formula is f(x) = f(a) + f'(a) (x-a) + f"(a)/2 (x-a)2.

#### Taylor series

${\displaystyle y=23x+x2}$

The formula of Taylor series is $f(x) = f(a) + f'(a) (x-a) + f"(a)/2! (x-a)2 + f'"(a)/3! (x - a)3 + ...$

If we just look at the first two terms, a Taylor series is equivalent to a linear approximation; similarly, the first three terms of the Taylor series is equivalent to a quadratic approximation.

In other words, linear approximation is the first order Taylor polynomial, and quadratic approximation is the second order Taylor polynomial, and their respective error terms are 1/2! |M_2|(x-a)2 and 1/3! |M_3|(x-a)3, where M_i is the maximum of the i-th derivative of the function in the relevant interval.

#### Taylor's Inequality

Let Tn(x) be the nth-degree Taylor polynomial for f(x) at a, and let Rn(b)=f(b)-Tn(b) , be the remainder at x = b ,. Then: |Rn(b)|<(M*|b-a|^n+1)/(n+1)! Where M is the maximum value of f n+1 (x) on [a,b]

(a) Approximate sqrt(x) by a Taylor polynomial of degree 2 at a=4.

(b) Use this polynomial to approximate sqrt(4.1).

(c) Use Taylor's inequality to estimate the error in this approximation.