Say $X$ is uniformly distributed on the interval $[\pi,2\pi]$
Compute $E[\sin(X)] - \sin(E[X])$
So first, apparently $E[X] = \frac{3\pi}{2}$ which I don't really understand, second, for some reason, $E[\sin(x)] = \int_\pi^{2\pi} \frac{\sin(x)}{\pi}$.
I don't understand how $E[X] = \frac{3\pi}{2}$ and I also don't really understand how to go from $E[\sin(x)]$ to $ \int_\pi^{2\pi} \frac{\sin(x)}{\pi}$. Would appreciate some help, thanks in advance!
The expectation of a continuous distribution over an interval is pretty much the continuous analogue of the expectation of a discrete distribution.
Discrete: $E[x] = \sum_{i=1}^{k} x_{i}P(X = x)$
Continuous analogue of a sum is an integral, which converts the discrete version into:
$\int_{a}^{b} xf(x) dx$ where $f(x)$ is the probability density function (PDF).
The integral of the PDF over the interval $[a,b]$ should be equal to 1.
In our case, the interval is $[\pi,2\pi]$, so the integral, $\int_{\pi}^{2\pi} f(x) = 1$. The PDF of a uniform distribution over an interval $[a,b]$ is $f(x) = \dfrac{1}{b-a}$. You can see that no other constant function satisfies the condition. (The function should be constant because that the distribution is uniform.)
In our case, $f(x) = \dfrac{1}{\pi}$.
You can see that it satisifies $\int_{\pi}^{2\pi} f(x) = 1$.
So the expectation is $E[x] = \int_{\pi}^{2\pi} \dfrac{x}{\pi} dx = \dfrac{3\pi}{2}$.
Knowing this, figuring out $E[sin x]$ is easy.
$E[sin x] = \int_{\pi}^{2\pi} sinxf(x) dx = \int_{\pi}^{2\pi} \dfrac{sin{x}}{\pi} dx$