The general formula for the Taylor Series is as follows:

#sum_(n=0)^(N) f^((n))(a)/(n!)(x-a)^n#

with #f^((n))(a)# being the #n#th derivative of #f(x)# at #x->a#.

Thus, we have to take the derivative multiple times. You should also consider the following:

- #x->a#, but only for #f(a)#, not #(x-a)^n#.
- #n# varies, but #a# does not
- Usually, taking the derivatives first makes things easier the rest of the way through
- For this case, since we are working with #lim_(x->a) [cosx]^((n))# at #a = pi#, and some derivatives of #cosx# give some form of #sinx#, we can omit the odd terms due to the anticipation of #sinpi = 0#.

Let us go to #n = 4# (one might also say "truncate the series at #n = 4#").

#f^((0))(x) = color(green)(f(x) = cosx)#

#color(green)(f'(x) = -sinx)#

#color(green)(f''(x) = -cosx)#

#color(green)(f'''(x) = sinx)#

#color(green)(f''''(x) = cosx)#

Now, writing it out, we get:

#= (f(a))/(0!)(x-a)^0 + (f'(a))/(1!)(x-a)^1 + (f''(a))/(2!)(x-a)^2 + (f'''(a))/(3!)(x-a)^3 + (f''''(a))/(4!)(x-a)^4 + ...#

#= (cosa)/(0!)(x-a)^0 + (-sina)/(1!)(x-a)^1 + (-cosa)/(2!)(x-a)^2 + (sina)/(3!)(x-a)^3 + (cosa)/(4!)(x-a)^4#

#= cospi + (-sinpi)/(1!)(x-pi) + (-cospi)/(2!)(x-pi)^2 + (sinpi)/(3!)(x-pi)^3 + (cospi)/(4!)(x-pi)^4#

but #sinpi = 0#... so **the odd terms go away** (we talked about this!):

#= cospi + cancel((-sinpi)(x-pi)) + (-cospi)/(2)(x-pi)^2 + cancel((sinpi)/(6)(x-pi)^3) + (cospi)/(24)(x-pi)^4#

#= color(blue)(cospi - (cospi)/(2)(x-pi)^2 + (cospi)/(24)(x-pi)^4 - ...)#