"optimal" big-O order for $\cos{x}-1+x^2 / 2$ I'm asked to find the optimal $k$ such that $\cos{x}-1+x^2/2=O(x^k)\quad (x\to 0)$.
By Taylor's theorem I know that $\cos{x}-1+x^2/2=(1/4!)\xi^4$ for some $\xi\in (0,x)$. So $0<\cos{x}-1+x^2/2<(1/4!)x^4$, that is $\cos{x}-1+x^2/2=O(x^4)$. 
My reasoning is as follows: if $0<x<1$ (which can be assumed since we're interested in $x\to 0$), we have $x^4<x^{4-\delta}$, so $x^{4-\delta}$ is not a 'better' order.
Next I try to see whether $\cos{x}-1+x^2/2=O(x^{4+\delta})$:
$$\frac{\cos{x}-1+x^2/2}{x^{4+\delta}}=\frac{1}{x^\delta}\frac{\cos{x}-1+x^2/2}{x^4}.$$ 
But by repeated application of L'Hôpital's, 
$$\lim_{x\to 0}\frac{\cos{x}-1+x^2/2}{x^4}=1/24,$$ 
so $\displaystyle\lim_{x\to 0} \frac{\cos{x}-1+x^2/2}{x^{4+\delta}}=\infty$.
This seems to show that $x^4$ is indeed the optimal order.
So is all that correct? Also, $1/24=1/4!$, so surely that's not a coincidence, but I don't see how to arrive at that limit in a different way (I don't know how that $\xi$ above depends on $x$).

Yes, that is all correct.
You're correct that $24=4!$ is not a coincidence here.  From Taylor's theorem you can derive a power series expansion for cosine,
$$\cos(x)=1-\frac{x^2}{2}+\frac{x^4}{4!}-\frac{x^6}{6!}+\cdots,$$ so that
$$\cos(x)-1+\frac{x^2}{2}=\frac{x^4}{4!}-\frac{x^6}{6!}+\cdots,$$ and
$$\frac{\cos(x)-1+\frac{x^2}{2}}{x^4}=\frac{1}{4!}-\frac{x^2}{6!}+\frac{x^4}{8!}-\cdots.$$  The series on the right-hand side of the the last equation is defined and continuous everywhere, and goes to $\frac{1}{4!}$ at $0$.
