21

Plum Pudding

21.1 THE PROBLEM

Problem 971 on p. 333 of the fifth edition of Whitworth’s Choice and Chance (published in 1901, with the first edition appearing in 1867) is as follows: “If a spherical plum pudding contains n indefinitely small plums, [then show that] the expectation of the distance of the nearest one from the surface is one (2n + 1)th of the radius.”

I was immediately attracted to this problem (as would be anyone, of course1), as I could see it offered a nice illustration of how the maximum of n independent random variables might occur in a “natural way” (you’ll see how, in just a bit). So, out came my pen, and in just a minute or so I had my answer. Alas, it wasn’t the book’s answer, but rather I calculated it to be “one (3n + 1)th of the radius.” Realizing that Whitworth was a pretty sharp fellow (this is the same Whitworth we encountered in the last problem on leads in ballot counting), my first reaction was that somewhere, I must have gone astray. But, try as I did, I couldn’t find where I had screwed up.

Then I had a heretical thought: Maybe the book is wrong. Maybe, I thought, it was just a mistake, with some long-dead typesetter’s finger hitting the 2 key instead of the 3 key, and then Whitworth not catching the typo when reading the page proofs of his book. But of course that was perhaps just a mere frantic, desperate speculation by me.

And then I had a happier thought—my quandary could be the basis for a perfect example of the value of computer simulation. The difference between the book’s answer and mine is such as to be easily distinguished by a simulation. For example, if n = 5, then the book’s answer is that the average distance from the surface of the plum nearest the surface is 1/11 = 0.09090 … of the radius, while my result was that it was 1/16 = 0.0625 of the radius. For n = 9, the book’s result is 1/19 = 0.05263 …, compared to my 1/28 = 0.03571. … Those are significant differences.

So, in this problem we’ll do the Monte Carlo simulation first, and then we’ll do a theoretical analysis. It should come as no surprise for you to learn that the code agrees extremely well with my answer and not with the one in Whitworth’s book (or else you wouldn’t be reading any of this!). His book’s answer is a typo. Before reading any further, see if you can derive the correct result.

21.2 COMPUTER SIMULATION

A simulation of Whitworth’s problem (an approach he could only have dreamed about in 1901) is very straightforward. With no loss in generality I’ll take a sphere with unit radius, center it on the origin of a three-dimensional x,y,z-coordinate system, and imagine it enclosed by a cube with edge length 2. To randomly place n plums in the sphere, we simply randomly place plums in the cube and work only with the ones that fall inside the sphere. That is, we’ll generate triples of numbers (x,y,z) with each number uniform from −1 to 1, but keep only those triples such that x2 + y2 + z2 < 1. We’ll keep doing this until we have n points (plums) inside the sphere.

Then we’ll save the value of the distance from the origin of the plum that is the furthest from the origin (and so closest to the surface) using MATLAB®’s max command. Then we’ll repeat the whole business for, say, a total of one million times, and take the average of the saved values.

Finally, to find the average distance from the surface of the plum closest to the surface (what Whitworth actually asked for), we’ll subtract our average distance (from the origin) from 1. The code plums.m does the job. When run with the values of n = 5 and n = 9, the code’s estimates for the average distance from the surface was 0.062499 … and 0.03575 …, respectively. Pretty good agreement with my theoretical result.

plums.m

n=input(‘What is n?’)

total=0;

for loop1=1:1000000

points=zeros(1,n);

for loop2=1:n

keeptrying=0;

while keeptrying==0

x=-1+2*rand;y=-1+2*rand;z=-1+2*rand;

d2=x2+y2+z2;

if d2<1

keeptrying=1;

end

end

points(loop2)=sqrt(d2);

end

total=total+max(points);

end

1-(total/loop1)

21.3 THEORETICAL ANALYSIS

Plums that are randomly (uniformly) distributed throughout a sphere of radius R will have a probability of appearing in any subvolume of the sphere that is directly proportional to the size of the subvolume. Thus, the probability a plum is distance r from the center of the sphere (in any direction) is given by the volume of a thin spherical shell of thickness Δr Ü R and radius r, normalized to the volume of the entire sphere (normalization makes the probability the plum is somewhere in the sphere equal to 1). This probability is, therefore,

Images

Now, let Z be the random variable representing the distance from the origin to a plum, and fZ(r) be the probability density function of Z. Then this same probability is also given by

fZ(rr,

and so

Images

The distribution function of Z is then given by

Images

From our earlier work in Problem 16 we know that if V is the maximum of n independent random variables, each with the distribution FZ(r), then the distribution of V is

Images

Thus, the probability density of V is

Images

So, the expected value of the distance from the origin of the most distant plum is

Images

Finally, the expected distance of the plum most distant from the center of the sphere, from the surface of the sphere (this is the plum closest to the surface), is

Images

as claimed.

NOTE

1. When I told my wife about this problem one morning, she (at first) listened attentively but, after only a minute or so, her eyes began to roll back and her head dropped onto her chest. Concerned, I asked if she was okay. She replied with a loud (simulated) snore. I responded by telling her that I was never again going to tell her of my math problems, to which she tossed off a quick “Is that a promise?” But then she relented and added, “But of course I can see how a baker would be interested in such a thing as where the plums are.” Since you are reading this I’m pretty sure you agree with me and not with my wife.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset