The answer would be here. But there is a trick to this.
Recall that for #a = 3#, since #x->a#, #a# is odd, and the derivative of #cos(pix)# will eventually give #sinapi# where #sin("odd"*pi) = sinpi = 0#.
So, since everything is multiplying in the Taylor series expansion within each individual #n#th term, you can ignore the odd derivative terms. Call them #0#. GREAT! Remember that.
Now, you will have to take #n# derivatives (except the odd ones). Thankfully #n->4#, only.
The series is written as:
#sum_(n=0)^4 f^n(a)/(n!)(x-a)^n#
Because the derivatives of #cosu# are, starting at the #0#th derivative and ending at the #4#th derivative (where the cycle restarts):
#{cosu, -sinu, -cosu, sinu, cosu, ...}((du)/(dx))^n#
...with #((du)/(dx))^n# from the Chain Rule on the factor of #pi#... you get:
#f^0(x) = color(blue)(f(x) = cospix)#
#cancel(color(blue)(f'(x)) = pi(-sinpix) color(blue)(= -pisinpix))^"0 at a = 3"#
#color(blue)(f''(x)) = pi^2(-cospix) color(blue)(= -pi^2cospix)#
#cancel(color(blue)(f'''(x)) = -pi^3(-sinpix) color(blue)(= pi^3sinpix))^"0 at a = 3"#
#color(blue)(f''''(x)) = pi^4(cospix) color(blue)(= pi^4cospix)#
Now, plug them into the equation, with #x = a# except for the #(x - a)#, varying #n# from #0# to #4# (inclusive), and nonvarying #a#:
#sum_(n=0)^4 f^n(a)/(n!)(x-a)^n#
By default:
#= f^0(3)/(0!)(x-3)^0 + (f'(3))/(1!)(x-3)^1 + (f''(3))/(2!)(x-3)^2 + (f'''(3))/(3!)(x-3)^3 + (f''''(3))/(4!)(x-3)^4 + ...#
Now plug in #f^n(a)#, #n#, and #a#:
#= (cos3pi)/(1)(1) + cancel((-pisin3pi)/(1)(x-3))^(0) + (-pi^2cos3pi)/(2)(x-3)^2 + cancel((pi^3sin3pi)/(6)(x-3)^3)^(0) + (pi^4cos3pi)/(24)(x-3)^4 + ...#
As you could see, the odd terms do indeed cancel! Simplify all the sign swaps, parentheses, #1#'s, etc.:
#= (cos3pi) - (pi^2cos3pi)/2(x-3)^2 + (pi^4cos3pi)/24(x-3)^4 + ...#
But #cos3pi = cospi = -1#, so:
#= (-1) - (-pi^2)/2(x-3)^2 + (-pi^4)/24(x-3)^4 + ...#
#color(blue)(= -1 + (pi^2)/2(x-3)^2 - (pi^4)/24(x-3)^4 + ...)#