TITLE: Qualifying problem for real analysis: limit involving definite integral
QUESTION [6 upvotes]: The following problem has appeared in 2013 January qualifying exam in Purdue University, which is publicly available here.

Problem 3. Let $\{a_k\}$ be sequence of positive numbers such that 
  $a_n\to\infty$ as $n\to\infty$. Prove that the following limit exists $$
 \lim_{k\to\infty}\int_{0}^{\infty} \frac{e^{-x}\cos(x)}{a_kx^2 +
\frac{1}{a_k}} dx $$ and find it.

I have hardly come across to limits of sequences that involve definite integrals (in my undergraduate education so far), so this problem just seems insurmountable at the first glance. I would appreciate any hints.
One of the things that comes to mind is to use limit comparison test. For example, we can evaluate integrals such as
$$\int_{0}^{\infty} e^{-x}\cos(x)=\frac{1}{2}$$
But for that we would have to bound the integrand somehow. One tempting thing is to interchange the integral and the limit, which would tell us that integrand is zero in the limit, but I highly doubt this is allowed here.
Looking forward to hear your thoughts.
P.S. I am not sure how to make the title informative for this post. Feel free to edit as you see fit.

REPLY [12 votes]: Substitute $y = a_k \cdot x$ in the integral. You obtain
$$\int\limits_0^\infty \frac{e^{-y/a_k}\cos (y/a_k)}{y^2 + 1}\, dy$$
And now you can apply the dominated convergence theorem, the integrand converges to $\frac{1}{1+y^2}$ pointwise and is dominated by the limit, hence the integrals tend towards
$$\int\limits_0^\infty \frac{dy}{1+y^2} = \frac{\pi}{2}.$$
If the dominated convergence theorem is not available since one is dealing with Riemann integrals, one can also obtain the result from splitting the substituted integral at strategic points.
Fix $z > 1$ arbitrarily. For all $k$ such that $a_k > z^3$, we can split the integral at $z$, write $I(k,z) = \int_0^z \frac{e^{-y/a_k}\cos (y/a_k)}{1+y^2}\,dy$ and $II(k,z) = \int_z^\infty \frac{e^{-y/a_k}\cos (y/a_k)}{1+y^2}\,dy$, and can estimate
$$\lvert II(k,z)\rvert \leqslant \int\limits_z^\infty \bigg\lvert \frac{e^{-y/a_k}\cos (y/a_k)}{1+y^2}\bigg\rvert\,dy \leqslant e^{-z/a_k}\int\limits_z^\infty \frac{dy}{1+y^2} < \frac{\pi}{2} - \arctan z$$
for the second part, and
$$\lvert\arctan z - I(k,z)\rvert = \Biggl\lvert\int\limits_0^z \frac{1 - e^{-y/a_k}\cos (y/a_k)}{1+y^2}\,dy \Biggr\rvert \leqslant \int\limits_0^z \frac{\lvert 1 - e^{-y/a_k}\cos (y/a_k)\rvert}{1+y^2}\,dy$$
for the first part.
Now, we assumed that $a_k > z^3$, so $0 \leqslant y/a_k \leqslant z/a_k < 1/z^2$ for $I(k,z)$, so $\cos (y/a_k) \geqslant 1 - \frac{1}{2z^4}$ and $e^{-y/a_k} \geqslant e^{-1/z^2} > 1 - \frac{1}{z^2}$. We can hence estimate the numerator
$$\lvert 1 - e^{-y/a_k}cos (y/a_k) \rvert \leqslant 1 - \biggl(1 - \frac{1}{z^2}\biggr)\biggl(1 - \frac{1}{2z^4}\biggr) = \frac{1}{z^2} + \frac{1}{2z^4} - \frac{1}{2z^6} < \frac{2}{z^2}.$$
Thus we obtain $\lvert\arctan z - I(k,z)\rvert \leqslant z\cdot\frac{2}{z^2} = \frac{2}{z}$.
Altogether
$$\biggl\lvert\frac{\pi}{2} - \bigl(I(k,z) + II(k,z)\bigr) \biggr\rvert \leqslant \biggl(\frac{\pi}{2} - \arctan z\biggr) + \lvert \arctan z - I(k,z)\rvert + \lvert II(k,z)\rvert \leqslant \frac{2}{z} + \pi - 2\arctan z.$$
The last quantity obviously tends towards $0$ for $z \to \infty$.