I was thinking about the formula that gives us the expected value of a continuous random variable with pdf $f(x)$, that is
$$E[X]=\int_{a}^{b} xf(x)dx$$ How can this, intuitively, gives us the expected value of $X$? I can totally understand it in the discrete case, because it is analogous to just calculating the arithmetic mean.
But here? I am not sure, there isn't even a proper probability in this formula.
The only thought that can give me some idea is that $f(x)dx$ is the probability that $X$ is in the small range of width $dx$. After this thought, and considering the integral as an infinite summation, I can see the analogy with the discrete case.
However I am not certain this is the way to think about it. A more detailed, based on intuition, reasoning would be appreciated. Thanks!
Consider the following Riemann sum with $\Delta=(b-a)/n$: $$ S_n:=\sum_{i=1}^n x_i^* f(x_i^*)\Delta, $$ where $x_i^*\in [x_{i-1},x_i]$ and $x_i=a+i\Delta$. The term $f(x_i^*)\Delta$ is, approximately, the probability of $X\in [x_{i-1},x_i]$, and so, $S_n$ can be interpreted as an aprroximate average of $X$. As $n$ increases, this approximation becomes better, and in the limit, $$ S_n\to \int_a^b xf(x)\,dx=\mathsf{E}X. $$