# Math Q&A Part 2

#### CRGreathouse

Forum Staff
I think the constraint at most 5 does affect the result. Now, we can't do 6,6,8,0,...,0, which is an extra option.
No, it really shouldn't affect the result. Once you get 5 in one urn, your answer under the original problem will be 5. Under the revised problem it might be 8 (as in your example) or really any number from 5 to 20, but if we just re-label all those results as 5 we'll get the same answer as the original problem.

#### CRGreathouse

Forum Staff
For me the most natural approach is to track only the number of urns at each fill level. To start we have 14 urns with 0 balls, 0 urns with 1 ball, ..., 0 urns with 5 balls = [14, 0, 0, 0, 0, 0]. After we throw one in we have [13, 1, 0, 0, 0, 0]. After another we have 1/14 probability to have [13, 0, 1, 0, 0, 0] and 13/14 probability to have [12, 2, 0, 0, 0, 0].

#### Pero

Please can you list randomly 27 out of the 243 possibilities or even all the 243?
Im asking you because I still do not understand your approach.

Thank you.
Let's label the balls $$\displaystyle b_1, \ b_2 \ \dots \ b_5$$

This is like 5 variables that can all take the values 1-3.

So, we have $$\displaystyle 3^5$$ possibilities.

How many of these have at most 2 balls in any urn?

Well, there must be 1 ball in one urn and 2 balls in each of the other two. This is what I called a general pattern in earlier posts. (1, 2, 2)

This pattern can occur in three ways: the single ball can be in U_1, U_2 or U_3.

These are all equally likely, so I'll work out it for the single ball in U1 and then multiply by 3.

The ball in the first urn can be any of b_1 to b_5; then there are 6 options for the pair in the second urn and that determines the pair in the third urn.

In any case, there are 30 possibilities here. Lots of ways to work this out.

So, we have 3 x 30 = 90 possibilities for this general pattern (1, 2, 2)

So, the probability we have no more than 2 balls in any urn in 90/243.

Does that make sense?

#### mobel

Let's label the balls $$\displaystyle b_1, \ b_2 \ \dots \ b_5$$

This is like 5 variables that can all take the values 1-3.

So, we have $$\displaystyle 3^5$$ possibilities.

How many of these have at most 2 balls in any urn?

Well, there must be 1 ball in one urn and 2 balls in each of the other two. This is what I called a general pattern in earlier posts. (1, 2, 2)

This pattern can occur in three ways: the single ball can be in U_1, U_2 or U_3.

These are all equally likely, so I'll work out it for the single ball in U1 and then multiply by 3.

The ball in the first urn can be any of b_1 to b_5; then there are 6 options for the pair in the second urn and that determines the pair in the third urn.

In any case, there are 30 possibilities here. Lots of ways to work this out.

So, we have 3 x 30 = 90 possibilities for this general pattern (1, 2, 2)

So, the probability we have no more than 2 balls in any urn in 90/243.

Does that make sense?
It make sense only if you are assuming that any of the 3 urns could contain 5 balls.
If it is the case then it is ok. No problem then.

#### Pero

It make sense only if you are assuming that any of the 3 urns could contain 5 balls.
If it is the case then it is ok. No problem then.
Suppose we played your original game: 20 balls, 14 urns and (to prove my point) let's assume each urn can contain only 2 balls!

For each ball I choose an urn at random and put a ball in it. If I do this for all 20 balls without choosing the same urn three times, I win. But, if I choose an urn and there are already two balls in it, then you win.

So, we start playing:

Usually, sadly, I lose. I get so far, but always I end up picking the same urn for a 3rd time and you win.

Eventually, however, I get lucky and get all 20 balls in urns (at most 2 in each).

We play this game for a long time and see how many times we each win. I reckon you win 98.69% of the time, but that's not the point.

The point is that it doesn't matter whether the urns can hold 2, 3, 5 or 20 balls. I lose as soon as I go beyond 2 on any urn. And, if I win, then how big the urns are doesn't matter (I only need room for 2 balls in each).

So, it's the same game, with the same odds of winning and losing regardless of how big the urns are.

And, the odds of your winning this game is the same as your original question.

Last edited:

#### mobel

In this case you do not needs urns.
Just pick randomly 20 times values from 1 to 14 and if you pick any number 3 times it will be a sucess. If you run out of your 20 times and you did not succeed to 3 times the same number it will be a failure.
Or you roll 20 times a die 14-sided ....
You could use Bernoulli law.

#### mobel

This problem too seems to go nowhere.
I made simulations and I have the results (98% for at least 3 and 58% for at least 4) but for now no precise solution was given.

Thank you all.

1 person

#### Hoempa

Math Team
mobel said:
Please can you list randomly 27 out of the 243 possibilities or even all the 243?
I was a bit curious to but below is a list. The first three numbers are the urns with their respective number of balls. The fourth is the number n I used to find the balls in the urn.
(repeat five times: put a ball in urn (n mod 3)+1 then set n = floor(n/3).)

So for example 0, 2, 3 occurs more than once. In my solution it only occurs once. Erasing all solutions that have one urn with four or five balls seems to change the requested chance; both numerator and denominator are decreased by a constant such that the chance decreases. I might be solving a different task or misunderstand.
Code:
0, 0, 5, 242	0, 1, 4, 161	0, 1, 4, 215
0, 1, 4, 233	0, 1, 4, 239	0, 1, 4, 241
0, 2, 3, 134	0, 2, 3, 152	0, 2, 3, 158
0, 2, 3, 160	0, 2, 3, 206	0, 2, 3, 212
0, 2, 3, 214	0, 2, 3, 230	0, 2, 3, 232
0, 2, 3, 238	0, 3, 2, 125	0, 3, 2, 131
0, 3, 2, 133	0, 3, 2, 149	0, 3, 2, 151
0, 3, 2, 157	0, 3, 2, 203	0, 3, 2, 205
0, 3, 2, 211	0, 3, 2, 229	0, 4, 1, 122
0, 4, 1, 124	0, 4, 1, 130	0, 4, 1, 148
0, 4, 1, 202	0, 5, 0, 121	1, 0, 4, 80
1, 0, 4, 188	1, 0, 4, 224	1, 0, 4, 236
1, 0, 4, 240	1, 1, 3, 53 	1, 1, 3, 71
1, 1, 3, 77  	1, 1, 3, 79 	1, 1, 3, 107
1, 1, 3, 143	1, 1, 3, 155	1, 1, 3, 159
1, 1, 3, 179	1, 1, 3, 185	1, 1, 3, 187
1, 1, 3, 197	1, 1, 3, 209	1, 1, 3, 213
1, 1, 3, 221	1, 1, 3, 223	1, 1, 3, 227
1, 1, 3, 231	1, 1, 3, 235	1, 1, 3, 237
1, 2, 2, 44	        1, 2, 2, 50	        1, 2, 2, 52
1, 2, 2, 68 	1, 2, 2, 70         1, 2, 2, 76
1, 2, 2, 98 	1, 2, 2, 104	1, 2, 2, 106
1, 2, 2, 116	1, 2, 2, 128	1, 2, 2, 132
1, 2, 2, 140	1, 2, 2, 142	1, 2, 2, 146
1, 2, 2, 150	1, 2, 2, 154	1, 2, 2, 156
1, 2, 2, 176	1, 2, 2, 178	1, 2, 2, 184
1, 2, 2, 194	1, 2, 2, 196	1, 2, 2, 200
1, 2, 2, 204	1, 2, 2, 208	1, 2, 2, 210
1, 2, 2, 220	1, 2, 2, 226	1, 2, 2, 228
1, 3, 1, 41 	1, 3, 1, 43 	1, 3, 1, 49
1, 3, 1, 67 	1, 3, 1, 95 	1, 3, 1, 97
1, 3, 1, 103	1, 3, 1, 113	1, 3, 1, 115
1, 3, 1, 119	1, 3, 1, 123	1, 3, 1, 127
1, 3, 1, 129	1, 3, 1, 139	1, 3, 1, 145
1, 3, 1, 147	1, 3, 1, 175	1, 3, 1, 193
1, 3, 1, 199	1, 3, 1, 201	1, 4, 0, 40
1, 4, 0, 94 	1, 4, 0, 112	1, 4, 0, 118
1, 4, 0, 120	2, 0, 3, 26 	2, 0, 3, 62
2, 0, 3, 74 	2, 0, 3, 78 	2, 0, 3, 170
2, 0, 3, 182	2, 0, 3, 186	2, 0, 3, 218
2, 0, 3, 222	2, 0, 3, 234	2, 1, 2, 17
2, 1, 2, 23 	2, 1, 2, 25 	2, 1, 2, 35
2, 1, 2, 47 	2, 1, 2, 51 	2, 1, 2, 59
2, 1, 2, 61 	2, 1, 2, 65 	2, 1, 2, 69
2, 1, 2, 73 	2, 1, 2, 75 	2, 1, 2, 89
2, 1, 2, 101	2, 1, 2, 105	2, 1, 2, 137
2, 1, 2, 141	2, 1, 2, 153	2, 1, 2, 167
2, 1, 2, 169	2, 1, 2, 173	2, 1, 2, 177
2, 1, 2, 181	2, 1, 2, 183	2, 1, 2, 191
2, 1, 2, 195	2, 1, 2, 207	2, 1, 2, 217
2, 1, 2, 219	2, 1, 2, 225	2, 2, 1, 14
2, 2, 1, 16 	2, 2, 1, 22 	2, 2, 1, 32
2, 2, 1, 34 	2, 2, 1, 38 	2, 2, 1, 42
2, 2, 1, 46 	2, 2, 1, 48 	2, 2, 1, 58
2, 2, 1, 64 	2, 2, 1, 66 	2, 2, 1, 86
2, 2, 1, 88 	2, 2, 1, 92 	2, 2, 1, 96
2, 2, 1, 100	2, 2, 1, 102	2, 2, 1, 110
2, 2, 1, 114	2, 2, 1, 126	2, 2, 1, 136
2, 2, 1, 138	2, 2, 1, 144	2, 2, 1, 166
2, 2, 1, 172	2, 2, 1, 174	2, 2, 1, 190
2, 2, 1, 192	2, 2, 1, 198	2, 3, 0, 13
2, 3, 0, 31 	2, 3, 0, 37 	2, 3, 0, 39
2, 3, 0, 85 	2, 3, 0, 91 	2, 3, 0, 93
2, 3, 0, 109	2, 3, 0, 111	2, 3, 0, 117
3, 0, 2, 8   	3, 0, 2, 20 	3, 0, 2, 24
3, 0, 2, 56 	3, 0, 2, 60         3, 0, 2, 72
3, 0, 2, 164	3, 0, 2, 168	3, 0, 2, 180
3, 0, 2, 216	3, 1, 1, 5   	3, 1, 1, 7
3, 1, 1, 11 	3, 1, 1, 15 	3, 1, 1, 19
3, 1, 1, 21 	3, 1, 1, 29 	3, 1, 1, 33
3, 1, 1, 45 	3, 1, 1, 55 	3, 1, 1, 57
3, 1, 1, 63 	3, 1, 1, 83 	3, 1, 1, 87
3, 1, 1, 99 	3, 1, 1, 135	3, 1, 1, 163
3, 1, 1, 165	3, 1, 1, 171	3, 1, 1, 189
3, 2, 0, 4   	3, 2, 0, 10 	3, 2, 0, 12
3, 2, 0, 28 	3, 2, 0, 30 	3, 2, 0, 36
3, 2, 0, 82 	3, 2, 0, 84 	3, 2, 0, 90
3, 2, 0, 108	4, 0, 1, 2   	4, 0, 1, 6
4, 0, 1, 18 	4, 0, 1, 54 	4, 0, 1, 162
4, 1, 0, 1           4, 1, 0, 3   	4, 1, 0, 9
4, 1, 0, 27 	4, 1, 0, 81 	5, 0, 0, 0`

1 person

#### mobel

Thank you for all.
My goal in fact was how to avoid simulations or even a complicate and full solution.
Can we use elementary reasoning to obtain an approximated solution not only for this problem in particular but for others too ?

#### Pero

Thank you for all.
My goal in fact was how to avoid simulations or even a complicate and full solution.
Can we use elementary reasoning to obtain an approximated solution not only for this problem in particular but for others too ?
You have 3 parameters: number of urns (u), number of balls (b) and maximum balls in any urn (m). (I think it's been established that the size of the urns does not matter).

For any specific u, b and m, you can solve it using my technique, but it can get very long and tedious.

It was okay for u = 14, b = 20 and m = 2. But when m = 3, it would take a lot of calculations.

If you are looking for a general formula invovling u, b and m, I think that would be hard.

Similar Math Discussions Math Forum Date
General Math
General Math
General Math
General Math