## Monday, 20 January 2014

### Lecture 2

There are some good Wikipedia articles on topics that we are covering. The one on the Birthday Problem is nice. You will find in that article more than ever thought it would be possible to say about such a simple problem. The article explains that the problem is not just of recreational interest — it is relevant to several hashing algorithms in computer science.

Here is a quiz to test your understanding. Complete the following sentence:

There are several ways to count the number of distinct injective functions that map elements of a set $N=\{1,\dotsc,n\}$ to elements of a set $X=\{1,\dotsc,x\}$. This is because ...

You might like to look at the Wikipedia article about the Twelvefold Way classification system for counting functions between two finite sets. I talked about a subset of four of these ways today. The paper of Robert Proctor, Let's expand Rota's twelvefold way for counting partitions! takes this systematic approach even further in an attempt to organize what he calls, "a bewildering zoo of  enumeration problems". The other counts involve some more complicated notions, such as the Bell numbers and Stirling numbers.

Please regard this as a bit of fun. If as in (ii) we say two functions $f,g:N\to X$ are the same if there exists a permutation $\pi$ for which $g(i)=f(\pi(i))$ we are defining an equivalence relation, and so this bit of work has really been about counting the number of equivalence classes for certain equivalence relations defined on the set of functions that map $N$ to $X$. However, in practice, it is often useful to work from scratch, relying on what I called the Fundamental Rule of Counting.

Try Examples sheet 1, #14. This apparently innocuous question may do your head in — or maybe you'll find it easy. There is really no systematic way to a answer question like this. Try it different ways (perhaps colouring the balls or not.) But it can help to figure out the answer for small $n$ before attempting to find the general formula.

A student asked me afterwards why I choose to talk about $f:N\to X$ and not the other way around. This is because $f(i)$ is to be the item placed in the $i$th list position. If we sample the items with replacement then we can have $f(i)=f(j)$ for some $i\neq j$. I was imagining here that each list position (or box) is to take just one item.

If we are sequentially treating $n$ patients with a drug and recording whether it is a success, a failure or inconclusive we might take $X=\{$success, failure, inconclusive $\}$ and then sample $n$ times from $X$ with replacement. Here $f(i)$ is the result for the $i$th patient. The number of different lists of results we can produce is $x^n=3^n$. The number of different totals ($n_1$ successes, $n_2$ failures, $n_3$ inconclusives) is $\binom{n+x-1}{x-1}=(n+2)(n+1)/2$.