# Birthdays – Get in line

Imagine a line of people, one behind the other, all facing the same way (to the head of the line).

You get a prize if you are the the *first* person in the line (from the front person, working backwards) to have a person ahead of them with the same birthday.

*Where to stand to have the best chance of getting the prize?*

This is the easiest of the three birthday problems, although I didn’t think so at the start.

To be more explicit in the problem definition, we say that, if you are the n^{th} person in the line, then

(a) the n-1 people in front of you must all have different birth dates

(b) you must have the same birthday as one of those (n-1) people

So, the trick is to find where the decreasing probability of (a) outweighs the increasing probability of (b).

Let’s say you are indeed the n^{th} person in the line.

Let’s also says that the probability that the (n-1) people in front of you all have different birth dates is p.

(It’s actually some mildly complicated expression we figured out in Birthday Pairings.)

Then the probability of you being the winner is (assuming a simple 365 day year)

(n-1) p ===== (1) 365

Now imagine you move back one space, to the (n+1)^{th} position. That extra person

– must have a different birth date to all those in front, but also

– provides an extra birth date for you to match with.

So now, the probability of you as the person being the winner is

(366-n) n p ======= === (2) 365 365

So, the best position will be the smallest *n* for which expression (1) is greater than expression (2) i.e.

(n-1) (366-n) n p =====>p ======= === 365 365 365

Cancelling common factors, then moving 365 to the left hand side, we find that

*365 (n-1) > (366-n) n*

so

*365n – 365*so

**>**366n – n^{2 }*n*

^{2}**>**n + 365This is first true for n = 20, so stand 20^{th} in line.

#### For those born on 29 February…

For someone with their birthday on 29 February, the equation is (approximately)

(n-1) (1462-n) np =====>p ======= ===1461 1461 1461

Simplifying this expression in the same way as for other dates above, we find that

1461 (n-1) **>** (1462-n) n

so

*1461n – 1461 > 1462n – n^{2
}*so

*n*

^{2}**>**n + 1461This is first true for n = 39, so stand 39^{th} in line.