How do we calculate the expected value E(X) for a density function?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
8 replies · 3K views
EdmureTully
Messages
20
Reaction score
0
Give me an example like:

X: random variable representing the sum of 1 dice roll

p: probability of getting a dice result

E(X) = sum of X*p = 1(1/6) + 2(1/6) + 3(1/6) + 4(1/6) + 5(1/6) +6(1/6)

BONUS POINT:

what would be the E(X) for 3 dice rolls?

Sorry, I am really dumb. I am trying to understand exactly what E(X) means.
 
on Phys.org
I just don't really know how to find the E(X) of a density function and how to apply the theory for any case.
 
Your situation isn't clear. Are you studying a book? Or are you trying to take some sort of quiz without having ever studied a book on probability theory or statistics? Your post which begins "Give me an example like" isn't even clear. Are you saying that someone gave you an example like that? Are you requesting another example?
 
I am requesting an example for a density function and not a mass function.
 
The problem, as you stated it, tells you all of that. For a single dice roll, there are 6 possible outcomes, all equally likely so the "density function" is f(1)= 1/6, f(2)= 1/6, f(3)= 1/6, f(4)= 1/6, f(5)= 1/6, f(6)= 1/6. The "mass function" (also called "cumulative probability function") is F(1)= 1/6, F(2)= 2/6= 1/3, f(3)= 3/6= 1/3, f(4)= 4/6= 2/3, f(5)= 5/6, f(6)= 6/6= 1.

E(x), the "expected value", is the sum of each value times it probability: 1(1/6)+ 2(1/6)+ 3(1/6)+ 4(1/6)+ 5(1/6)+ 6(1/6)= (1/6)(1+ 2+ 3+ 4+ 5+ 6)= (1/6)(21)= 3.5.

Of course, the calculations for three rolls are much harder. The lowest possible sum of three rolls is 1+ 1+ 1= 3 and that will occur only if all three rolls are 1. The probabability of that is (1/6)(1/6)(1/6)= 1/216. You can get a total of 4 with 2+ 1+ 1- that is 2 on die 1, and 1 on the other 2. Since the probability of anyone number is 1/6, the probability of "2, 1, 1" is also (1/6)(1/6)(1/6)= 1/216. But we can also get 4 with 1+ 2+ 1- 1 on die 1, 2 on die 2, and 1 on die 3, or 1+ 1+2- 1 on dice 1 and 2, 2 on die 3. The probability of each of those is each 1/216 but the probability of a total of 4 in any of those ways is 1/216+ 1/216+ 1/216= 3/216= 1/72. And for a total of 5, it gets worse! 1+ 1+ 3, 1+ 3+ 1, 3+ 1+ 1, 2+ 2+ 1, 2+ 1+ 2, 1+ 2+ 2, etc.
 
EdmureTully said:
I am requesting an example for a density function and not a mass function.

In many books the term "density function" is often used for both discrete and continuous random variables, but perhaps your study materials use "mass function" exclusively for discrete random variables and you are asking for an example of computing [itex]E(X)[/itex] for a continuous random variable. Is that your question?
 
EdmureTully said:
I am requesting an example for a density function and not a mass function.
The expected value for a real-valued random variable which has a density function ##p## is defined as
$$E[X] = \int_{-\infty}^{\infty} x p(x) dx$$
For example, if ##X## is uniformly distributed over the interval ##[2,4]##, then we have
$$p(x) = \begin{cases}
\frac{1}{2} & \text{ if }2 \leq x \leq 4 \\
0 & \text{ otherwise} \\
\end{cases}$$
and therefore
$$E[X] = \int_{2}^{4} \frac{1}{2} x dx = 3$$
 
Also recall that the expectation operator has the following property:

E[aX+bY] = aE[X] + bE[Y] for constants a,b and random variables X and Y.