Why is expected value of random variable equal to mean

While learning about Random variables I came across the mean of random variable X.

The definition says that the expected value of random variable E(X) = Mean of Random variable X

I am not able to understand why is that so. Can any one please help me with it

• For most of us "expected value" and "mean" are merely synonyms. Because your question is predicated on the assumption that they are different, please tell us what your definition of "mean" might be. (I presume you adopt a standard definition of "expected value," because that is clearly a technical term of art.) – whuber Oct 31 '18 at 15:42
• The notation $E()$ is long in use and matches "expectation" in English and words beginning with "e" in some other languages, although (e.g.) Bruno de Finetti pointed out that it isn't so good a choice for Italian. Conversely, Peter Whittle used $A()$ for average, which is notation I like a lot, but again it may not seem natural to everyone, depending on their first language. – Nick Cox Oct 31 '18 at 17:07
• @whuber Mean for me is just sum of all values/n – sql_learner Oct 31 '18 at 18:31
• Could you explain what that might mean for, say, a Normally random variable? Or, let's look at the simplest possible situation, such as a random variable that has values equal to just $0$ or $1$. Are you saying your "mean" of such a variable must be $(0+1)/2$? If so, the expectation has little to do with the mean and usually will not equal it! – whuber Oct 31 '18 at 18:44
• @whuber I was not able to relate "basic" of mean(which I told you in my previous comment) with the expected value.May be the way you saying, right way to calculate mean of random variable would be similar to forumla E(X) so they are equal – sql_learner Oct 31 '18 at 18:48

For a discrete random variable, $$\text{E}[X] = \sum_{\text{all possible } x} x\,P(X=x)$$.

If you consider the roll of a 6-sided (fair) die, then this is just a weighted arithmetic average. If $$N: \text{number of dots face up after a roll}$$, then $$\text{E}[N] = 1\frac{1}{6}+2\frac{1}{6}+3\frac{1}{6}+4\frac{1}{6}+5\frac{1}{6}+6\frac{1}{6}$$.

For a continuous random variable, we use the probably density, $$f_X(x)$$, which is a measure of the intensity (a derivative of a probability) but it is a similar idea.

$$E[X] = \int_{-\infty}^{\infty} x\,f_X(x)dx$$

The intuition is that both are these are conditioning on all possible values of the random variable,$$X$$, and weighting those possible values with the chance they occur. So, the expected value is an arithmetic mean.

You can compare this mathematically with the geometric mean to see the difference.

If this still isn't clear, feel free to comment.

Your question can be read in two ways: (1) How does expected value relate to mean of a distribution? or (2) How does expected value of a random variable relate to arithmetic mean of a sample?

In first case, the answer would be that they are the synonyms.

As about the second case, let's look at them a little bit closer. Recall that expected value of a discrete random variable is defined as $$E(X) = \sum_x x\,P(x)$$. Say that you take a random sample of size $$N$$ and observe the $$x_1,x_2,\dots,x_N$$ samples, that all follow the same probability distribution. It can happen that some of the observed samples have the same value, say $$x_2,x_5,x_{N-3}$$ all are equal to $$x$$, so we can say that we observed $$n(x) = 3$$ values $$x$$ in the sample. Given that the sample is random and large enough, you can expect that proportion of observing any particular value would be close to the probability of drawing this value from the distribution they follow, i.e. $$\tfrac{n(x)}{N} \approx P(x)$$. Now, if we calculate arithmetic mean, we get

$$\frac{1}{N} \sum_{i=1}^N x_i = \frac{1}{N} \sum_x x\,n(x) = \sum_x x\tfrac{n(x)}{N} \ \approx \sum_x x\,P(x)$$

Same is true for continuous random variables, where we define expected value as $$E(x) = \int x\,f(x)\,dx$$. Probability density is the probability per foot. Notice that $$P(t_i < x \le t_{i+1}) = \int_{t_i}^{t_{i+1}} f(t)\,dt$$. If we binned the continuous variable into some number of buckets, then you could take the integrals to calculate probability that some $$x$$ falls into some particular bucket $$(t_i, t_{i+1}]$$. Calculating expected value for such binned variable is the same as with discrete random variable, because by binning we discretized it. As we move from finite number of buckets, into infinite number of infinitesimally small bins, we re talking about probability densities instead of probabilities and we are talking about continuous random variables again, so there comes all the calculus, but the basic ideas are the same.