## December 2019

—————————

My December diary included the following brainteasers.

(1) Supposenballs are randomly thrown intobboxes. What is the probability a given box contains exactlykballs?

If that's too easy, try this enhanced version:

(2) Suppose a box containsNballs,Kof which are red. The remainder are blue. You drawnballs without replacement. What is the probability exactlykof them are red?

—————————

**• Solutions**

The logic is pretty much the same for all problems of this kind. I'll take the first one.

Fix your attention on some one particular box: Call it Ben.

(1) From Ben's point of view, what are the possible outcomes from *one* throw? That's easy: The ball lands in Ben with probability
1/*b*; the ball *doesn't* land in Ben with probability (1 − 1/*b*).

(2) Now construct a *particular* scenario for *n* ball throws. Here's a very simple one: The first *k* throws land in
Ben, none of the other (*n* − *k*) throws do. What's the probability of this? Easy: You just multiply all the one-throw
probabilities: the scenario has probability 1/*b* to the power *k* times (1 − 1/*b*) to the power
(*n* − *k*). Let's call that probability *P*.

(3) But that's just *one* possible scenario for Ben getting *k* balls. Instead of getting the
first *k* balls thrown, he might get the last
*k*, or any *k* of the *n*. Any particular case has probability *P*,
but how many cases are there?

(4) So I need to multiply *P* by something to get a bigger probability, to allow for all the different ways *k* balls could
land in Ben. What's the number I need to multiply by? It's the number of ways of picking *k* items from a collection of *n*.

(5) That's a number well-known in math and basic to all problems like this. It has a name: "the
binomial coefficient *n*, *k*." It has at least
two notations, as described in the Mathworld link there. The "tall parentheses" is now standard, but Mathworld also allows
* _{n}C_{k}* and I remember from my schooldays learning

*.*

^{n}C_{k}So how do you work out * _{n}C_{k}*, the number of ways of picking

*k*items from a collection of

*n*?

First you need to recall the *factorial* of a positive whole number, written as *N*! and defined to be the product of all the
positive whole numbers up to and including *N*. So factorial 5 is written 5! and is equal to 1×2×3×4×5, which works out
to 120.

Now I can tell you that * _{n}C_{k}* is

*n*!/((

*n*−

*k*)!×

*k*!).

So if you have five items {apple, orange, pear, plum, kiwi}, the number of ways to select two of them is 5!/(3!×2!). Since 5! is 120, 3! is 6, and 2! is 2, that works out to ten. Sure enough: {apple, orange}, {apple, pear}, {apple, plum}, {apple, kiwi}, {orange, pear}, {orange, plum}, {orange, kiwi}, {pear, plum}, {pear, kiwi}, {plum, kiwi}. That's ten.

(I'm assuming here that we don't care about order of pick. {pear, plum} and {plum, pear} are the same thing for our purposes. If order of pick matters, the arithmetic is different. For the problems we're working on, order of pick doesn't matter.)

(6) So final answer: *n*!/((*n* − *k*)!×*k*!) times *P*, where *P* is
1/*b* to the power *k* times (1 − 1/*b*) to the power (*n* − *k*).

The second problem proceeds along similar lines, for a solution *n*!/((*n* − *k*)!×*k*!)
times *K*/*N* to the power *k* times (1 − *K*/*N*) to the power
(*n* − *k*).

[Added later. Wrong! I was lazy there, after dealing so briskly with Problem 1, in not thinking Problem 2 through, as I should have done. The probability here is actually the ratio of

• numerator: the number of ways of getting exactlykred balls from theKavailable,

• denominator: the number of ways of pickingnballs from theNavailable.

That denominator is of course just. The numerator is the number of ways of getting_{N}C_{n}kred balls times the number of ways of getting (n−k) blue balls:times_{K}C_{k}_{(N − K)}C_{(n − k)}.]