Difference between expectation of a random variable and of a function

48 Views Asked by At

Starting from the expectation for a simple r.v. we have that: $$E[X]=\sum_{i=1}^na_iP(A_i)$$ from this formula it seems to me that the expectation correspond to the area of the r.v. X (that is, how we know, a function) where $P(A_i)$ is the length of the base of each rectangle and $a_i$ is the height.

Moving now to a continuous r.v. we have that $$\int X(w)P(dw)$$ what come in my mind is that now the base is given by $P(dw)$ and the height by the value that X could take, $X(w)$.

Is it correct? or is not true that the expectation it correspond to the area of the r.v.?

My doubt are given by the fact that I don't have only $\int X(w)$ as in a normal function $\int f(x)$, but now I'm also multiplying the r.v. (a function) with his density function