This Week’s Fiddler Problem

The 5/8/2026 Fiddler problem was titled “Can You Drink the Random-ade”? The problem statement is verbatim below.

I’m preparing a mixture of “random-ade” using a large, empty pitcher and two 12-ounce glasses.

First, I fill one glass with some amount of lemon juice chosen randomly and uniformly between 0 and 12 ounces. I fill the other glass with some amount of water, also chosen randomly and uniformly between 0 and 12 ounces. Next, I pour an equal amount from each glass into the pitcher until one of the glasses is empty.

At this point, I refill that empty glass with yet another random amount of the same liquid it previously contained. Once again, I pour an equal amount from each glass into the pitcher until one of the glasses is empty.

On average, how much random-ade can I expect to prepare? (Note that all three random amounts in this problem are chosen independently of each other.)

Solution

Let \(X = (X_1, X_2)\) be a random sample taken from the uniform distribution \(U(0,1)\). We’ll deal with scaling to 12 ounces later so we’ll assume 1 unit glasses in the meantime.

First, we’re interested in the order statistics \(X_{(1)}\) and \(X_{(2)}\), as we will pour \(X_{(1)}\) amount into the pitcher from the lower filled glass while \(X_{(2)} - X_{(1)}\) will be left over in the other glass. The order statistic has distribution \(X_{(1)} \sim Beta(1, 2)\). It can be shown that the distribution function for a \(Beta(1,2)\) random variable is \(F_{X_{(1)}}(t) = 1-(1-t)^2\).

The expected value of \(X_{(1)}\) can be found by using the fact that in the Beta distribution with \(\alpha=1\) and \(\beta=2\), the expected value is \(\frac{\alpha}{\alpha+\beta} = 1/3\).

Let’s sample \(Y_1\) from the uniform distribution \(U(0,1)\) again. Then, we know \(Y = \min(Y_1, X_{(2)} - X_{(1)})\) will be poured into the pitcher. We need to find a distribution for \(Y\). This can be done by looking at \(P(Y>t)\) for some \(t \in [0,1]\). To do this, we’ll use the fact that the difference of the order statistics has distribution \(X_{(2)} - X_{(1)} \sim Beta(1, 2)\), which is the same as that of \(X_{(1)}\). This, and the above result, can be found on the “Order Statistic” Wikipedia page.

Now, solving, we get

\[ \begin{eqnarray} P(Y>t) &=& P(Y_1 > t, X_{(2)} - X_{(1)}>t) \\ &=& P(Y_1 > t) * P(X_{(2)} - X_{(1)}>t) \\ &=& (1-t) * (1-t)^2 \\ &=& (1-t)^3 \end{eqnarray} \]

This indicates that \(F_Y(t) = 1-(1-t)^3\) which is the distribution function of a Beta distribution with parameters \(\alpha = 1\) and \(\beta=3\). Here, \(E(Y) = \frac{\alpha}{\alpha+\beta} = \frac{1}{4}\).

When we put these two independent pours together, we get what is poured into the pitcher on average, which is \(1/3+1/4 = 7/12\). Scaling this to 12 ounces, we see that 7 ounces is the expected amount to be poured from each of the 2 glasses, so we expect 14 ounces to be poured into the pitcher on average.

We should simulate for piece of mind.

sim2Glass <- function(N=10000){
  cases <- rep(0,2)
  pours <-c()
  for(i in 1:N){
    U = sort(runif(2))
    Q = diff(U)
    V = runif(1)
    if(V<Q){
      cases <- cases + c(1,0)
      pours <- c(pours, U[1]+V)
    }
    if(V>=Q){
      cases <- cases + c(0,1)
      pours <- c(pours, U[2])
    }
  }
  return(list("Cases" = cases/N, "MeanPour" = mean(pours)))
}

sim2Glass(10000)
## $Cases
## [1] 0.3353 0.6647
## 
## $MeanPour
## [1] 0.5806476

Extra Credit

The problem is really a continuation of this but using three glasses instead. Here is the extra credit verbatim.

Once again I’m preparing random-ade, but this time I have three 12-ounce glasses.

I fill the first glass with a random amount of lemon juice, the second glass with a random amount of lime juice, and the third glass with a random amount of water. As before, each amount is chosen uniformly between 0 and 12 ounces, and all amounts are independent. Next, I pour an equal amount from each glass into the pitcher until one of the glasses is empty.

At this point, I refill that empty glass with yet another random amount of the same liquid it previously contained. Once again, I pour an equal amount from each glass into the pitcher until one of the glasses is empty.

Then I refill that now-empty glass with yet another random amount of the same liquid it previously contained. Again, I pour an equal amount from each glass into the pitcher until one of the glasses is empty.

On average, how much random-ade can I expect to prepare?

Outline to solution

I’ll take a slightly different approach here. We’re going to start with three glasses that can hold at least 24 ounces, follow the same rules as the problems statement, but wait until the very end to pour into the pitcher.

First, we find a random element from the region \(0\leq x\leq y\leq z\leq 1\). This will represent the initial pours into glasses 1, 2, and 3.

Let \(q = y-x\) and \(r= z-y\), and notice that \(0\leq q, r \leq 1\). Let \(L=1-q-r\). From previous definitions, we have \(y= x + q\) and \(z = x+q+r\). The allowed range of \(x\) is \(0\leq x\leq L\). The joint density of \((x,q,r)\) is 6. We can get the marginal density of \((q,r)\) by integrating out \(x\): \[ \int_0^L 6 \,dx = 6L = 6(1-q-r) \]

Now, choose random uniform random variable \(u_1\) and \(u_2\). Then, we examine the triplet \((w_1,w_2,w_3):=(x+u_1+u_2, y , z)\) when \(u_1<q\), and \((w_1,w_2,w_3):=(x+u_1, y+u_2, z)\) when \(u_1\geq q\). If we define \(W = \min(w_1,w_2,w_3)\), then we’re interested in \(3*12*E(W)\) in the end as there are three glasses and we need to scale to 12 ounces.

This is extremely difficult to write-up, so I have thrown in the towel on trying to condense my 30+ scratch paper here. There are five cases to the above, and that is that the minimum is either \(w_1\) or \(w_2\) when \(u_1<q\), and any of the \(w_i\) otherwise.

Here is a calculation of the first case, when \(x+u_1+u_2\) is the minimum. The probability that this is the minimum is \(P(u_1+u_2 < q) = \int_0^q\int_0^{q-u_1} du_2du_1 = q^2/2\). Similarly, one can find ‘areas’ of the other regions. Here is a summary.

Case 1: \(q^2/2\)

Case 2: \(q-\frac{q^2}{2}\)

Case 3: \(r-\frac{r^2}{2}\)

Case 4: \(r(1-q) - \frac{r^2}{2}\)

Case 5: \((1-q-r)(1-r)\).

To calculate the general probabilities, we need to use the joint pdf of q and r, \(f(q,r) = 6(1-q-r)\), that we found above.

Here are the computations.

f <- function(q,r){6*(1-r-q)}
Area1 <- function(q,r){q^2/2}
outer1 <- function(q){
  sapply(q, function(qi){
    integrate(function(r) f(qi,r)*Area1(qi,r), lower = 0, upper = 1-qi)$value
  }
  )
}
(case1Prob <- integrate(outer1, lower= 0, upper = 1)$value)
## [1] 0.05
Area2 <- function(q,r){(q-q^2/2)}
outer2 <- function(q){
  sapply(q, function(qi){
    integrate(function(r) f(qi,r)*Area2(qi,r), lower =0, upper = 1-qi)$value
  })
}
(case2Prob <- integrate(outer2, lower =0, upper = 1)$value)
## [1] 0.2
Area3 <- function(q,r){(r-r^2/2)}
outer3 <- function(q){
  sapply(q, function(qi){
    integrate(function(r) f(qi,r)*Area3(qi,r), lower =0, upper = 1-qi)$value
  })
}
(case3Prob <- integrate(outer3, lower =0, upper = 1)$value)
## [1] 0.2
Area4 <- function(q,r){(r*(1-q)-r^2/2)}
outer4 <- function(q){
  sapply(q, function(qi){
    integrate(function(r) f(qi,r)*Area4(qi,r), lower =0, upper = 1-qi)$value
  })
}
(case4Prob <- integrate(outer4, lower =0, upper = 1)$value)
## [1] 0.15
Area5 <- function(q,r){(1-q-r)*(1-r)}
outer5 <- function(q){
  sapply(q, function(qi){
    integrate(function(r) f(qi,r)*Area5(qi,r), lower =0, upper = 1-qi)$value
  })
}
(case5Prob <- integrate(outer5, lower =0, upper = 1)$value)
## [1] 0.4

To compute the expected value of \(x+u_1+u_2\), we’ll break up the \(x\) and \(u_1+u_2\) into two parts. Let’s find \(E(X)\) over the \(q^2/2\) area of the \((u_1,u_2)\) region. Note that \(\int_0^q\int_0^{q-u_2}(x + u_1+u_2) du_1du_2 =x*q^2/2+ q^3/3\). Then, we can see that \[ \int_0^1 \int_0^{1-q} \int_0^{1-q-r} 6*(x*q^2/2 + q^3/3)\, dx\, dr \,dq = \int_0^1\int_0^{1-q} 6 \left( \frac{L^2}{2} \cdot \frac{q^2}{2} + L \cdot \frac{q^3}{3} \right) \, dr\,dq.\] Calculating this below, we find that this is equal to

outer1Exp <- function(q){
  sapply(q, function(qi){
    integrate(function(r) 6*((1-qi-r)^2/2*qi^2/2+(1-qi-r)*qi^3/3), 
                             lower = 0, upper = 1-qi)$value
  })
}
case1Exp <- integrate(outer1Exp, lower = 0, upper = 1)
case1Exp$value
## [1] 0.025

This is 1/40.

In case 2, we want to find the outcome of \(y = x+q\). Using the area of case 2, we can find that the expected value of \(y\) over this region is

outer2Exp <- function(q){
  sapply(q, function(qi){
    integrate(function(r) 6*((1-qi-r)^2/2*(qi-qi^2/2)+(1-qi-r)*(qi^2-qi^3/2)), 
              lower = 0, upper = 1-qi)$value
  })
}
case2Exp <- integrate(outer2Exp, lower = 0, upper = 1)
case2Exp$value
## [1] 0.1166667

This is 7/60.

It gets hairy from here, but it can be shown that \(E(x+u_1)\) over its region is the same as above, which is 7/60. In case 4, we can show that \(E(y+u_2) = E(x+q+u_2)\) is 1/12, and and in case 5, it can be shown that \(E(z)=E(x+q+r) =11/40\).

Putting this together, we get an expectation of

1/40+7/60+7/60+1/12+11/40
## [1] 0.6166667
37/60
## [1] 0.6166667

This is 37/60.

Finally, scale this to 12 ounces and recall that 3 cups are emptied into the pitcher. So, a total of

3*12*37/60
## [1] 22.2

ounces will be poured into the pitcher on average.

Let’s simulate in order to feel better about this.

set.seed(42)
simGlass <- function(N=10000){
cases <- rep(0,5)
pours <- c()
for(i in 1:N){
  U = sort(runif(3))
  Q = diff(U)
  V = runif(2)
  if(V[1]<=Q[1]){
    U <- U[1:2]+c(sum(V),0)
    cases <- cases + c(1*(U==min(U)),0,0,0)
    pours <- c(pours, min(U))
    next
  }
  else{
    U <- U+c(V,0)
    cases <- cases + c(0,0,1*(U==min(U)))
    pours <- c(pours, min(U))
    next
  }
}
return(list("Cases" = cases/N, "MeanPour" = mean(pours)))
}
simGlass()
## $Cases
## [1] 0.0528 0.2002 0.1919 0.1504 0.4047
## 
## $MeanPour
## [1] 0.6165203

We can see that the probability of each of the cases matches approximately to the probabilities calculated earlier as well as the mean pour.