### Brain Teasers

# Random Numbers with Constraints

Probability
Probability puzzles require you to weigh all the possibilities and pick the most likely outcome.

Generate two random numbers from 1 to 9, inclusive. Call them n1 and n2. What is the probability that | n1 - n2 | > 5?

### Answer

12/81Since you are making two choices of 9 numbers each, there are 81 total possible combinations (9 x 9).

The only combinations that have a difference greater than 5 are:

9 and 1, 2, or 3

8 and 1 or 2

7 and 1

This makes six combinations, but you also have to take them in the reverse order (i.e. 1 and 9 is a different combination than 9 and 1). This makes a total of 12 possibilities, making the probability 12 in 81.

Hide Answer Show Answer

## What Next?

**Solve a Similar Brain Teaser...**

Or, get a random brain teaser.

If you become a registered user you can vote on this brain teaser, keep track of

which ones you have seen, and even make your own.

## Comments

Huh? Oh wait... || means absolute value. It's been so long that I forgot about that.

I like that. Simple but makes you think. Do me another one!

I liked that one, too. You can simplify 12/81, I think.

Yes, you can. To 4/27.

I only came up with half as many. 9-1 is greater than 5, but 1-9 is not.

i think that isn't called combination. if 1-9 is the same as 9-1 then it is combination. but if 1-9 is not the same as 9-1 then it called permutation.

The answer is 9/64 = 0.140625.

The answer 12/81 (0.148148148...) WOULD be correct IF the problem had stated two random integers instead of two random numbers.

With two random numbers, it's only possible for the difference to be greater than 5 if the lower number is less than 9-5 = 4 and the higher number is greater than 1+5=6. Each of these has a (4-1)/(9-1) = 3/8 probability. Either the first or second number can be in the low range, giving a (3/^2 * 2 = 18/64 probability. Of these cases, if n is the low number then the probability varies with from 1 to 0 as n moves from 1 to 4. This gives an average probability of 1/2, so the probability that |n1 - n2| > 5 is (18/64)*(1/2) = 9/64.

The answer 12/81 (0.148148148...) WOULD be correct IF the problem had stated two random integers instead of two random numbers.

With two random numbers, it's only possible for the difference to be greater than 5 if the lower number is less than 9-5 = 4 and the higher number is greater than 1+5=6. Each of these has a (4-1)/(9-1) = 3/8 probability. Either the first or second number can be in the low range, giving a (3/^2 * 2 = 18/64 probability. Of these cases, if n is the low number then the probability varies with from 1 to 0 as n moves from 1 to 4. This gives an average probability of 1/2, so the probability that |n1 - n2| > 5 is (18/64)*(1/2) = 9/64.

Arrg! Of course instead of the smiley face above it should read [3/8]^2*2 = 18/64

## Follow Braingle!