<s>[INST] upper limit of $\cos (x^2)-\cos (x+1)^2$ is $2$ How to prove that upper limit of $\cos (x^2)-\cos (x+1)^2$ is $2$. 
Can anyone show proof of this?
 [/INST] Let's use the sum to product formula:
$$ \cos a + \cos b = \sin \tfrac{a+b}{2}\cos \tfrac{a-b}{2} $$
Hmm is that right?  I never remember the correct combinations of + and -  symbols. Let's see:
$$ \frac{1}{2} \left( e^{2\pi i \, \frac{a+b}{2}} - e^{-2\pi i \, \frac{a+b}{2}}\right) \times \frac{1}{2} \left( e^{2\pi i \, \frac{a-b}{2}} + e^{-2\pi i \, \frac{a-b}{2}}\right)$$
If I am lucky we re-group the terms and it comes out correct:
$$ \frac{1}{4} \left( e^{2\pi i \, a} + e^{-2\pi i \, a}\right) + 
   \frac{1}{4} \left( e^{2\pi i \, b} - e^{-2\pi i \, b}\right) 
$$
This is wrong... I have written $\frac{1}{2} \left(\cos a - \sin b \right)$, but you can imagine with the correct choice of signs we can get it to work. 
A quick look at SOS math gives:
$$ \boxed{ \cos a + \cos b = 2 \,\cos \frac{a+b}{2} \, \cos \frac{a-b}{2} } $$
even pros get it wrong :-)

Let's try to solve your problem now... Let $a = (x+1)^2$ and $b = x^2$.  Then:
$$ \cos (x+1)^2 - \cos x^2 = 2 \,\sin \left(x^2 + x + \frac{1}{2} \right) \, \sin \left( x + \frac{1}{2} \right) \leq 2$$
We know that $\boxed{\cos x \leq 1}$ always.  So our number is always less than $2$.  In fact, the $\limsup$ is $2$.  This boils down to solving for integers:
\begin{eqnarray*}
x + \frac{1}{2}&\approx& \frac{\pi}{2} + 2\pi n_1 \hspace{0.5in}\text{ with }n_1 \in \mathbb{Z}\\
x^2 + x + \frac{1}{2}&\approx& \frac{\pi}{2} + 2\pi n_2 \hspace{0.5in}\text{ with }n_2 \in \mathbb{Z}
\end{eqnarray*}
It may be surprising at first, how these questions about trigonometry turn into questions of diophantine approximation.  This system of equation is easy to solve let's substitute one equation into the other
$$ x^2 + \left(x + \frac{1}{2}\right)\approx 
x^2 + \left(\frac{\pi}{2} + 2\pi n_1 \right)\approx
\frac{\pi}{2} + 2\pi n_2  $$
This leads to $x \approx \sqrt{2\pi (n_2 - n_1)}= \sqrt{2\pi n_3}$ and yet $x \approx \left(\frac{\pi}{2} - \frac{1}{2} \right) + 2\pi n_1$ where we are looking mod $2\pi$.  
Remark I If I choose units correctly we can look mod $1$ and just igonore all the numbers before the decimal point looking only at the "cents"  $\pi = \color{red}{3}.14159 \mod 1 \equiv \color{green}{0}.14159$
Remark II Proving that $\sqrt{2\pi n}$ is equidistributed mod $1$ is clear since the numbers are getting closer and closer together
$$ \sqrt{n+1} - \sqrt{ n} \approx \frac{1}{\sqrt{n} + \sqrt{n+1}} \approx \frac{1}{2\sqrt{n}} $$
Using a computer we can plot this function and see that we have a chance at getting the numbers to be close:

Further analysis of the numbers appearing after the decimal point in $\sqrt{n}$ is extremely difficult.  Here, two Harvard professors duking it out over the gap distribution [1].
</s>