If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:13:16

Video transcript

one of y'all sent a fairly interesting problem so I thought I would work it out the problem is I have a group of 30 people so 30 people in a room they're randomly selected 30 people 30 people and the question is what is the probability that at least at least two at least two people have the same birthday this is kind of a fun question because you know I don't know that's the size of a lot of classroom just what's the probability that at least someone in the classroom shares a birthday with someone else in the classroom right and that's actually another that's that's a good way to phrase it well this is this is the same thing as saying what is the probability that someone shares with at least someone else they could share it with two other people or four other people in the birthday someone someone some not once someone else all right and at first this problem seems really hard because wow there's a lot of circumstances that make this true I could have exactly two people have the same birthday I could have exactly three people have the same birthday I could have exactly twenty nine people have the same birthday all of these make this true so do I add the probability of each of those circumstances and then add them up and then that becomes really hard and then I would have to say okay whose birthday is am i comparing and I'd have to do combinations it becomes a really difficult problem unless you make kind of one very simplifying I would say take on the problem this is the opposite of let's let me draw the the probability space let's say that let's say that this is all of the outcomes let me draw it with a thicker line we draw a thicker line let me draw it so let's say that's all of the outcomes in my probability space so that's a hundred percent of the outcomes and we want to know we want to know let me we want to know let me draw it in a color that won't be offensive to you now that doesn't look that great but anyway let's say that this is the probability this this area right here I don't know how it really is we'll figure it out let's see that this is the probability that someone shares a birthday with at least someone else right what's this area over here what's this green area well this that means if these are all the cases where someone shares a birthday with someone else these are all the area where no one shares a birthday with anyone no one shares with anyone or you could say all 30 people have different birthdays have different birthdays all right so we're trying to figure out this is what we're trying to figure out the probability I'll just call it the probability that you know someone shares I'll call it the probability of sharing probability of s this is the problem this is one if this whole area is area one or area 100% this green area right here this is going to be one minus P of s right this is going to be one minus P of s or if we said that this is the probability or another way we could say actually this is the best way to think about it if this is different so this is the probability of different birthdays this is the probability that all 30 people have 30 different birthdays right no one shares with anyone the probability that someone shares with someone else plus the probability that no one shares with anyone they all have distinct birthdays that's got to be equal to one because we're either going to be in this situation we're going to be in that situation or you could say they're equal to 100% either way 100 percent and 1 are the same number is equal to 100% so if we figure out the probability that everyone has the same birthday we could subtract it from 100 so let's see if we could we could just rewrite this the probability that someone shares a birthday with someone else that's equal to 100 percent minus the probability that everyone has distinct separate birthdays and the reason why I'm doing that is because as I started off in the video this is kind of hard to figure out you know I can figure out the probability that people have two people have the same birthday five people and it becomes very confusing but he if I want to just figure out the probability that everyone has a distinct birthday it's actually a much easier probability to solve for so what's the probability that everyone has a distinct birthday so let's think about it person 1 person 1 let's let's just for simplicity let's imagine the case that we only have two people in the room what's the probability that they have different birthdays so if I have to print let's see person 1 their birthday it could be 365 days out of 365 days in the year right you know whatever their birthday is and then person to how many if we wanted to ensure that they don't have the same birthday how many days could person to be born on well it could be born on any day that person 1 was not born on so there's 364 possibilities out of 365 so if you had two people the probability that no one is born on the same birthday this is just 1 is just going to be equal to 360 for 364 over 365 right now if we had what happens if we had three people so first of all the first person could be born on any day then the second person could be born on 364 possible days out of 365 and then the third person what's the probability that this third person isn't born on either of these people's birthdays so two days are taken up so the probability is 363 over 365 so this is equal to you multiply them out you get 365 times 360 actually I should rewrite this one instead of saying this is 1 let me write this as the numerator is 365 times 364 over 365 squared because I want you to see the pattern right here the probability is 365 times 364 times 363 over 365 to the third power and so in general if you just kept doing this 230 if I just if you know if I just kept this process to 430 people so 30 people the probability that no one shares the same birthday would be equal to 365 times 364 times 363 will have off 30 terms up here right all the way down to what 330 all the way down to 336 right that'll actually be 30 terms divided by 365 365 to the 30th power and you can just type this into your calculator right now it'll take you a little time to type in 30 numbers and you'll get the probability that no one shares the same birthday with anyone else but before we do that let me just show you something that might make it a little bit easier is there any way that I can mathematically Express this with factorials or that I could mathematically Express this with factorials let's think about it 365 factorial is what 365 factorial is equal to 365 times 364 times 360 3 times all the way down to 1 right just keep multiplying it's a huge number now if I just want the 365 times the 364 in this case I have to get rid of all of these numbers back here so what I would one thing I could do is I could divide this thing by all of these numbers so 363 times 362 all the way down to 1 so that's the same thing as dividing by 360 3 factorial right 365 factorial divided by 360 3 factorial is essentially this because all of these terms cancel out right so this is equal to 365 factorial over 363 factorial over 365 squared and of course for this case it's almost silly to worry about the factorials but it becomes useful once we have something larger than 2 terms up here so by the same logic this right here is going to be equal to 365 factorial over 362 factorial over 365 squared and actually just another interesting point how did we get this 365 sorry how do we get this 363 factorial well 365 minus 2 is 363 right and that makes sense because we only wanted two terms up here we only wanted two terms right here so we wanted to divide by a factorial that's two less right and so we'd only get the highest two terms left so this this is also equal to you could write this as 365 factorial divided by 365 minus 2 factorial right 365 minus 2 is 363 factorial and then you just end up with those two terms and that's that there and then likewise this right here this numerator you could rewrite as 365 factorial divided by 365 minus 3 and we have 3 people factorial and that should hopefully make sense right this is the same thing as 365 factorial is 365 divided by 3 is 362 factorial and so that's equal to 365 times 364 times 363 all the way down divided by 360 2 times all the way down and that'll cancel out with everything else and you'd be just left with that and that's that right there so by that same logic this top part here this top part here can be written as 365 factorial over what 365 minus 30 factorial and I did all of that just so I can show you kind of the pattern and because this is frankly easier to type into a calculator if you know where the factorial button is so let's figure out what this entire probability is so turning on the calculator we want so let's do the numerator 365 factorial / well what's 365 - 30 that's 335 right / 335 factorial and that's the whole numerator and now we want to divide the numerator divided by 365 to the 30th power let's calculate or think and we get point 2 9 3 6 equals 0.2 9 3 6 it keeps good actually 3 7 if you round it which is equal to twenty nine point three seven percent now just so you remember what we were doing all along this was the probability that no one shares a birthday with anyone right this was this was the probability of everyone having distinct different birthdays from everyone else and we've said well the probability that someone shares a birthday with someone else or maybe more than one person is equal to all of the possibilities kind of 100% the probability space - the probability that no one shares a birthday with anybody so that's equal to 100% - twenty nine point three seven percent what another way you could write it as that's you know one - point two nine three seven which is equal to so if I want to subtract that from one one - that just means the answer the that means one minus point two nine you get point seven zero six three so the probability that someone shares a birthday with someone else is 0.7 oh six three it keeps going which is approximately equal to 70 point six percent which is kind of a neat result because if you have 30 people in a room you might say oh wow what are the odds that someone has the same birthday as someone else it's actually pretty high most you know all seventy percent of the time if you have a group of 30 people at least one person shares a birthday with at least one person one other person in the room so that's kind of a neat problem and and kind of a neat result at the same time anyway see you in the next video