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,


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!

  • $\begingroup$ 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. $\endgroup$ – Mark L. Stone Jul 23 '17 at 23:19
  • $\begingroup$ @MarkL.Stone That seems like it should be an answer, not a comment. $\endgroup$ – Kodiologist Jul 23 '17 at 23:27
  • 1
    $\begingroup$ @ Kodiologist I didn't want someone bitching at me for not having a nicely finished and formatted answer. $\endgroup$ – Mark L. Stone Jul 23 '17 at 23:29
  • $\begingroup$ 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. $\endgroup$ – Glen_b -Reinstate Monica Jul 24 '17 at 0:06
  • 1
    $\begingroup$ @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) $\endgroup$ – Glen_b -Reinstate Monica Jul 24 '17 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.

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

Have you tried a computer algebra system? Here $X \sim N(\mu, \sigma^2)$ with pdf $f(x)$:

enter image description here Here is the output from mathStatica / Mathematica:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.