All-round good egg @samholloway asked, ages ago:

Seven of my friends on Facebook have birthdays today! How many friends do I have?

This is a question to which Sam could probably find the answer, and possibly I could too; I don’t really spend a lot of time on Facebook and can’t remember if that’s the sort of information that shows up if you click on a profile.

In any case, I don’t really care about how many friends Sam has((As long as he’s happy, that’s all that matters.)). I’m more interested in thinking about inferring plausible answers depending on our assumptions. I can think of three reasonable assumptions (one of which is likelier than the others).

### Moderately likely: that’s a typical day

Sam doesn’t typically update the world about the number of his friends with birthdays on a given day, but it could be that he likes the number 7 and noticed it, or that it was the $n$th day in a row with 7… so we should at least consider the possibility that it’s a randomly-chosen day.

In that case, our best guess for Sam’s friendship tally is 7 times 365 days((Let’s ignore February 29th.)), or 2,555.

### Least likely: that’s unusually few

Sam is a popular chap! He has a radio show, and revolves in all sorts of social circles. It’s possible he could be commenting because seven is unusually few birthdays to see – let’s assume it’s the minimum number of birthdays that show up over the course of a year.

If that’s the case, a lower bound on the number of Sam’s friends would be seven times the number of days in a year – somewhere in the region of 2600.

However, under this assumption, Sam would likely have many more friends – the number varies day by day.

So let’s come up with a model: we’re going to roll a 365-sided die $N$ times. How often to we see any given number (call this $X$)? This is a binomial distribution, the number of $X \sim B(N, p)$, where $p = \frac{1}{365}$. I’ll assume we can use a normal approximation for this, so $X \sim N(Np, Npq)$, where $q = 1-p$.

Now, the $z$ score of something that only shows up once in 365 trials is (checks) about -2.7. So, a reasonable guess for $N$ would satisfy $Np - 2.7\sqrt{Npq} = 7$.

Multiply by 365 and that becomes $N - 2.7\sqrt{364N} - 2555 =0$.

The square root of 364 is about 19

whoosh about 19.08, I think you’ll find whoosh

… as I say, about 19, which is good enough for here – and 19 2.7s are about 51. So $N - 51\sqrt{N} - 2555 \approx 0$, and we have a disguised quadratic!

This one, I’m not going to complete the square on: $\sqrt{N} \approx \frac{51 \pm \sqrt{ 51^2 + 4 \times 2555}}{2}$.

Eyeballing that square root, $51^2$ is 2,601, the product is 10,220, so we’re looking at 12821. The square root of that is between 110 and 115 (I’ll go with 113) so the $\sqrt{N} \approx 84$ and $N \approx 7000$.

### Most likely: that’s unusually many

Most people only tell me about their birthday count when it’s unusually high.

Unfortunately, that means I need to use a different model – the normal approximation doesn’t hold up here.

Instead, I’ll look at the Poisson distribution for the number of birthdays on a given day. With $N$ friends, we expect $X \sim Po(Np)$. We want the probability of $X$ being 7 or more to be $\frac{1}{365}$, assuming this day was the clear highest count of the year.

That’s not a very nice thing to work out. The probability of $X \le 6$ is $e^{-\lambda}\left( 1 + \lambda + \frac{1}{2}\lambda^2 + \frac{1}{6}\lambda^3 + \frac{1}{24}\lambda^4 + \frac{1}{120}\lambda^5 + \frac{1}{720}\lambda^6\right)$, where $\lambda = Np$. That’s not something we can solve exactly, but Wolfram|Alpha((Which earlier interpreted “z-score” as $z-20$)) tells me that $Np \approx 1.82$.

That gives an estimate for Sam’s friendship group as 664. This seems – for someone in roughly the same age bracket as me – a more reasonable number of friends than the others.

Would you have approached it a different way? Have I messed anything up? Do let me know!

#blogstopublish