# Expected Values

#### oyth94

##### Member
I am so lost on how to do these questions:.

1.Suppose you start with eight pennies and flip one fair coin. If the coin comes up
heads, you get to keep all your pennies; if the coin comes up tails, you have to give
half of them back. Let X be the total number of pennies you have at the end. Compute
E(X)
how do you find E(X)???

2. Suppose you roll one fair six-sided die and then flip as many coins as the number
showing on the die. (For example, if the die shows 4, then you flip four coins.) Let
Y be the number of heads obtained. Compute E(Y)

#### Chris L T521

##### Well-known member
Staff member
I am so lost on how to do these questions:.

1.Suppose you start with eight pennies and flip one fair coin. If the coin comes up
heads, you get to keep all your pennies; if the coin comes up tails, you have to give
half of them back. Let X be the total number of pennies you have at the end. Compute
E(X)
how do you find E(X)???

2. Suppose you roll one fair six-sided die and then flip as many coins as the number
showing on the die. (For example, if the die shows 4, then you flip four coins.) Let
Y be the number of heads obtained. Compute E(Y)
Well, by definition, if $X$ is a random variable, then
$E[X]=\sum_i x_i\mathbb{P}(X=x_i)$
where $x_i$ is the value $X$ can take on, and $\mathbb{P}(X=x_i)$ is the associated probability. Let $x_1$ represent the number of pennies you have when you flip heads (i.e. $x_1=8$ since you keep all the pennies you have in this case) and $x_2$ represent the number of pennies you have when you flip tails (i.e. $x_2=4$ since you lose half of what you started with). Since you're flipping a fair coin, we have $\mathbb{P}(X=x_i)=\frac{1}{2}$, $i=1,2$. Assuming that you're only flipping the coin once, we have that
$E[X]=\sum_{i=1}^2 x_i\mathbb{P}(X=x_i)=8 \cdot \frac{1}{2} + 4\cdot\frac{1}{2} = 4+2 = 6.$

The second one is a bit more interesting. If $Y$ represents the number of heads obtained, we note that $y_i\leq 6$. Thus, we let $y_i=i$ for $i=1,...,6$. Then the probability of having $i$ heads ($i=1,\ldots,6$) is $\mathbb{P}(Y=y_i)=\dfrac{1}{2^i}$. Therefore,
$E[Y]=\sum_{i=1}^6 y_i\mathbb{P}(Y=y_i)= \sum_{i=1}^6\frac{i}{2^i}=\ldots$
I'll leave it to you to simplify the sum.

I hope this makes sense!

#### oyth94

##### Member
Well, by definition, if $X$ is a random variable, then
$E[X]=\sum_i x_i\mathbb{P}(X=x_i)$
where $x_i$ is the value $X$ can take on, and $\mathbb{P}(X=x_i)$ is the associated probability. Let $x_1$ represent the number of pennies you have when you flip heads (i.e. $x_1=8$ since you keep all the pennies you have in this case) and $x_2$ represent the number of pennies you have when you flip tails (i.e. $x_2=4$ since you lose half of what you started with). Since you're flipping a fair coin, we have $\mathbb{P}(X=x_i)=\frac{1}{2}$, $i=1,2$. Assuming that you're only flipping the coin once, we have that
$E[X]=\sum_{i=1}^2 x_i\mathbb{P}(X=x_i)=8 \cdot \frac{1}{2} + 4\cdot\frac{1}{2} = 4+2 = 6.$

The second one is a bit more interesting. If $Y$ represents the number of heads obtained, we note that $y_i\leq 6$. Thus, we let $y_i=i$ for $i=1,...,6$. Then the probability of having $i$ heads ($i=1,\ldots,6$) is $\mathbb{P}(Y=y_i)=\dfrac{1}{2^i}$. Therefore,
$E[Y]=\sum_{i=1}^6 y_i\mathbb{P}(Y=y_i)= \sum_{i=1}^6\frac{i}{2^i}=\ldots$
I'll leave it to you to simplify the sum.

I hope this makes sense!
Yes thank you so much! i ended up getting the same answer for the 1st question. I am still working on the 2nd.

I came across another question though
Suppose you flip one fair coin and roll one fair six-sided die. Let X be the
product of the numbers of heads (i.e., 0 or 1) times the number showing on the die.
Compute E(X)

#### Chris L T521

##### Well-known member
Staff member
Yes thank you so much! i ended up getting the same answer for the 1st question. I am still working on the 2nd.

I came across another question though
Suppose you flip one fair coin and roll one fair six-sided die. Let X be the
product of the numbers of heads (i.e., 0 or 1) times the number showing on the die.
Compute E(X)
Here, if $X$ represents the product of the number of heads with rolled die value, we let $x_i=i$, $i=1,\ldots,6$. In this case though, $\mathbb{P}(X=x_i)=\dfrac{1}{2}\cdot\dfrac{1}{6} =\dfrac{1}{12}$ because the chance of getting a heads is $\dfrac{1}{2}$ and the chance of rolling a 1 through 6 is $\dfrac{1}{6}$ since we're working with a fair die. Therefore,
$E[X]=\sum_{i=1}^6 x_i\mathbb{P}(X=x_i) = \sum_{i=1}^6\frac{i}{12}=\ldots$

I hope this makes sense!

#### chisigma

##### Well-known member
I am so lost on how to do these questions:.

1.Suppose you start with eight pennies and flip one fair coin. If the coin comes up
heads, you get to keep all your pennies; if the coin comes up tails, you have to give
half of them back. Let X be the total number of pennies you have at the end. Compute
E(X)...
There are two not well specified points...

a) if You remain with one penny the game is over or You can continue and lose half penny, a quarter of penny and so one?...

b) is the number of possible flippings finite or unlimited?...

Kind regards

$\chi$ $\sigma$

#### chisigma

##### Well-known member
1.Suppose you start with eight pennies and flip one fair coin. If the coin comes up
heads, you get to keep all your pennies; if the coin comes up tails, you have to give
half of them back. Let X be the total number of pennies you have at the end. Compute
E(X)...
Supposing that the game is over when the player has only one penny, then the problem is Markov type with four states...

1- The player has 8 pennies...

2- The player has 4 pennies...

3- The player has 2 pennies...

4- The player has 1 penny...

The transition diagram is represented in the figure...

... and the transition matrix is...

$\displaystyle P = \left | \begin{matrix} \frac{1}{2} & \frac{1}{2} & 0 & 0 \\ 0 & \frac{1}{2} & \frac{1}{2} & 0 \\ 0 & 0 & \frac{1}{2} & \frac{1}{2} \\ 0 & 0 & 0 & 1 \end{matrix} \right|$ (1)

If n is the number of flipping and $p_{i}, i=1,2,3,4$ the elements of first line of $P^{n}$, then the expected value of X is...

$\displaystyle E \{X\} = \sum_{i=1}^{4} p_{i}\ 2^{4-i}\ (2)$

Let's proceed for some values of n...

$n=1, p_{1}= \frac{1}{2}, p_{2}= \frac{1}{2}, p_{3}=0,p_{4}=0 \implies E \{X\} = 6$

$n=2, p_{1}= \frac{1}{4}, p_{2}= \frac{1}{2}, p_{3}=\frac{1}{4},p_{4}=0 \implies E \{X\} = \frac{9}{2}$

$n=3, p_{1}= \frac{1}{8}, p_{2}= \frac{3}{8}, p_{3}=\frac{3}{8},p_{4}=\frac{1}{8} \implies E \{X\} = \frac{27}{8}$

$n=4, p_{1}= \frac{1}{16}, p_{2}= \frac{1}{4}, p_{3}=\frac{3}{8},p_{4}=\frac{5}{16} \implies E \{X\} = \frac{19}{8}$

$n=5, p_{1}= \frac{1}{32}, p_{2}= \frac{5}{32}, p_{3}=\frac{5}{16},p_{4}=\frac{1}{2} \implies E \{X\} = 2$

$n=6, p_{1}= \frac{1}{64}, p_{2}= \frac{3}{32}, p_{3}=\frac{15}{64},p_{4}=\frac{21}{32} \implies E \{X\} = \frac{13}{8}$

$n=7, p_{1}= \frac{1}{128}, p_{2}= \frac{7}{128}, p_{3}=\frac{21}{128},p_{4}=\frac{99}{128} \implies E \{X\} = \frac{177}{128}$

$n=8, p_{1}= \frac{1}{256}, p_{2}= \frac{1}{32}, p_{3}=\frac{7}{64},p_{4}=\frac{219}{256} \implies E \{X\} = \frac{315}{256}$

The fact that $E \{X\}$ tends to 1 for n 'large' of course is not a surprise...

Kind regards

$\chi$$\sigma$

#### oyth94

##### Member
Here, if $X$ represents the product of the number of heads with rolled die value, we let $x_i=i$, $i=1,\ldots,6$. In this case though, $\mathbb{P}(X=x_i)=\dfrac{1}{2}\cdot\dfrac{1}{6} =\dfrac{1}{12}$ because the chance of getting a heads is $\dfrac{1}{2}$ and the chance of rolling a 1 through 6 is $\dfrac{1}{6}$ since we're working with a fair die. Therefore,
$E[X]=\sum_{i=1}^6 x_i\mathbb{P}(X=x_i) = \sum_{i=1}^6\frac{i}{12}=\ldots$

I hope this makes sense!
i know that X = the product of the two but how come P(X=xi)? isn't that if you're only finding the probability for the dice?
so to find X can we follow the theorem for independence since the two events are independent from each other? E(XY)=E(X)E(Y)

Last edited: