The Student Room Group

What are Taylor Expansions?

I like this forum, people reply.

I've looked up Taylor's Series and stuff, and managed to gather something to do with it's used to approximate functions and the like.

Can someone explain to me how it works i.e. the maths behind it?
Reply 1
Original post by n00bfi
I like this forum, people reply.

I've looked up Taylor's Series and stuff, and managed to gather something to do with it's used to approximate functions and the like.

Can someone explain to me how it works i.e. the maths behind it?


Interesting animations here: http://en.wikipedia.org/wiki/Taylor_series
You're right, they're used to approximate functions. Here's how they work, with a simple example. Let's suppose we have the polynomial f(x)=a3x3+a2x2+a1x+a0f(x)=a_3x^3+a_2x^2+a_1x+a_0.

Now then, f(0)=a0f(0)=a_0. Futhermore, f(x)=3a3x2+2a2x+a1    f(0)=a1f'(x)=3a_3x^2+2a_2x+a_1 \implies f'(0)=a_1.

Similarly, you'll get f(0)=2a2f''(0)=2a_2 and f(0)=6a3f'''(0)=6a_3 (where the 2 and 6 appear as a consequence of the differentiation).

But, we can use these values, and the predictable fashion in which differentation causes the coefficients to change, to get back the polynomial. Differentiation makes the coefficient multiply by some factorial; the a3a_3 is infront the x3x^3, so it'll be multiplied by 3, then 2, and then 1, then it will be the constant term. So we 'undo' the differentiation on the coefficient by dividing by the factorial it would've been multiplied by:

f(x)=6a33!x3+2a22!x2+a11!x+a00!f(x) = \dfrac{6a_3}{3!}x^3 + \dfrac{2a_2}{2!}x^2 + \dfrac{a_1}{1!}x + \dfrac{a_0}{0!} where 0! =1 by convention. This is the polynomial we started with! If this seems a bit abstract, try an example with fixed coefficients, and you should see it working out easily.

Looking back at what the values on the top of the fractions are, we could write this as f(x)k=03f(k)(0)k!xkf(x) \displaystyle\sum_{k=0}^3 \dfrac{f^{(k)}(0)}{k!}x^k.

Now its beginning to look like a taylor series! This is the general idea, but n could be any finite number in practice. Be warned, for taylor series are.. not exactly great in some cases. Try to find the expansion of f(x)=e1x2f(x)=e^\frac{-1}{x^2} if you want to see how bad they can be!

I hope I've answered sufficiently to give you the idea, but if anything is unclear please ask away :smile:
(edited 10 years ago)
Reply 3
You write

f(x)=a0+a1(xa)+12!a2(xa)2+13!a3(xa)3+f(x) = a_0 +a_1 (x-a) + {1 \over 2!} a_2 (x-a)^2 + {1 \over 3!} a_3 (x-a)^3 + \dots

The coefficients a0,a1,a2a_0, a_1, a_2 \dots can be determined as follows: put x=ax=a and we get a0=f(a)a_0 = f(a), Differentiate both sides with respect to xx and then set x=ax=a, this implies that f(a)=a1f' (a) = a_1 where the ' denotes differentiation. Differentiating both sides twice and putting x=ax = a gives

f(a)=a2f'' (a) = a_2

etc.

If we compute the first nn terms we derive a finite polynomial Pn(x)P_n(x) approximation to f(x)f(x), then

f(x)=Pn(x)+Rn(x)f(x) = P_n (x) + R_n (x)

where Rn(x)R_n (x) is the remainder. The remainder can be shown to be given by

Rn(x)=f(n+1)(z)(n+1)!(xa)n+1R_n (x) = {f^{(n+1)} (z) \over (n+1)!} (x-a)^{n+1}

where f(n+1)f^{(n+1)} is the n+1n+1 derivative of ff and zz is some number between aa and xx.

There are some functions that can't be Taylor expanded around some point, for example f(x)=e1/x2f(x) = e^{-1/x^2} cant be expanded around x=0x = 0. Try it.
Reply 4
Original post by FireGarden
You're right, they're used to approximate functions. Here's how they work, with a simple example. Let's suppose we have the polynomial f(x)=a3x3+a2x2+a1x+a0f(x)=a_3x^3+a_2x^2+a_1x+a_0.

Now then, f(0)=a0f(0)=a_0. Futhermore, f(x)=3a3x2+2a2x+a1    f(0)=a1f'(x)=3a_3x^2+2a_2x+a_1 \implies f'(0)=a_1.

Similarly, you'll get f(0)=2a2f''(0)=2a_2 and f(0)=6a3f'''(0)=6a_3 (where the 2 and 6 appear as a consequence of the differentiation).

But, we can use these values, and the predictable fashion in which differentation causes the coefficients to change, to get back the polynomial. Differentiation makes the coefficient multiply by some factorial; the a3a_3 is infront the x3x^3, so it'll be multiplied by 3, then 2, and then 1, then it will be the constant term. So we 'undo' the differentiation on the coefficient by dividing by the factorial it would've been multiplied by:

f(x)=6a33!x3+2a22!x2+a11!x+a00!f(x) = \dfrac{6a_3}{3!}x^3 + \dfrac{2a_2}{2!}x^2 + \dfrac{a_1}{1!}x + \dfrac{a_0}{0!} where 0! =1 by convention. This is the polynomial we started with! If this seems a bit abstract, try an example with fixed coefficients, and you should see it working out easily.

Looking back at what the values on the top of the fractions are, we could write this as f(x)k=03f(k)(0)k!xkf(x) \displaystyle\sum_{k=0}^3 \dfrac{f^{(k)}(0)}{k!}x^k.

Now its beginning to look like a taylor series! This is the general idea, but n could be any finite number in practice. Be warned, for taylor series are.. not exactly great in some cases. Try to find the expansion of f(x)=ex2f(x)=e^{-x^2} if you want to see how bad they can be!

I hope I've answered sufficiently to give you the idea, but if anything is unclear please ask away :smile:



[br][br]Let;f(x)=ex2[br][br]f(x)=2xex2[br][br]f(x)=2ex2+4x2ex2[br][br]f(x)=4xex2+8xex28x3ex2[br][br]f(x)=4ex28x2ex2+8ex216x2ex224x2ex2+16x4ex2[br][br]f(0)=1[br][br]f(0)=0[br][br]f(0)=2[br][br]f(0)=0[br][br]f(0)=12[br][br]ex2=1x2+x42...[br][br][br][br][br]Let; f(x) = e^{-x^2}[br][br]f'(x) = -2xe^{-x^2}[br][br]f''(x) = -2e^{-x^2} + 4x^2e^{-x^2}[br][br]f'''(x) = 4xe^{-x^2} + 8xe^{-x^2} - 8x^3e^{-x^2}[br][br]f''''(x) = 4e^{-x^2} -8x^2e^{-x^2} + 8e^{-x^2} - 16x^2e^{-x^2} - 24x^2e^{-x^2} + 16x^4e^{-x^2}[br][br]f(0) = 1[br][br]f'(0) = 0[br][br]f''(0) = -2[br][br]f'''(0) = 0[br][br]f''''(0) = 12[br][br]e^{-x^2} = 1 -x^2 + \frac{x^4}{2} ...[br][br][br]
(edited 10 years ago)
Original post by Phichi
[br][br]Let;f(x)=ex2[br][br]f(x)=2xex2[br][br]f(x)=2ex2+4x2ex2[br][br]f(x)=4xex2+8xex28x3ex2[br][br]f(x)=4ex28x2ex2+8ex216x2ex224x2ex2+16x4ex2[br][br]f(0)=1[br][br]f(0)=0[br][br]f(0)=2[br][br]f(0)=0[br][br]f(0)=12[br][br]ex2=1x2+x42...[br][br][br][br]Let; f(x) = e^{-x^2}[br][br]f'(x) = -2xe^{-x^2}[br][br]f''(x) = -2e^{-x^2} + 4x^2e^{-x^2}[br][br]f'''(x) = 4xe^{-x^2} + 8xe^{-x^2} - 8x^3e^{-x^2}[br][br]f''''(x) = 4e^{-x^2} -8x^2e^{-x^2} + 8e^{-x^2} - 16x^2e^{-x^2} - 24x^2e^{-x^2} + 16x^4e^{-x^2}[br][br]f(0) = 1[br][br]f'(0) = 0[br][br]f''(0) = -2[br][br]f'''(0) = 0[br][br]f''''(0) = 12[br][br]e^{-x^2} = 1 -x^2 + \frac{x^4}{2} ...[br][br]


Hehe I realised my mistake and edited it!
Reply 6
Original post by Phichi
[br][br]Let;f(x)=ex2[br][br]f(x)=2xex2[br][br]f(x)=2ex2+4x2ex2[br][br]f(x)=4xex2+8xex28x3ex2[br][br]f(x)=4ex28x2ex2+8ex216x2ex224x2ex2+16x4ex2[br][br]f(0)=1[br][br]f(0)=0[br][br]f(0)=2[br][br]f(0)=0[br][br]f(0)=12[br][br]ex2=1x2+x42...[br][br][br][br][br]Let; f(x) = e^{-x^2}[br][br]f'(x) = -2xe^{-x^2}[br][br]f''(x) = -2e^{-x^2} + 4x^2e^{-x^2}[br][br]f'''(x) = 4xe^{-x^2} + 8xe^{-x^2} - 8x^3e^{-x^2}[br][br]f''''(x) = 4e^{-x^2} -8x^2e^{-x^2} + 8e^{-x^2} - 16x^2e^{-x^2} - 24x^2e^{-x^2} + 16x^4e^{-x^2}[br][br]f(0) = 1[br][br]f'(0) = 0[br][br]f''(0) = -2[br][br]f'''(0) = 0[br][br]f''''(0) = 12[br][br]e^{-x^2} = 1 -x^2 + \frac{x^4}{2} ...[br][br][br]


Or use the expansion for eye^y and then substitute y=x2y = -x^2.

Quick Reply

Latest