integral of $ \int_{-\infty}^\infty e^{-x^2}\cos(2x^2)dx$ I am a high school student who watches math videos for fun. I was watching this video where someone evaluates the integral: $$ \int_{-\infty}^\infty e^{-x^2}\cos(2x^2)dx$$ You can find the link here. Anyways I was wondering why this integral did not evaluate to 0 as the function being integrated is even and the boundaries are symmetric. Thank you in advance
 A: You're confusing even functions with odd functions. A function $f$ is odd if $f(-x) = -f(x)$, and is even if $f(-x) = f(x)$. Indeed, if $f$ is odd, then:
$$
\int_{-a}^a f(x) \; \mathrm{d}x = 0
$$
The property of even function is that:
$$
\int_{-a}^a f(x) \; \mathrm{d}x = 2\int_0^a f(x) \; \mathrm{d}x
$$
And it does not tell us anything about whether the integral is zero. 

Regardless, you need to beware that, even if $f$ is odd, it does not imply that $\int_{-\infty}^\infty f(x) \; \mathrm{d}x = 0$. A simple counterexample is $f(x) = x$.
This is because:
$$
\int_{-\infty}^\infty f(x) \; \mathrm{d}x \neq \lim_{M \to \infty} \int_{-M}^M f(x) \; \mathrm{d}x \tag{1}
$$
Instead, the definition is:
\begin{align*}
\int_{-\infty}^\infty f(x) \; \mathrm{d}x &= \int_0^\infty f(x) \; \mathrm{d}x + \int_{-\infty}^0 f(x) \; \mathrm{d}x \\
&:= \lim_{M \to \infty} \int_0^M f(x) \; \mathrm{d}x + \lim_{M' \to \infty} \int_{-M'}^0 f(x) \; \mathrm{d}x
\end{align*}
As you can see, the speed in which $M$ and $M'$ tend to infinity may not be the same. In fact, the limits may not even exist. Thus, it is possible for us to obtain an $\infty - \infty$ situation, in which we then say that the original integral is not well-defined. If, however, the integral is indeed defined, then $(1)$ would indeed hold.
A: Integrate as follows,
$$\begin{align}
& \int_{-\infty}^\infty e^{-x^2}\cos(2x^2)dx \\
& =\frac12\int_{-\infty}^\infty (e^{-(1-2i)x^2} + e^{-(1+2i)x^2})dx \\
& =\frac12\left( \frac{ \sqrt\pi}{\sqrt{1-2i}}+ \frac{ \sqrt\pi}{\sqrt{1+2i}}\right) \\
& = \sqrt{\frac{1+\sqrt5}{10}\pi } \\
\end{align}$$
where $\int_{-\infty}^{\infty} e^{-ax^2}dx=\sqrt{\frac {\pi}a}$ is used.
