# How many people, taken at random, give a greater than 50% chance of at least two of them sharing a common birthday?

I am approaching the problem this way.

There are 365 days in a year. So, the number of ways one person can have his birthday is, 365. The number of ways in which 2 people can have their birthday is $365^2$. The number of ways $n$ people can have their birthday is $$365^n$$That is my sample space.

The number of ways of $n$ person, each having different birthday is, $$\bigg(\begin{matrix}365\\n\end{matrix}\bigg)$$

The probability of $n$ person having different birthday is $$\frac{\bigg(\begin{matrix}365\\n\end{matrix}\bigg)}{365^n}$$

The probability of at least two person having same birthday is, $$1-\frac{\bigg(\begin{matrix}365\\n\end{matrix}\bigg)}{365^n}$$

Now, for the probability to be at least 50%, I have to solve for $n$ in this equation $$1-\frac{\bigg(\begin{matrix}365\\n\end{matrix}\bigg)}{365^n}=0.5$$

The problem is, even Wolfram Alpha can't solve that equation. I don't even know if I my thinking process is correct and that, solving the equation will get me the correct answer.

If my thought process is correct, please advise me how to solve that equation and if I am wrong, then where did I make a mistake.

P.S. Please don't lock this thread. I know that there are similar threads on this famous birthday problem but I am seeking to find error in the way I am approaching the problem.

The number of ways for $n$ persons each to have a different birthday is $^{365}P_n,$ the number of permutations of $n$ objects selected without replacement from $365$ objects: $$^{365}P_n = \frac{365!}{n!} \neq \binom{365}{n}.$$
What you did not take into account was that in your $365^n$ different equally-likely outcomes of the birthdays of $n$ persons, the order in which those persons have those birthdays matters.
The case where Eva's birthday is January 1 and Ahmed's birthday is January 2 is a different subset of the $365^n$ possible outcomes than the case where Eva's birthday is January 2 and Ahmed's birthday is January 1. You don't merely choose $n$ birthdays for $n$ persons, you choose them in a particular order. So you must count permutations of $n$ objects out of $365$ rather than combinations. (When counting combinations, it only matters which $n$ objects you select, not the order in which you select them.)
If you work it out a little farther, the probability of at least one matching pair of birthdays among $n$ persons is $$1 - \frac{365!/n!}{365^n} = 1 - \frac{365}{365}\cdot\frac{364}{365}\cdot\frac{363}{365}\cdots\frac{(366-n)}{365},$$ which is the usual formula. The way to solve the problem is algorithmic: you multiply $\frac{365}{365}$ by $\frac{364}{365},$ then $\frac{363}{365},$ then $\frac{362}{365},$ and so forth until the product is less than or equal to $\frac12,$ at which point the desired probability ($1$ minus the product) is at least $\frac12.$
I notice two mistakes. The first is that there are $$n!\binom{365}{n}\ \text{ways}$$ $n$ people can have distinct birthdays. The second is that you may not find a solution exactly equal to $0.5$, so you should seek to solve the inequality $$1 - \frac{n!\binom{365}{n}}{365^n} \geq 0.5.$$
• Why multiply $n!$? – Ayatana Aug 6 '17 at 6:37
• @Ayatana David K's answer has a thorough explanation as to why this is the case, but it's essentially because "order" matters. More than just choosing which $n$ days, we also need to consider which people we are assigning to which day. – John Griffin Aug 6 '17 at 6:39