Stephanie Simoes challenges us to the "two-box problem."
This problem is similar to the infamous Monty Hall problem. In the two-box problem, there are two boxes, each containing two notes. One of the boxes has \$100 notes. The other box has one \$100 note and one \$1 note.
Suppose that, without looking, one successfully pulls a \$100 note from a box. Now you get a second chance to pull another note from either box. Should you change boxes?
using Random, StatsBase
function total(change)
box1 = [1, 100]
box2 = [100, 100]
boxes = [box1, box2]
shuffle!(box1)
shuffle!(box2)
shuffle!(boxes)
# Take a $100 from one of the two boxes (we don't know which one).
total = 0
total += popat!(boxes[1], findfirst(==(100), boxes[1]))
# If we change, then take one element from the other box,
if change == true
total += popfirst!(boxes[2])
# otherwise take the other element from the current box.
else
total += popfirst!(boxes[1])
end
@assert total == 101 || total == 200
return total
end;
The above function, implemented in Julia, simulates our two-box problem by returning the total if we do or do not change boxes. This function can only return 101 or 200. We now take the average from one million experiments changing or not changing boxes.
mean((total(true) for _ in 1:1000000))
175.220597
mean((total(false) for _ in 1:100000))
150.60296
Based on these experimental results, you should change boxes to win (on average) the two-box problem.
$$ \begin{aligned} p(100 | \textrm{change}) &= 0.75 \\ p(100 | \textrm{no change}) &= 0.50 \end{aligned} $$Why? I will hazard an explanation, but let me disclaim that problems like this are famously tricky and I might be wrong.
Let us start with with the case where you don't change. You've already chosen a \$100 from the first box, so now it is obviously 50:50 whether you had the box with the \$1 or not.
The second case, where we do change boxes, is less obvious. We enumerate the possibilities that follow having drawn \$100 from the first box.
Therefore, $p(100 | \textrm{change}) = 1 - p(1 | \textrm{change}) = 1 - 0.25 = 0.75$.