Prove that the integral of a rapidly oscillating function is $0$ Claim: If $n$ is a nonzero integer, then $$\int_{-\pi/2}^{\pi/2} \exp[{2in(x+\tan x)}] \ \mathrm{d}x = 0$$
Using Euler's identity $e^{ix}= \cos x + i \sin x$, the fact that $\sin$ is an odd function so integrated over a symmetric integral gives $0$, and the parity of $\cos$, one gets
$$\int_{0}^{\pi/2} \! \! \cos(2n(x+\tan x)) \ \mathrm{d}x$$
I tried using substitution, but it didn't get me anywhere. Is there maybe a general way to approach these rapidly oscillating integrals to show that the positive and negative areas cancel out?
 A: Integrate $f(z) = \exp[2in(z+\tan z)]$ around the rectangular contour with vertices $-\pi/2,\pi/2,-\pi/2+ iR, \pi/2+iR$. For the moment, ignore the singularity at $z=\pm \pi/2$.
Since $n$ is an integer, $f(z+\pi) = f(z)$, hence integrals on two vertical line cancel each other, hence
$$\int_{-\pi/2}^{\pi/2} f(z) dz = \int_{-\pi/2}^{\pi/2} f(z+iR) dz$$ for any $R>0$. But $$\int_{-\pi/2}^{\pi/2} f(z+iR) dz = e^{-2nR}\int_{-\pi/2}^{\pi/2} \exp[2in(x+\tan(x+iR))]dx$$
last integral is bounded as $R\to \infty$ because $\tan$ is bounded at large imaginary argument, letting $R\to \infty$ gives $\int_{-\pi/2}^{\pi/2} f(z) dz = 0$ when $n> 0$.
Now we take account of the singularity at $z=\pm \pi/2$. Let $r$ be small positive, let $C_1$ be the circle $\pi/2 + re^{i\theta}$ with $\pi/2 \leq \theta\leq \pi$. Then I claim $\int_{C_1} f(z) dz \to 0$ as $r\to 0$. Indeed, $$\tan(\pi/2 + re^{i\theta}) = -\cot(re^{i\theta}) = -r^{-1}e^{-i\theta} + O(r)$$
so $$\int_{C_1} f(z) dz = ir\int_{\pi/2}^{\pi} \left( \exp[-2inr^{-1}e^{-i\theta}] + O(1)\right) d\theta$$
If $n>0$, then $\Re(-2inr^{-1}e^{-i\theta})\leq 0$ for $\theta$ in range, the integral tends to $0$ as $r\to 0$. This take cares the singularity at $z=\pi/2$. Similar procedure handles the singularity at $z=-\pi/2$.
So we rigorously proved, when $n$ is positive integer, $$\lim_{\varepsilon\to 0^+} \int_{-\pi/2 + \varepsilon}^{\pi/2 - \varepsilon} f(x) dx = 0$$
The same is true for $n$ negative, by looking at real and imaginary part.

A very analogous integral $$\int_{-\pi/2}^{\pi/2} \exp[2i(x-\tan x)] dx \approx 1.70067$$ is nonzero. Curious readers can identify which of step above argument fails.
