The Cake Cutting Problem

Introduction

Alon Amit’s post gave a very good explanation about the cake cutting problem. In mathematical language, the problem is stated as:

X1U(0,1),X2U(0,1X1),X3U(0,1X1X2),

What is the probability that X1 is the maximum among X1, X2, X3, ?

The answer is the Golomb-Dickman constant 0.6243. Alon Amit made efforts to explain why “the Golomb-Dickman pops up”. In Michael Lamar’s post, there is Matlab/Octave code for a simulation study.

I wrote the following R program:

simu_exp_1 <- function()
{x <- 1
 first_cut <- runif(1, min = 0, max = x)
 temp <- first_cut
 while(1) {
   x <- x - temp
   if(x < first_cut) return(1)
   next_cut <- runif(1, min = 0, max = x)
   if(next_cut > first_cut) return(0)
   temp <- next_cut
 }
}

N <- 1000000
simu_re <- replicate(n = N, simu_exp_1())
mean_re <- cumsum(simu_re) / (1:N)
(mean_re[N])
## [1] 0.623832

Inspired by the above cake cutting problem, I asked myself the following question:

X1U(0,1),X2U(0,1X1),XnU(0,1i=1n1Xi),

Define

Pn=Prob(X1>X2>>Xn), for n=2, 3,.

When n is given, what is Pn?

Finding P2

In the case n=2, we can find the the joint probability density function of X1 and X2 is

f(x1,x2)=I(0,1)(x1)I(0,1x1)(x2)11x1.

Thus,

P2=x1>x2f(x1,x2)dx1dx2=010min{x1,1x1}11x1dx2dx1=0111x1min{x1,1x1}dx1=01/2x1xdx+1/211x1xdx=ln(2)0.6931472

Finding Pn by simulation

My R code is given below

simu_exp_2 <- function(n = 2)
{x <- rep(0, n)
 x[1] <- runif(1, min = 0, max = 1)
 for(i in 2:n) {
   x[i] <- runif(1, min = 0, max = 1 - sum(x[1:(i-1)]))
 }
 y <- sort(x, decreasing = TRUE)
 if(identical(x, y)) return(1)
 return(0)
}

get_result <- function(n = 2) 
{N <- 1000000
 simu_re <- replicate(n = N, simu_exp_2(n))
 mean_re <- cumsum(simu_re) / (1:N)
 mean_re[N]
}

(get_result(n = 2))
## [1] 0.692733
(get_result(n = 3))
## [1] 0.431809
(get_result(n = 4))
## [1] 0.260376
Lingyun Zhang (张凌云)
Lingyun Zhang (张凌云)
Design Analyst

I have research interests in Statistics, applied probability and computation.