The general formula for writing out a Taylor series is:

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

Note that according to this formula, you need to take the derivative of the function #n# times. Let's say #n = 4#.

#f^((0))(x) = f(x) = 5cospix#

#f'(x) = -5pisinpix#

#f''(x) = -5pi^2cospix#

#f'''(x) = 5pi^3sinpix#

#f''''(x) = 5pi^4cospix#

Thus, the truncated Taylor series can be written as:

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

#= 5cospia + (-5pisinpia)(x-1/2) + ((-5pi^2cospia)/(2))(x-1/2)^2 + ((5pi^3sinpia)/(6))(x-1/2)^3 + ((5pi^4cospia)/(24))(x-1/2)^4 + ...#

Notice how #cos(pi/2) = 0# and #sin(pi/2) = 1#:

#= cancel(5cos(pi/2)) - 5picancel(sin(pi/2))^(1)(x-1/2) -cancel((5pi^2cos(pi/2))/2(x-1/2)^2) + (5pi^3cancel(sin(pi/2))^(1))/(6)(x-1/2)^3 + cancel((5pi^4cos(pi/2))/24(x-1/2)^4) - ...#

As a result, this becomes a series with alternating signs and only odd terms (similarly, if you did this with #5sinpix#, you'd have alternating signs and only even terms).

#= color(blue)(-5pi(x-1/2) + (5pi^3)/(6)(x-1/2)^3 - ...)#

Just remember these things:

- Only the #x# in #f(x)# approaches #a#, *not* the one in #(x - a)^n#

- Plug in #a# *after* taking the derivative

- #a# does *not* vary, but #n# does