# Minimizing expected value of payment in a game

2 Friends are playing the following game:

The first one randomly picks a number between 0 and 100 (inclusive).
Then the second friends tries to guess which number it is.

The second friend pays the first friend the power of the difference between his guess and the result. I need to find:

1) Which value minimizes the expectation of the amount that the second friend pays?
2) How much does the first friend have to pay the second friend before the game so that the expectation of both friends profit will be zero?

I tried the following:
Let X = result of the first friend's random choice.
Let Y = result of the second friend's random guess.
Then Z, the amount the second friend pays, is $$Z = (X-Y)^2$$.

I never encountered such question before. From what I can gather I need to find the expectation of Z, differentiate it and find the minimum?

We can see that $$X, Y ~Unif([0,...,100])$$ and therefore $$\mathbb{E}(X) = \mathbb{Y} = \frac{0 + 100}{2} = 50$$.

I kind of got stuck continuing from here, would appreciate some help. Thanks in advance!

• What does "the power of the difference" mean? As a hint for solving the problem, try a smaller version. Suppose the choice is made from $\{0,1\}$...or $\{0,1,2\}$ and so on.
– lulu
Commented Dec 25, 2019 at 11:49

You need to minimize $$\mathsf{E}(X-y)^2=\mathsf{E}X^2-2\mathsf{E}Xy+y^2=3350-100y+y^2$$ over $$y$$ (it is not random). The result is $$y^*=50$$. The expected amount to pay is $$850$$.
• Because it is a guess, isn't it? The second friend chooses $y$ to minimize his payment.
• Wouldn't the expectation of $X^2$ be $3385$? Commented Dec 25, 2019 at 17:30
• @PythonSage $\sum_{i=0}^{100} i^2=338350$. Then $338350/101=3350$.