Need help understanding how to find Taylor polynomials

I, for the life of me, cannot figure out how Taylor polynomials/series work. Frankly, the material we were given to work with isn't very explanatory, and doesn't have examples that tell us what to do.

The questions are below. Using online programs, I was able to determine the final answers to the following. However, I'm unable to determine HOW to get to these answers. Also, the material does not contain anything relating to Big-Oh notation, so don't include that.

Find the Taylor polynomial $\displaystyle P_4$ for the function $\displaystyle f$

1) $\displaystyle f(x)=x-\cos x$

$\displaystyle Ans.=-1+x+\frac{x^2}{2}-\frac{x^4}{24}$

2) $\displaystyle f(x)=\sqrt{1+x}$

$\displaystyle Ans.=1+\frac{x}{2}-\frac{x^2}{8}+\frac{x^3}{16}-\frac{x^4}{128}$

3) $\displaystyle f(x)=\ln\cos x$

$\displaystyle Ans.=-\frac{x^2}{2}-\frac{x^4}{12}$

4) $\displaystyle f(x)=\sec x$

$\displaystyle Ans.=1+\frac{x^2}{2}+\frac{5x^4}{24}$

Any help in determining how to reach these answers would be appreciated, so I might have a chance at understanding how the process works.