Prove that $\sum_{n=1}^\infty \int_{-\infty}^\infty\cos(n^2x)I(x)dx$ converges absolutely. 
Let $I$ be a measurable subset of $\mathbb R$. We define
  $$ I(x)=\int_I\frac{\chi_{(-1\le x-y\le 1)}}{1+y^2}dy. $$
  For $n\ge 1$ we define
  $$a_n=\int_{-\infty}^\infty\cos(n^2x)I(x)dx.$$
  Prove that $\sum_{n=1}^\infty a_n$ converges absolutely.


My attempt:
I know that $I(x)$ is a nonnegative bounded $L^1$ function on $\mathbb R$. In order to show that $\sum_{n=1}^\infty a_n$ converges absolutely, I tried to estimate the integral:
\begin{align}
\sum_{n=1}^\infty |a_n|&\le\sum_{n=1}^\infty\int_{-\infty}^\infty\left|\cos(n^2x)[\arctan(x+1)-\arctan(x-1)]\right|dx\\
\end{align}
However, I don't know how to proceed without sacrificing the term $\cos(n^2x)$. I have the intuition that $\arctan(x+1)-\arctan(x-1)$ goes to zero as $x$ goes to infinity. Meanwhile, $|\cos(n^2x)|$ should be magnified to something regarding $n$ from where we compare each term with a convergent series to conclude. But I am not sure how to carry it out explicitly. Any help? Thank you.

We need resort to oscillatory nature of the integrand. By Fubini's theorem1),
$$ a_n
= \int_{I}\int_{\mathbb{R}} \frac{\cos(n^2 x)\mathbf{1}_{\{\left|x-y\right|\leq 1\}}}{1+y^2}\,\mathrm{d}x\mathrm{d}y
= \int_{I} \frac{\sin(n^2(y+1)) - \sin(n^2(y-1))}{n^2(1+y^2)}\,\mathrm{d}y, $$
and so, $\left|a_n\right| \leq c/n^2$ for come constant $c > 0$. This is enough to conclude that $\sum_{n\geq 1} a_n$ converges absolutely.

1) Fubini's theorem is applicable because
$$ \int_{I}\int_{\mathbb{R}} \left| \frac{\cos(n^2 x)\mathbf{1}_{\{\left|x-y\right|\leq 1\}}}{1+y^2}\right| \,\mathrm{d}x\mathrm{d}y
\leq \int_{I}\int_{\mathbb{R}} \frac{\mathbf{1}_{\{\left|x-y\right|\leq 1\}}}{1+y^2} \,\mathrm{d}x\mathrm{d}y
\leq \int_{\mathbb{R}} \frac{2}{1+y^2} \, \mathrm{d}y = 2\pi < \infty. $$
