# How to compute expected value of an unknown variable?

I need to compute the expected value $E(X)$ of the expected value of $X$ for this game:

Consider a game of chance consisting of a single trial with exactly two outcomes, which from a player's perspective we will call win and lose. To play the game, a player must wager an amount, which we will denote by $a$. If the player loses the game, then they lose their wager. If the player wins the game, then they keep their wager and they win 1.00. Denote the probability of winning by $p$, where $0<p<1$. Let the random variable $X$ denote the amount won by the player

Given $p(win)=p$, I think $E(X)= 1*p + (-a)*(1-p)$ so $E(X)=ap-a+p$

Is this the solution? The exercise goes further asking for instance for what values of $a$ the game would be fair, namely $E(X)=0$, but because my solution doesn't lead me to a unique solution for $a$ I thought I did something wrong.

• Expected winnings look correct (except you've got the signs mixed up when you've multiplied out). The values of $a$ you're looking for will depend on $p$. Does that help?
– Will
Commented Oct 5, 2017 at 23:24
• Will is correct. You see that it should be p+ap-p. Commented Oct 5, 2017 at 23:32
• @Michael I think your comment contains an typing error.. Commented Oct 6, 2017 at 2:55
• Sorry I meant p+ap-a and it looks like after Will's comment the OP corrected it. Commented Oct 6, 2017 at 13:00
• @MichaelChernick I did because I wasn't sure what was the best practice, I thought it would have been confusing if someone just scrolled over my question without reading all the comments Commented Oct 6, 2017 at 15:29

The expectation of wining X is:

$E(X) = p - a(1-p)$, where fair-game implies

$E(X) = 0$

$p - a(1-p) = 0$

$\therefore a = \frac{p}{1-p}$

You can plot the values of wager (a) against the probability of wining (p)

This curve makes intuitive sense. When the probability of wining is very low, the wager should also be very low. Think of wager as incentive. On the other hand, if the probability of wining is very high, i.e. $p \approx 1$, then the wager should also be very high, since you are almost certain to win.

There is no 'unique' a unique solution here. The wager is related to probability of wining (Colloquially stated: risk and reward go hand-in-hand)

code snippet to generate the graph:

import numpy as np
import matplotlib.pyplot as plt
p = [0.01 * i for i in range(100)]
a = [i/(1.0-i) for i in p]
fig = plt.figure()
plt.plot(p, a, 'k-')
plt.xlabel('probability of wining (p)')
plt.ylabel('wager (a)')
plt.title('Fair game curve')
plt.savefig('fairgame.png')
plt.show()

• There is a unique solution, you gave it: $a=p/(1-p)$. The fact that the solution is a function of $p$ doesn't alter its uniqueness. Commented Oct 6, 2017 at 2:57
• Yes, this is a good disambiguation: unique solution is not merely a single numerical value. Thanks Glen. Commented Oct 6, 2017 at 3:37