{"id":1965,"date":"2017-05-01T16:47:09","date_gmt":"2017-05-01T21:47:09","guid":{"rendered":"http:\/\/www.laurentlessard.com\/bookproofs\/?p=1965"},"modified":"2017-05-02T01:38:13","modified_gmt":"2017-05-02T06:38:13","slug":"colorful-balls-puzzle","status":"publish","type":"post","link":"https:\/\/laurentlessard.com\/bookproofs\/colorful-balls-puzzle\/","title":{"rendered":"Colorful balls puzzle"},"content":{"rendered":"<p>This <a href=\"https:\/\/fivethirtyeight.com\/features\/can-you-solve-these-colorful-puzzles\/\">Riddler puzzle<\/a> about an interesting game involving picking colored balls out of a box. How long will the game last?<\/p>\n<blockquote><p>\nYou play a game with four balls: One ball is red, one is blue, one is green and one is yellow. They are placed in a box. You draw a ball out of the box at random and note its color. Without replacing the first ball, you draw a second ball and then paint it to match the color of the first. Replace both balls, and repeat the process. The game ends when all four balls have become the same color. What is the expected number of turns to finish the game?<\/p>\n<p>Extra credit: What if there are more balls and more colors?\n<\/p><\/blockquote>\n<p>Here is my solution to the first part (four balls):<br \/>\n<a href=\"javascript:Solution('soln_colorful1','toggle_colorful1')\" id=\"toggle_colorful1\">[Show Solution]<\/a><\/p>\n<div id=\"soln_colorful1\" style=\"display: none\">\n<p>Before I begin, I&#8217;d like to acknowledge <a href=\"https:\/\/hectorpefo.github.io\/2017-05-01-paint-balls\/\">Hector Pefo<\/a> and <a href=\"https:\/\/twitter.com\/SawyerTabony\/status\/858720259364311040\">Sawyer Tabony<\/a> who also posted excellent solutions to this Riddler puzzle. We all arrived at the same answer (whew!) but our approaches differ slightly.<\/p>\n<p>A natural way to think about this problem is that the game can exist in some number of states (the particular coloring of the balls in the box). At each step, at most one of the balls is recolored and we transition to another state. Such a collection of states and transition probabilities is known as a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain\">Markov Chain<\/a>. Since we are only interested in how long it takes for all balls to be the same color, it&#8217;s not necessary to keep track of every possible state; we can aggregate states and simplify the problem.<\/p>\n<h3>Partition approach<\/h3>\n<p>One way to aggregate states is to count the number of balls of each different color without regard for the colors themselves. For example, 4 balls can be partitioned in 5 different ways:<br \/>\n\\[<br \/>\n1+1+1+1,\\qquad<br \/>\n2+1+1,\\qquad<br \/>\n2+2,\\qquad<br \/>\n3+1,\\qquad<br \/>\n4<br \/>\n\\]The partition &#8220;2+1+1&#8221;, for example, consists of cases where two of the balls are the same color and the other two balls are two other colors. Both the cases &#8220;red+red+green+blue&#8221; and &#8220;blue+blue+yellow+red&#8221; would fall into the category &#8220;2+1+1&#8221;. By using these five partitions as states in a Markov Chain, we can compute the transition probabilities to go from one state to the next. For example, the probability of transitioning from &#8220;2+1+1&#8221; to &#8220;3+1&#8221; is $\\frac{1}{3}$ because in order for this transition to occur, we must first choose one of the two identically colored balls (probability $\\frac{2}{4}$), then we must choose one of the other two balls out of the remaining three (probability $\\frac{2}{3}$).<\/p>\n<p>Here is what the complete Markov Chain looks like when all transition probabilities are filled in:<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_markov.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_markov.png\" alt=\"\" width=\"453\" height=\"377\" class=\"aligncenter size-full wp-image-1984\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_markov.png 453w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_markov-300x250.png 300w\" sizes=\"auto, (max-width: 453px) 85vw, 453px\" \/><\/a><\/p>\n<p>If we label the states in order, we can write the transition probabilities as a matrix that describes how states evolve.<br \/>\n\\[<br \/>\nA = \\begin{bmatrix}<br \/>\n0 &#038; 0 &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n1 &#038; \\frac{1}{2} &#038; 0 &#038; 0 &#038; 0 \\\\<br \/>\n0 &#038; \\frac{1}{6} &#038; \\frac{1}{3} &#038; \\frac{1}{4} &#038; 0 \\\\<br \/>\n0 &#038; \\frac{1}{3} &#038; \\frac{2}{3} &#038; \\frac{1}{2} &#038; 0 \\\\<br \/>\n0 &#038; 0 &#038; 0 &#038; \\frac{1}{4} &#038; 0<br \/>\n\\end{bmatrix}<br \/>\n\\]For example, if $x$ is our current distribution, then $Ax$ is our distribution after one move. Note that the columns sum to $1$ because at each state, we must transition to some other state. The only exception is the last column, because the game stops once we reach the final state.<\/p>\n<p>To compute the probability that the game ends after $k$ turns, we should find the probability that the game is in the final state after $k$ turns. Since we start in state $1$, the required quantity is $\\left[ A^k \\right]_{51}$. In other words, the $(5,1)$ component of $A^k$. We can compute this directly for each $k$ and we obtain the following distribution:<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1-1024x422.png\" alt=\"\" width=\"840\" height=\"346\" class=\"aligncenter size-large wp-image-1979\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1-1024x422.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1-300x124.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1-768x317.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1-1200x495.png 1200w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist4-1.png 1384w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>Note that the probability is zero for 1 or 2 turns because the game can&#8217;t end that quickly. It takes at least three turns (since there are four balls total) for all balls to be painted the same color. We can also compute the expected number of turns by evaluating the sum:<br \/>\n\\[<br \/>\nA + 2A^2 + 3A^3 + \\dots<br \/>\n= A(I-A)^{-2}<br \/>\n\\]and then extracting the $(5,1)$ component. The result in this case turns out to be 9. When we compare the distribution to the mean in the figure above, we notice that the distribution has a heavy tail; although the mean is 9, the likeliest number of turns is actually 5.\n<\/p><\/div>\n<p>Here is my solution to the general case with $N$ balls:<br \/>\n<a href=\"javascript:Solution('soln_colorful2','toggle_colorful2')\" id=\"toggle_colorful2\">[Show Solution]<\/a><\/p>\n<div id=\"soln_colorful2\" style=\"display: none\">\n<p>Although it&#8217;s possible to extend the partition used in the previous part to any other number of balls, in practice it is a challenge. One of the first obstacles is that the number of partitions as a function of $N$ is an intractable quantity. It is known as the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Partition_(number_theory)\">partition function<\/a> and is studied by number theorists for its deep connections to prime numbers. Partition functions were even mentioned in the recent movie about <a href=\"https:\/\/en.wikipedia.org\/wiki\/Srinivasa_Ramanujan\">Ramanujan<\/a>, <a href=\"http:\/\/www.imdb.com\/title\/tt0787524\/\">&#8220;The Man Who Knew Infinity&#8221;<\/a>. So we&#8217;re not taking that approach.<\/p>\n<h3>Counting Blue<\/h3>\n<p>We can still use Markov Chains, but we&#8217;ll have to come up with a different way of aggregating the states. One possibility is to define the states $k = 1,2,\\dots,N$ which correspond to the number of Blue balls in the box. If Blue ends up winning, we will have started in state 1 and made our way eventually to state N without ever getting to state 0. The trick is to realize that no matter which color wins, the winning color has a Markov Chain like this one. All colors are indistinguishable so we might as well consider the case where Blue wins.<\/p>\n<p>The next step is to compute transition probabilities. Here, we must be careful because we are conditioning on Blue winning. So we use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bayes%27_theorem\">Bayes&#8217; Rule<\/a> to compute the transitions. Given that there are $k$ Blue balls with $1 \\le k \\le N-1$, the probability that we transition $k\\to k+1$ is:<br \/>\n\\[<br \/>\nA_{k+1,k} = \\frac{\\mathbb{P}(k\\to k+1 \\text{, Blue wins})}{\\mathbb{P}(\\text{Blue wins})}<br \/>\n= \\frac{\\frac{k}{N}\\cdot \\frac{N-k}{N-1} \\cdot \\frac{k+1}{N}}{\\frac{k}{N}} = \\frac{(k+1)(N-k)}{N(N-1)}<br \/>\n\\]Similarly, the probability that we transition $k\\to k-1$ is:<br \/>\n\\[<br \/>\nA_{k-1,k} = \\frac{\\mathbb{P}(k\\to k-1 \\text{, Blue wins})}{\\mathbb{P}(\\text{Blue wins})}<br \/>\n= \\frac{\\frac{N-k}{N}\\cdot \\frac{k}{N-1} \\cdot \\frac{k-1}{N}}{\\frac{k}{N}} = \\frac{(k-1)(N-k)}{N(N-1)}<br \/>\n\\]The only other possibility is that we don&#8217;t transition at all, which is what happens the rest of the time. So $A_{k,k} = 1-A_{k+1,k}-A_{k-1,k}$. Simplifying the expressions, we obtain:<br \/>\n\\[<br \/>\nA_{k+1,k} = \\frac{(k+1)(N-k)}{N(N-1)},\\quad<br \/>\nA_{k-1,k} = \\frac{(k-1)(N-k)}{N(N-1)},\\quad<br \/>\nA_{k,k} = 1-\\frac{2k(N-k)}{N(N-1)}<br \/>\n\\]As before, the $k^\\text{th}$ column sums to 1. The only exception, as before, is the last column $A_{:,N}$, which is zero since the game ends once all colors are the same. The approach from here is identical to what we did when we used partitions. We can compute the probability of ending in $k$ turns by computing $\\left[ A^k \\right]_{N,1}$ and the expected number of turns is given by $\\left[ A(I-A)^{-2} \\right]_{N,1}$. Here are the distributions for $N=5$ and $N=8$.<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5-1024x422.png\" alt=\"\" width=\"840\" height=\"346\" class=\"aligncenter size-large wp-image-1976\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5-1024x422.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5-300x124.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5-768x317.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5-1200x495.png 1200w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist5.png 1384w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8-1024x422.png\" alt=\"\" width=\"840\" height=\"346\" class=\"aligncenter size-large wp-image-1975\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8-1024x422.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8-300x124.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8-768x317.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8-1200x495.png 1200w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8.png 1384w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>As we can see, the distribution looks similar as we increase $N$. Curiously, the mean always appears to be $(N-1)^2$. In the next section, we will show that this is indeed the case in general!<\/p>\n<h3>Analytic expressions<\/h3>\n<p>Writing out the transition matrix explicitly, we have:<br \/>\n\\[<br \/>\nA = \\begin{bmatrix}<br \/>\n1-\\frac{2(N-1)}{N(N-1)} &#038;   \\frac{1(N-2)}{N(N-1)} &#038;                          &#038;        &#038;                           &#038; 0 \\\\<br \/>\n  \\frac{2(N-1)}{N(N-1)} &#038; 1-\\frac{4(N-2)}{N(N-1)} &#038;   \\frac{2(N-3)}{N(N-1)}  &#038;        &#038;                           &#038; 0 \\\\<br \/>\n                        &#038;   \\frac{3(N-2)}{N(N-1)} &#038; 1-\\frac{6(N-3)}{N(N-1)}  &#038; \\ddots &#038;                           &#038; 0 \\\\<br \/>\n                        &#038;                         &#038;   \\frac{4(N-3)}{N(N-1)}  &#038; \\ddots &#038;   \\frac{(N-2)1}{N(N-1)}   &#038; 0 \\\\<br \/>\n                        &#038;                         &#038;                          &#038; \\ddots &#038; 1-\\frac{2(N-1)1}{N(N-1)}  &#038; 0 \\\\<br \/>\n                        &#038;                         &#038;                          &#038;        &#038;   \\frac{N\\cdot 1}{N(N-1)} &#038; 0<br \/>\n\\end{bmatrix}<br \/>\n\\]If we define $a_k$ to be the expected number of turns until the game ends given that we are currently at state $k$, we can write the recursion:<br \/>\n\\begin{align}<br \/>\na_k &#038;= 1 + A_{k+1,k} a_{k+1} + A_{k,k} a_k + A_{k-1,k} a_{k-1} \\quad\\text{for }k=1,\\dots,N-1 \\\\<br \/>\na_N &#038;= 0<br \/>\n\\end{align}Rearranging this expression, it looks roughly like $A^Ta+1=a$ (with the exception of the last row). Writing this as a single compact equation, we can factor things a bit and obtain a simpler equation:<br \/>\n\\begin{multline}<br \/>\n\\frac{1}{N(N-1)}<br \/>\n\\begin{bmatrix}N-1 &#038; &#038; &#038;\\\\ &#038; \\ddots &#038; &#038; \\\\ &#038; &#038; 2 &#038; \\\\ &#038; &#038; &#038; 1\\end{bmatrix}<br \/>\n\\begin{bmatrix}2 &#038; -1 &#038; &#038; \\\\ -1 &#038; 2 &#038; \\ddots &#038; \\\\ &#038; \\ddots &#038; \\ddots &#038; -1 \\\\ &#038; &#038; -1 &#038; 2\\end{bmatrix}\\\\<br \/>\n\\times \\begin{bmatrix}1 &#038; &#038; \\\\ &#038; 2 &#038; &#038; \\\\ &#038; &#038; \\ddots &#038; \\\\ &#038; &#038; &#038; N-1\\end{bmatrix}<br \/>\n\\begin{bmatrix}a_1 \\\\ a_2 \\\\ \\vdots \\\\ a_{N-1}\\end{bmatrix}<br \/>\n=<br \/>\n\\begin{bmatrix}1 \\\\ 1 \\\\ \\vdots \\\\ 1\\end{bmatrix}<br \/>\n\\end{multline}Or, simplified:<br \/>\n\\[<br \/>\n\\begin{bmatrix}2 &#038; -1 &#038; &#038; \\\\ -1 &#038; 2 &#038; \\ddots &#038; \\\\ &#038; \\ddots &#038; \\ddots &#038; -1 \\\\ &#038; &#038; -1 &#038; 2\\end{bmatrix}<br \/>\n\\begin{bmatrix}a_1 \\\\ 2a_2 \\\\ \\vdots \\\\ (N-1)a_{N-1}\\end{bmatrix}<br \/>\n=<br \/>\nN(N-1)\\begin{bmatrix}\\frac{1}{N-1} \\\\ \\frac{1}{N-2} \\\\ \\vdots \\\\ 1\\end{bmatrix}<br \/>\n\\]By performing an <a href=\"https:\/\/en.wikipedia.org\/wiki\/LU_decomposition\">LU decomposition<\/a>, we may instead solve the following system of equations in sequence:<br \/>\n\\begin{align}<br \/>\n\\begin{bmatrix} 1 &#038; &#038; &#038; &#038; \\\\ -\\frac{1}{2} &#038; 1 &#038; &#038; &#038; \\\\ &#038; -\\frac{2}{3} &#038; 1 &#038; &#038; \\\\ &#038; &#038; \\ddots &#038; \\ddots &#038; \\\\ &#038; &#038; &#038; -\\frac{N-2}{N-1} &#038; 1\\end{bmatrix}<br \/>\n\\begin{bmatrix} y_1 \\\\ y_2 \\\\ \\vdots \\\\ y_{N-2} \\\\ y_{N-1} \\end{bmatrix}<br \/>\n&#038;= N(N-1)\\begin{bmatrix}\\frac{1}{N-1} \\\\ \\frac{1}{N-2} \\\\ \\vdots \\\\ \\frac{1}{2} \\\\ 1\\end{bmatrix}\\\\<br \/>\n\\begin{bmatrix} 2 &#038; -1 &#038; &#038; &#038; \\\\ &#038; \\frac{3}{2} &#038; -1 &#038; &#038; \\\\ &#038; &#038; \\frac{4}{3} &#038; \\ddots &#038; \\\\ &#038; &#038; &#038; \\ddots &#038; -1 \\\\ &#038; &#038; &#038; &#038; \\frac{N}{N-1} \\end{bmatrix}<br \/>\n\\begin{bmatrix} a_1 \\\\ 2a_2 \\\\ \\vdots \\\\ (N-2)a_{N-2} \\\\ (N-1)a_{N-1} \\end{bmatrix}<br \/>\n&#038;= \\begin{bmatrix}y_1 \\\\ y_2 \\\\ \\vdots \\\\ y_{N-2} \\\\ y_{N-1}\\end{bmatrix}<br \/>\n\\end{align}The first system is easily solved for $y$ by forward-substitution. We first have $y_1=N$. Then, $y_2 = \\frac{N(N-1)}{N-2}+\\frac{1}{2}y_1$, and so on. The result we find is:<br \/>\n\\[<br \/>\ny_k = N(N-1)\\sum_{i=1}^k \\frac{i}{(N-i)k}<br \/>\n\\]The second system can be solved for $a$ by back-subsitution, starting from the final equation and working our way back up. Doing this, we find:<br \/>\n\\[<br \/>\na_k = \\sum_{j=1}^{N-k} \\frac{1}{k+j} y_{k+j-1}<br \/>\n\\]We may now combine both expressions and obtain:<br \/>\n\\[<br \/>\na_k = N(N-1) \\sum_{j=1}^{N-k} \\frac{1}{k+j} \\sum_{i=1}^{k+j-1} \\frac{i}{(N-i)(k+j-1)}<br \/>\n\\]This is a bit messy, but we only care about $k=1$ (the expected number of turns given that we start with only one blue ball and blue ends up winning). This sum can be simplified with a bit of work:<br \/>\n\\begin{align}<br \/>\na_1 &#038;= N(N-1) \\sum_{j=1}^{N-1} \\frac{1}{j(j+1)} \\sum_{i=1}^{j} \\frac{i}{(N-i)} \\\\<br \/>\n&#038;=  N(N-1) \\sum_{j=1}^{N-1} \\left( \\frac{1}{j}-\\frac{1}{j+1}\\right) \\sum_{i=1}^{j} \\frac{i}{(N-i)}<br \/>\n\\end{align}Define $Q_j := \\frac{1}{j+1}\\sum_{i=1}^j \\frac{i}{N-i}$ and the sum telescopes:<br \/>\n\\begin{align}<br \/>\na_1 &#038;= N(N-1)\\sum_{j=1}^{N-1} \\left( \\frac{1}{N-j} + Q_{j-1}-Q_j\\right)\\\\<br \/>\n&#038;= N(N-1)\\left( \\sum_{j=1}^{N-1}\\frac{1}{N-j}-Q_{N-1} \\right) \\\\<br \/>\n&#038;= N(N-1)\\left( \\sum_{j=1}^{N-1}\\frac{1}{N-j}-\\frac{1}{N}\\sum_{j=1}^{N-1}\\frac{j}{N-j} \\right) \\\\<br \/>\n&#038;= N(N-1) \\sum_{j=1}^{N-1}\\frac{1}{N} \\\\<br \/>\n&#038;= (N-1)^2<br \/>\n\\end{align}And this is precisely what we were trying to show! The expected number of turns for a game with $N$ balls is $(N-1)^2$. A similar expansion can be done to compute $a_k$ for $k\\ne 1$ but in this case there is only partial telescoping and we are left with<br \/>\n\\[<br \/>\na_k = (N-1)^2-\\frac{N(N-1)}{k}\\sum_{i=1}^k \\frac{k-i}{N-i}<br \/>\n\\]As $N$ gets large, the sum of reciprocals is well-approximated by a logarithm. If we denote $\\alpha = k\/N$ the fraction of balls that are blue, then the expected number of turns until all balls are blue is:<br \/>\n\\[<br \/>\n\\frac{a_k}{(N-1)^2} \\approx \\left(\\frac{1-\\alpha}{\\alpha}\\right)\\log\\left(\\frac{1}{1-\\alpha}\\right)<br \/>\n\\]Here is a scaled plot of this distribution of expected number of turns:<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_fraction.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_fraction.png\" alt=\"\" width=\"1002\" height=\"611\" class=\"aligncenter size-full wp-image-1987\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_fraction.png 1002w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_fraction-300x183.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_fraction-768x468.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<h3>A conjecture?<\/h3>\n<p>I was intrigued by the <em>distribution<\/em> of the number of turns rather than just the expected value. As seen in the plots above, the distribution converges to something, but it&#8217;s not clear what. And there doesn&#8217;t appear to be an easy way to compute or approximate powers of $A$ analytically. I suspect the distribution tends to a  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Log-normal_distribution\">log-normal distribution<\/a> as $N$ gets large because when plotted on a log scale, it sure looks close to normal:<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log.png\" alt=\"\" width=\"1346\" height=\"586\" class=\"aligncenter size-full wp-image-1988\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log.png 1346w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log-300x131.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log-768x334.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log-1024x446.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2017\/05\/colorful_balls_dist8_log-1200x522.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>If you have any thoughts, leave a comment below!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This Riddler puzzle about an interesting game involving picking colored balls out of a box. How long will the game last? You play a game with four balls: One ball is red, one is blue, one is green and one is yellow. They are placed in a box. You draw a ball out of the &hellip; <a href=\"https:\/\/laurentlessard.com\/bookproofs\/colorful-balls-puzzle\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Colorful balls puzzle&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1979,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[7],"tags":[6,18,20,8,15,2],"class_list":["post-1965","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-riddler","tag-counting","tag-linearity-of-expectation","tag-markov-chains","tag-probability","tag-recursion","tag-riddler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/comments?post=1965"}],"version-history":[{"count":27,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1965\/revisions"}],"predecessor-version":[{"id":2000,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1965\/revisions\/2000"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media\/1979"}],"wp:attachment":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media?parent=1965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/categories?post=1965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/tags?post=1965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}