<s>[INST] What is $\lim_{x\to0} \frac{(\cos x + \cos 2x + \dots+ \cos nx - n)}{\sin x^2}$? What is the limit of $$\lim_{x\to0} \frac{\cos x + \cos 2x + \dots+ \cos nx - n}{\sin x^2}$$
 [/INST] We have by taylor series
$$\cos(kx)\sim_0 1-\frac{k^2}{2}x^2$$
and
$$\sin x^2\sim_0 x^2$$
hence
 $$\lim_{x\to0} \frac{(\cos x + \cos 2x + ...+ \cos nx - n)}{\sin x^2}= -\frac{1}{2}\sum_{k=1}^n k^2=-\frac{n(n+1)(2n+1)}{12}$$
</s>