# Find the Taylor series expansion of the following of the functions about the given point `x_0`: `f(x)=cos(x^2)`, `x_0=0`

txmedteach | Certified Educator

To solve this, you need to use one of the basic Taylor series, that for the cosine. The series is shown here:

`costheta = 1-theta^2/(2!)+theta^4/(4!)-... = sum_(n=0)^oo ((-1)^ntheta^(2n))/((2n)!)`

Because the above series in in terms of theta only, we could just simply replace it with `x^2`:

`cos(x^2) = 1-x^4/(2!) + x^8 / (4!) - x^12/(6!) + ...=sum_(n=0)^oo ((-1)^nx^(4n))/((2n)!)`

However, there is a more fundamental way to find the series, and it has to do with the definition of a Taylor series:

`f(x) = f(a) + (f'(a))/(1!)(x-a) + (f''(a))/(2!)(x-a)^2 + ... = sum_(n=0)^oo (f^((n))(a))/(n!)(x-a)^n`

Notice that if `a!=0`, then each extra term will therefore affect the coefficients of the terms of lesser degree. Thankfully, our case is where `a = 0`, so we do not need to worry about higher-order terms affecting our answer.

So, let's start finding terms for our series.

The first term is simply our function evaluated at 0:

`f(0) = cos(0) = 1`

Our Taylor series is now `f(x) = 1`

Let's find the second term. Start by calculating the derivative using the chain rule and evaluating at `x = a`.

`f'(x) = -2xsin(x^2)`

`f'(0) = 0`

Our Taylor series is now `f(x) = 1 + 0/(1!)x`

Let's now find the third term using the same method:

`f''(x) = -2sin(x^2) - 4x^2cos(x^2)`

`f''(0) = 0`

Our Taylor series is now `f(x) = 1 + 0/(1!) x + 0/(2!) x^2`

Fourth term:

`f'''(x) = -4xcos(x^2) - 8x cos(x^2)+8x^3sin(x^2)`

`f'''(x) = -12xcos(x^2) + 8x^3sin(x^2)`

`f'''(0) = 0`

Fifth term:

`f^((4))(x) = -12cos(x^2) + 24x^2sin(x^2) + 24x^2sin(x^2) + 16x^4cos(x^2)`

`f^((4))(x) = -12cos(x^2) + 48x^2sin(x^2)+16x^4cos(x^2)`

`f^((4))(0) = -12`

Our first nonzero term!

Our non-trivial Taylor series is now:

`f(x) = 1 + 0/(1!)x + 0/(2!)x^2 + 0/(3!)x^3 - 12/(4!)x^4`

Let's simplify:

`f(x) = 1 - 12/(4!)x^4`

`f(x) = 1- (4*3)/(4*3*2*1) x^4`

Notice that the first two terms in the factorial term cancel to give us the following result:

`f(x) = 1-1/(2*1) x^4`

Putting into factorial notation, we get the first two terms in the Taylor series we first calculated for this function based on the `costheta` template:

`f(x) = 1-x^4/(2!)`

If you were to continue calculating terms, you would find that the first Taylor series we calculated would be the correct one.

`f(x) = 1-x^4/(2!) + x^8/(4!) - ... = sum_(n=0)^oo ((-1)^nx^(4n))/(n!)`