The Maclaurin series of #f(x)=cosx# is
#f(x)=sum_{n=0}^infty (-1)^nx^{2n}/{(2n)!}#.
Let us look at some details.
The Maclaurin series for #f(x)# in general can be found by
#f(x)=sum_{n=0}^infty {f^{(n)}(0)}/{n!}x^n#
Let us find the Maclaurin series for #f(x)=cosx#.
By taking the derivatives,
#f(x)=cosx Rightarrow f(0)=cos(0)=1#
#f'(x)=-sinx Rightarrow f'(0)=-sin(0)=0#
#f''(x)=-cosx Rightarrow f''(0)=-cos(0)=-1#
#f'''(x)=sinx Rightarrow f'''(0)=sin(0)=0#
#f^{(4)}(x)=cosx Rightarrow f^{(4)}(0)=cos(0)=1#
Since #f(x)=f^{(4)}(x)#, the cycle of #{1,0,-1,0}# repeats itself.
So, we have the series
#f(x)=1-{x^2}/{2!}+x^4/{4!}-cdots=sum_{n=0}^infty(-1)^n x^{2n}/{(2n)!}#