# A random number puzzle

A puzzle that crossed my path via @drmaciver:

player 1 pushes the button twice, and multiplies the two outputs together to get a score (e.g. 0.45 x 0.9=0.4).

— Ghast (@Ghast_NEOH) August 2, 2019

then player 2 pushes the button once, and squares the result to get their score (e.g. 0.67 x 0.67 = 0.4489)

the higher score wins. which player wins more often?

You might want to have a play with it before I share my solution. Spoilers below the line.

I mentally went around the houses a bit, before hitting the key question, which is:

### When does player 1 win?

Suppose Player 1 - Aloysius - is given numbers $x$ and $y$. Then he will win if Player 2 - Blanchefleur - has a number smaller than $\sqrt{xy}$.

This is going to be a double integral! Since $x$ and $y$ both go from 0 to 1, we need:

$P_1 = \int_0^1 \int_0^1 x^{1/2} y^{1/2} \d y \dx$

My instinct, when I see a double integral, is to run away scared. However, this one is a relatively tame example:

$P_1 = \int_0^1 x^{1/2} \left[ \frac{2}{3}y^{3/2} \right]_0^1 \dx$

$\dots = \int_0^1 \frac{2}{3}x^{1/2} \dx$

$\dots = \left[ \frac{4}{9} x^{3/2} \right]_0^1$

$\dots = \frac{4}{9}$.

### So…

Aloysius will win, on average, four games in nine; Blanchefleur will win five in nine. Lovely puzzle!