# Expected Value of $X \sin(X)$ with $X$ normally distributed

I want to solve the following expected value problem. Let's say $X$ is normally distributed so that $X \sim N(m,s^2)$. I want to find the expected value,

$$E[X\sin(X)]$$

that is equal to

$$\frac{1}{\sqrt{2\pi s^2}} \int_{-\infty}^\infty \exp(\frac{_{-(x-m)^2}}{^{2s^2}})\, x\,\sin(x)\, dx$$

Does anyone have an idea how to simplify this?

EDIT: thanks guys for helping me out!

• For m=0, it evaluates to s2*exp(-s2/2). It's messier if m is not zero, with the result (1/2)*exp(-I*m-(1/2)*s2)*s2-((1/2)*I)*exp(I*m-(1/2)*s2)*m+((‌​1/2)*I)*exp(-I*m-(1/‌​2)*s2)*m+(1/2)*exp(I‌​*m-(1/2)*s2)*s2 , in which the imaginary, I, terms will cancel out when evaluated. Jul 23, 2017 at 23:19
• @MarkL.Stone That seems like it should be an answer, not a comment. Jul 23, 2017 at 23:27
• @ Kodiologist I didn't want someone bitching at me for not having a nicely finished and formatted answer. Jul 23, 2017 at 23:29
• Looper, please carefully examine all the edits made to your original question, in the grammar, spelling, capitalization, formatting of mathematics and so on. In particular note the necessity for distinction between the symbols for $X$, the random variable and $x$, the dummy variable in the integral. Jul 24, 2017 at 0:06
• @mark My apologies. I was pretty careful actually, but I have replaced it by pasting a copy of the text you originally had (except it was necessary to reinsert the backticks  ; I forgot they wouldn't carry over) Jul 24, 2017 at 0:26

Like many exercises involving trigonometric functions, the trick is to use complex numbers, i.e., $\int(\sin(x))\mathrm{d}x = \int Im(e^{ix})\mathrm{d}x = Im(\int e^{ix} \mathrm{d}x)$ here.

Knowing, the sum becomes \begin{align} I \triangleq \mathbb{E}[X\sin(X)] = Im \left( \int_{\mathbb{R}} x e^{ix} e^{-\frac{1}{2\sigma^2} (x-\mu)^2} \mathrm{d}x \right) . \end{align}

To compute this sum, we have to factorise the two exponential terms. A rule of thumb for such calculation is that a gaussian stays gaussian when multiplied by an exponential term of the form $e^{ax}$. I let you do the math, but one can write \begin{equation} -\frac{1}{2\sigma^2} (x-\mu)^2 + ix = -\frac{1}{2 \sigma^2}\big( x- (\mu+i\sigma^2) \big)^2 + i\mu - \frac{\sigma^2}{2} . \end{equation}

Then, by recognising the expectation of a new gaussian distribution \begin{align} I =& Im \left( e^{-\frac{\sigma^2}{2} + i\mu} \int_{\mathbb{R}} \frac{1}{\sqrt{2\pi \sigma^2}} x e^{-\frac{1}{2\sigma^2}(x - \mu - i\sigma^2)^2} \mathrm{d}x \right) \\ =& Im \left( e^{-\frac{\sigma^2}{2} + i\mu} \times (\mu + i \sigma^2) \right) \\ =&e^{-\frac{\sigma^2}{2}} \times \left( \sigma^2 \cos(\mu) + \mu \sin(\mu) \right), \end{align}

which corresponds to wolfies's answer.

• did you miss the x in the last integral? Jul 24, 2017 at 9:21
• Thank you for pointing out this error, it has been corrected accordingly. Jul 24, 2017 at 9:37
• sorry for reopening, but x is still missing, right? Jul 24, 2017 at 9:51
• Sorry, yes $x$ was still missing, because it is an expectation. I only corrected the $\mathrm{d}x$. Jul 24, 2017 at 10:16

Have you tried a computer algebra system? Here $X \sim N(\mu, \sigma^2)$ with pdf $f(x)$: Here is the output from mathStatica / Mathematica: • I dont have Mathematica, is this also possible with Matlabs Symbolic Toolbox? Oct 26, 2021 at 9:01