# Inconsistent results with Monte Carlo solutions to similar problems in probability

I am presently going through the book Fifty Challenging Problems in Probability with Solutions and implementing Monte Carlo solutions to most of the problems in R to get familiar with the language, and have come to a puzzling inconsistency in what is effective for getting the right answers. Consider the following problem, #39:

In a laboratory, each of a handful of thin 9-inch glass rods had one tip marked with a blue dot and the other with a red. When the laboratory assistant tripped and dropped them onto the concrete floor, many broke into three pieces. For these, what was the average length of the fragment with the blue dot?

To solve this problem, I drew three numbers from the continuous uniform distribution offered by R, each on the default interval [0,1]. These were summed and then the quotient of the first of these numbers to the total times nine was returned. The process was then repeated many times in the typical Monte Carlo fashion to give a very nearly correct answer: ~2.99 inches. I then went on to attempt a similar approach with problem #42:

(a) If a stick is broken in two at random, what is the average length of the smaller piece? (b) (For calculus students.) What is the average ratio of the smaller length to the larger?

In this case, for (a), only two numbers were drawn to represent the lengths of the two pieces and the quotient of the smaller of the two to the total was returned. (No explicit length was ever given and so the idea is to deal with fractions of the original intact stick's length.) A similar procedure was carried out for (b). Both procedures returned incorrect results. The answers given for (a) and (b) respectively were ~0.307 and almost exactly 0.5.

What was effective for (a) was generating a single number from the uniform distribution described above, calling it $\text{split}$, and then, if $\text{split}$ was less than 0.5, returning that number, or else returning $1 - \text{split}$. Such a procedure was also carried out for (b), returning $\frac{\text{split}}{1 - \text{split}}$ if $\text{split}$ was less than 0.5 or else returning $\frac{1 - \text{split}}{\text{split}}$. Both of these returned very nearly correct answers, respectively: ~0.25 and ~0.386.

I can't account for this inconsistent behavior. What is the cause? I have a faint inkling some sort of degrees of freedom issue is involved here but that doesn't explain why the solution to the first one was effective.

• The inconsistency in question is that, in the first problem, I can generate three random numbers and normalize their lengths to sum to 9 to serve as the three parts of the broken stick, and get the right answer, but, in the latter, I cannot generate two random numbers to serve as the lengths of the two parts of the broken stick, but need the other method I described above. – readyready15728 Jul 12 '16 at 18:42
• You got lucky in your solution to the first problem. The reason the answer is $3$ is wholly unrelated to your simulation. Your simulation accidentally produces $3$ as the answer because you have generated three identically distributed variables $U_1,U_2,U_3$ and computed the expectation of $U_1/(U_1+U_2+U_3)$. Replacing $U_1$ in the numerator by $U_2$ or $U_3$ will give the same expectation--but since the sum of those three fractions is $1$, obviously each expectation must equal $1/3$. You could have given the $U_i$ literally any distribution supported on the positive real numbers! – whuber Jul 12 '16 at 18:48
• A better approach is to formulate a probability model based on your analysis of each question. As you have seen, merely getting the right answer is no indication that you have performed an adequate or correct analysis. – whuber Jul 12 '16 at 19:18
• Well, in real life, that would not surprise me at all but the book assumes an "ideal" glass rod—insert the old joke about a spherical horse moving in simple harmonic motion. The goal here is not to achieve the most empirically realistic outcome but one that mirrors in the Monte Carlo world the analytic solutions given and their respective assumptions. Until now I have had relatively little difficulty and no occasion to ask any questions until fairly close to the end. The mappings between the problem descriptions and solutions have been quite clear other than in this instance. – readyready15728 Jul 12 '16 at 19:36
• I essentially agree with this. For instance, one problem asks how likely it is that a random chord drawn across a circle is longer than the radius. The solutions section offers three different ways of interpreting this problem and when I looked at it, it was clear that I had in fact implemented the third: "Assume that the chord is determined by two points chosen so that their positions are independently evenly distributed over the circumference of the original circle", rather than one of the others, and gotten the according answer. These details are not lost on me. – readyready15728 Jul 12 '16 at 19:44