5

Big Quotients—Part 1

5.1 THE PROBLEM

This is the first part of a two-part problem and so, of course, this will be the easy part. But don’t skip it! Understanding what we do here will be a big help in understanding the second part. Here’s the question: pick a number at random (uniformly), from 0 to 1. Pick another number, also at random (uniformly), from 0 to 1. What is the probability that if you divide the larger number by the smaller one the answer will be greater than 2? Greater than 3? More generally, greater than k, where k ≥ 1?

Before I show you how to answer these initial questions, let me tantalize you with a generalization of them that we’ll tackle in “Big Quotients—Part 2” later in the book (Problem 16). Pick N numbers, each independently and randomly (uniformly), from 0 to 1. What is the probability that if you divide the largest of these N numbers by the smallest, the answer will be greater than k, where k ≥ 1? The original question is obviously the N = 2 special case of this generalized version; if we can get the answer to the first question, then we can use it as a check on the answer to the generalized question.

5.2 THEORETICAL ANALYSIS

Let’s call our two numbers, each picked at random from 0 to 1, X1 and X2. We don’t know which is the larger, so if we agree to always calculate X2/X1, then we are interested in both the probability X2/X1 > k (which accounts for the case X2 > X1) and the probability X2/X1 < 1/k (which accounts for the case X2 < X1). A more elegant way to express this is with a double inequality, as 1 − Prob(1/kX2/X1k), k ≥ 1.

Images

Figure 5.2.1. The unshaded area is where 1/kX2/X1k.

In Figure 5.2.1 I’ve drawn a two-axis coordinate system, with X2 on the vertical axis and X1 on the horizontal axis. Each point in the unit square in the first quadrant represents a way that X1 and X2 can take on their values, and the unit area inside that square represents the totality of all possible values for X1 and X2. That area of the square is the sample space for our problem. The entire unit area, therefore, has probability 1 (some point in that area, with coordinates X2, X1 is certain to occur). The central, unshaded area in the square is the area associated with the double inequality 1/kX2/X1k, because that is the area containing all the points such that X2kX1 and X2 ≥ (1/k) X1 (that is, all the points both below the line X2 = k X1 and above the line X2 = (1/k) X1 are in the unshaded area).

The probability associated with the unshaded area is just that area itself, because X1 and X2 are uniformly distributed (this is the fundamental assumption behind what is called geometric probability). The probability we are after is the probability that we are not in the unshaded area but rather in the shaded area, and that probability is the total area of the shaded regions. By elementary geometry, that area is 2(1/2)(1)(1/k) = 1/k. Okay, that’s it, we are done! Our answer is

Prob(“larger number divided by smaller number > k”) = Images.

5.3 COMPUTER SIMULATION

The code ratio1.m simulates ten million selections of X1 and X2, and keeps track (in total) of how many times the larger divided by the smaller gives a result (r, for ratio) greater than 2. If we simply change the test on r to different values of k, we can easily check our theoretical result, as shown in Table 5.3.1, with pretty good agreement.

ratio1.m

total=0;

for loop=1:10000000

x1=rand;x2=rand;

k=2;

r=x2/x1;

if r>k|r<1/k

total=total+1;

end

end

total/10000000

Table 5.3.1. Theory versus ‘experimentation’ (N = 2)

k

theory

simulation

2

0.5000000

0.4997159

3

0.3333300

0.3333913

4

0.2500000

0.2500693

5.5

0.1818181

0.1817171

An easy modification to ratio1.m lets us simulate the second question, too, so let’s do that before we eventually do its theoretical analysis in Problem 16. The new code, ratio2.m, is for the next step up in complexity situation, when we pick N = 3 numbers independently at random (uniformly) from 0 to 1, and divide the largest by the smallest.

ratio2.m

total=0;

for loop=1:10000000

for j=1:3

x(j)=rand;

end

k=2;

r=max(x)/min(x);

if r>k|r<1/k

total=total+1;

end

end

total/10000000

The results for the same values of k that I used in Table 5.3.1 are shown for this situation in Table 5.3.2. You can see there is a significant difference in the N = 3 case compared to the N = 2 case. To see if these results agree with theory, we need to do some more theory! We’ll come back to this in Problem 16.

Table 5.3.2. Just ‘experimentation’ at this point in the book (N = 3)

 k

theory

simulation

2

?

0.7498262

3

?

0.5553961

4

?

0.4372493

5.5

?

0.3306806

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

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