Mean of $Y=\cos(X)$ where $X\sim\mathcal N(0,1)$

probabilitysolution-verification

Let $(\Omega,\mathcal{F},\mathbb{P})$ be a probability space and $X,Y:\Omega\rightarrow\mathbb{R}$ be two random variables. If $X\sim\mathcal N(0,1)$ and $Y=\cos(X)$, what is $\mathbb{E}[Y]$ (i.e. the mean of $Y$)?

Using the definition of the mean,
\begin{align}
\mathbb{E}[Y]&=\mathbb{E}[\cos(X)] \\
&=\int_\mathbb{R} \cos(x)f_X(x) \ dx \\
&=\frac{1}{\sqrt{2\pi}}\int_\mathbb{R} \cos(x)\exp\left(-\frac{x^2}{2}\right) \ dx \\
&=\frac{1}{\sqrt{e}}.
\end{align}

However, according to my textbook $\mathbb{E}[Y]=0$. Is there an error in my logic?

Best Answer

Yes, your solution is correct. If it were $Y = \sin X$, then the expectation of $Y$ would be zero, and perhaps this was what the author was thinking.

It is worth noting that the calculation may be performed as follows:

$$\begin{align} \frac{1}{\sqrt{2\pi}} \int_{x=-\infty}^\infty (\cos x ) e^{-x^2/2} \, dx &= \frac{1}{\sqrt{2\pi}} \int_{x=-\infty}^\infty \frac{e^{ix} + e^{-ix}}{2} e^{-x^2/2} \, dx \\ &= \frac{1}{2\sqrt{2\pi}} \int_{x=-\infty}^\infty e^{-(x^2-2ix-1)/2-1/2} + e^{-(x^2+2ix-1)/2-1/2} \, dx \\ &= \frac{1}{2\sqrt{e} \sqrt{2\pi}} \int_{x=-\infty}^\infty e^{-(x-i)^2/2} + e^{-(x+i)^2/2} \, dx \\ &= \frac{1}{\sqrt{e}}. \end{align}$$ This is equivalent to evaluating the characteristic function at $1$ and $-1$; i.e., $$\varphi_X(t) = \operatorname{E}[e^{itX}] = e^{-t^2/2},$$ hence $$\operatorname{E}[\cos X] = \frac{1}{2}\operatorname{E}[e^{iX} + e^{-iX}] = \frac{1}{2} (\varphi_X(1) + \varphi_X(-1)) = e^{-1/2}.$$