PDA

View Full Version : Generic Probablility Question


magiluke
07-02-2005, 03:04 PM
Ok... I was playing around with some things at work (I was bored), and I came across this situation:

You randomly determine two numbers from 1-100 (inclusive), and then randomly determine a number between those two numbers (again, inclusive). What is the probablity that any number is picked? Now, I could figure it out somewhat manually, but that would take days. I'm just wondering if there's an easy way to figure this out (without writing a program that does ten million runs; I could do it that way if I want =/ ).

GTSamIAm
07-02-2005, 05:07 PM
You would get some function of probability that takes a number between 1 and 100. Obviously numbers in the middle are more likely. 50 and 51 should be equally likely and the most likely. The probability function must be even over x = 50.5. The probability of 1 or 100 is zero. The summation of the probability function from 1 to 100 should equal 1, not the integral from 1 to 100. These are just a few characteristics the probability function must possess. Please check me though.

EDIT: In math language...:

P(n) is an even function that takes numbers between 1 and 100, although designed for integers between 1 and 100, it can take non-integers, i.e, 50.5.
P(1) = 0
P(100) = 0
P(50-k) = P(51+k), where k is an integer between 1 and 49
max(P(k)) = P(50.5)
(Can't draw a sigma summation sign) (100(Sigma)k=1 P(k)) = 1

magiluke
07-02-2005, 06:55 PM
I was thinking integers, but you took it to that next level =D

GTSamIAm
07-02-2005, 08:03 PM
Let's look at which numbers and how many numbers are in between each two number combination. Adding up how many numbers are in between each two number combination each time will give us the total number of combinations of numbers in between a two number combination 1-100. For ease, I broke them down to sets of the first number. There are 99 sets.

100-99 there are zero,100-98 there is 99 (1 number),100-97 there is 99-98 (2 numbers) ... 100-1 there are 99-2 (98 numbers)
99-98 there are zero,99-97 there is 98 (1 number),99-96 there are 98-97 (2 numbers) ... 99-1 there are 98-2 (97 numbers)
......
4-3 there are zero,4-2 there is 3 (1 number), 4-1 there are 3-2 (2 numbers)
3-2 there are zero,3-1 there is 2 (1 number)
2-1 there are zero

Let’s skip finding the total number of numbers in between every 2 number combination for the moment. For all the combinations involving 100, you have 99 then 99-98 then 99-97 then 99-96 until 99-2. So now we need to figure out how many times each number is in between any two numbers. We can tally up each set and add all the tallies:

2: |
3: ||
4: |||
...
97: 96 tallies
98: 97 tallies
99: 98 tallies

Then do it again for the next set:

2: |
3: ||
4: |||
...
96: 95 tallies
97: 96 tallies
98: 97 tallies

Get the picture? No? Let's tally up a similar pattern for just 3 numbers. 3 numbers has 3 sets. I put each set side by side.

1: | | |
2: || ||
3: |||

Notice 1 adds up to 3. 2 adds up to 4. 3 adds up to 3. Let's do it for 4 and see if we can find a pattern:

1: | | | | = 4
2: || || || = 6
3: ||| ||| = 6
4: |||| = 4

Now 5:

1: | | | | | = 5
2: || || || || = 8
3: ||| ||| ||| = 9
4: |||| |||| = 8
5: ||||| = 5

One last time for 6:

1: | | | | | | = 6
2: || || || || || = 10
3: ||| ||| ||| ||| = 12
4: |||| |||| |||| = 12
5: ||||| ||||| = 10
6: |||||| = 6

Notice a pattern? It's even, just like we predicted. That's good news. Let's look at the last one. For 1, there are 6 groups of 1, then 5 groups of 2, then 4 groups of 3, then 3 groups of 4, then 2 groups of 5, then 1 group of 6. Holy Batman! That's how we learned multiplication in grade school!

So we found the pattern. For ours, there are 98 numbers possible that are between 2 numbers 1-100, these are 2-99. So when we did 6 numbers we started with 6 groups of 1, with 98 numbers we will start with 98 groups of 1. We ended with 1 group of 6, so here we will end with 1 group of 98. Here are how many times each number occurs out of the total possible combinations:

2: 98 * 1
3: 97 * 2
4: 96 * 3
...
97: 3 * 96
98: 2 * 97
99: 1 * 98

So let's make a formula. You get how many times a number will appear if you take in that number. Looking at the picture above it should be:

C(n) = (100-n)(n-1)

Let's check to make sure it agrees with our initial assumptions. 1 and 100 are impossible. We get zero. Good. Let's see that 50 and 51 have the same number of chances. We get (100-50)(50-1) = (50)(49) for 50 and (100-51)(51-1) = (49)(50) for 51. Incredible. All we need is the probability. We just take the number of times a number will appear divided the total number of numbers between every 2 number combination. So let’s find how many of those there are.

Look up a little bit and let’s make a sum for what we just found. It looks like this:

(98(Sigma)U=1 (99-U)(U)

Amazing. So the probability is the number of times one of those numbers will happen, which we found, divided by the total number of possibilities. So we get:

P(n) = ((100-n)(n-1)/ (98(Sigma)U=1 (99-U)(U)))

We can generalize this for any two numbers, where M is the max number and L is the least number:

P(n) = ((M-n)(n-L)/ ((M-2)(Sigma)U=L (M-1-U)(U)))

I don't have time to check my assumption that the sum of probabilities equals one. Someone check it or I'll do it later to confirm this. But this should be correct. If someone has studied combinatorics, this could be done much more quickly and easily, however. But anyone can understand this logic and steps.

SheetWise
07-03-2005, 12:59 AM
You wrote -

"You randomly determine two numbers from 1-100 (inclusive), and then randomly determine a number between those two numbers (again, inclusive). What is the probablity that any number is picked?"

Break it into two parts.

1. Pick two random numbers 1-100 inclusive (no mention of replacement, I'll assume not). If the low number is R1, and the high number is R2, then the range of the random pick (inclusive) is (R2-R1)+1.

2. The second part of the question is meaningless, since if the number is selected from the range at random -- every number in the range has an equal probability.

So, the question is really defining the probability that any number will fall within the range.

SheetWise

GTSamIAm
07-03-2005, 09:56 AM
Um, that's what I did. You can't do this traditionally and do something easy and say 1/50. A way everyone can understand is to get every single possible combination. That's what I did. And by the way, just looking at my own post the sum on the bottom is not from 1 to 98, it should be from 2 to 99. And the general form should not be from U to M-2, it should be from U+1 to M-1.