Sometimes it can be impossible to say what will happen from one minute to the next. But certain events are more likely to occur than others, and thatâ€™s where Fat Danâ€™s Casino is the most popular casino in the district. All sorts of games are offered, from roulette to slot machines, poker to blackjack. It just so happens that today is your lucky day. Head First Labs has given you a whole rack of chips to squander at Fat Danâ€™s, and you get to keep any winnings. Want to give it a try? Go onâ€”you know you want to. Thereâ€™s a lot of activity over at the roulette wheel, and another game is just about to start. Letâ€™s see how lucky you are. Youâ€™ve probably seen people playing roulette in movies even if youâ€™ve never tried playing yourself. The croupier spins a roulette wheel, then spins a ball in the opposite direction, and you place bets on where you think the ball will land. The roulette wheel used in Fat Danâ€™s Casino has 38 pockets that the ball can fall into. The main pockets are numbered from 1 to 36, and each pocket is colored either red or black. There are two extra pockets numbered 0 and 00. These pockets are both green. You can place all sorts of bets with roulette. For instance, you can bet on a particular number, whether that number is odd or even, or the color of the pocket. Youâ€™ll hear more about other bets when you start playing. One other thing to remember: if the ball lands on a green pocket, you lose. Roulette boards make it easier to keep track of which numbers and colors go together. Youâ€™ll be placing a lot of roulette bets in this chapter. Hereâ€™s a handy roulette board for you to cut out and keep. You can use it to help work out the probabilities in this chapter. Just be careful with those scissors. Have you cut out your roulette board? The game is just beginning. Where do you think the ball will land? Choose a number on your roulette board, and then weâ€™ll place a bet.
Maybe some bets are more likely than others. It sounds like we need to look at some probabilities... What things do you need to think about before placing any roulette bets? Given the choice, what sort of bet would you make? Why? Have you ever been in a situation where youâ€™ve wondered â€œNow, what were the chances of that happening?â€ Perhaps a friend has phoned you at the exact moment youâ€™ve been thinking about them, or maybe youâ€™ve won some sort of raffle or lottery. Probability is a way of measuring the chance of something happening. You can use it to indicate how likely an occurrence is (the probability that youâ€™ll go to sleep some time this week), or how unlikely (the probability that a coyote will try to hit you with an anvil while youâ€™re walking through the desert). In stats-speak, an event is any occurrence that has a probability attached to itâ€”in other words, an event is any outcome where you can say how likely it is to occur. Probability is measured on a scale of 0 to 1. If an event is impossible, it has a probability of 0. If itâ€™s an absolute certainty, then the probability is 1. A lot of the time, youâ€™ll be dealing with probabilities somewhere in between. Here are some examples on a probability scale.
If you know how likely the ball is to land on a particular number or color, you have some way of judging whether or not you should place a particular bet. Itâ€™s useful knowledge if you want to win at roulette. Letâ€™s take a closer look at how we calculated that probability. Here are all the possible outcomes from spinning the roulette wheel. The thing weâ€™re really interested in is winning the betâ€”that is, the ball landing on a 7. To find the probability of winning, we take the number of ways of winning the bet and divide by the number of possible outcomes like this: We can write this in a more general way, too. For the probability of any event A:
Probabilities can quickly get complicated, so itâ€™s often very useful to have some way of visualizing them. One way of doing so is to draw a box representing the possibility space Very often, the numbers themselves arenâ€™t shown on the Venn diagram. Instead of numbers, you have the option of using the actual probabilities of each event in the diagram. It all depends on what kind of information you need to help you solve the problem. Thereâ€™s a shorthand way of indicating the event that A does not occurâ€”AI. AI is known as the complementary event of A. Thereâ€™s a clever way of calculating P(AI). AI covers every possibility thatâ€™s not in event A, so between them, A and AI must cover every eventuality. If somethingâ€™s in A, it canâ€™t be in AI, and if somethingâ€™s not in A, it must be in AI. This means that if you add P(A) and P(AI) together, you get 1. In other words, thereâ€™s a 100% chance that something will be in either A or AI. This gives us P(A) + P(AI) = 1 or
A game of roulette is just about to begin. Look at the events on the previous page. Weâ€™ll place a bet on the one thatâ€™s most likely to occurâ€”that the ball will land in a black pocket. Oh dear! Even though our most likely probability was that the ball would land in a black pocket, it actually landed in the green 0 pocket. You lose some of your chips.
The important thing to remember is that a probability indicates a long-term trend only. If you were to play roulette thousands of times, you would expect the ball to land in a black pocket in 18/38 spins, approximately 47% of the time, and a green pocket in 2/38 spins, or 5% of the time. Even though youâ€™d expect the ball to land in a green pocket relatively infrequently, that doesnâ€™t mean it canâ€™t happen.
Letâ€™s look at the probability of an event that should be more likely to happen. Instead of betting that the ball will land in a black pocket, letâ€™s bet that the ball will land in a black or a red pocket. To work out the probability, all we have to do is count how many pockets are red or black, then divide by the number of pockets. Sound easy enough?
Take a look at your roulette board. There are only three colors for the ball to land on: red, black, or green. As weâ€™ve already worked out what P(Green) is, we can use this value to find our probability without having to count all those black and red pockets. Thereâ€™s yet another way of working out this sort of probability. If we know P(Black) and P(Red), we can find the probability of getting a black or red by adding these two probabilities together. Letâ€™s see. In this case, adding the probabilities gives exactly the same result as counting all the red or black pockets and dividing by 38. To find the probability of an event A, use AI is the complementary event of A. Itâ€™s the probability that event A does not occur. P(AI) = 1 â€“ P(A) This time the ball landed in a red pocket, the number 7, so you win some chips. Now that youâ€™re getting the hang of calculating probabilities, letâ€™s try something else. Whatâ€™s the probability of the ball landing on a black or even pocket?
We might not be able to count on being able to do this probability calculation in quite the same way as the previous one. Try the exercise on the next page, and see what happens. When we were working out the probability of the ball landing in a black or red pocket, we were dealing with two separate events, the ball landing in a black pocket and the ball landing in a red pocket. These two events are mutually exclusive because itâ€™s impossible for the ball to land in a pocket thatâ€™s both black and red.
What about the black and even events? This time the events arenâ€™t mutually exclusive. Itâ€™s possible that the ball could land in a pocket thatâ€™s both black and even. The two events intersect.
What sort of effect do you think this intersection could have had on the probability? Calculating the probability of getting a black or even went wrong because we included black and even pockets twice. Hereâ€™s what happened. First of all, we found the probability of getting a black pocket and the probability of getting an even number. When we added the two probabilities together, we counted the probability of getting a black and even pocket twice. To get the correct answer, we need to subtract the probability of getting both black and even. This gives us
We can now substitute in the values we just calculated to find P(Black or Even):
Thereâ€™s a more general way of writing this using some more math shorthand. First of all, we can use the notation A âˆ© B to refer to the intersection between A and B. You can think of this symbol as meaning â€œand.â€ It takes the common elements of events. A âˆª B, on the other hand, means the union of A and B. It includes all of the elements in A and also those in B. You can think of it as meaning â€œor.â€ If A âˆª B =1, then A and B are said to be exhaustive. Between them, they make up the whole of S. They exhaust all possibilities.
Mutually exclusive events have no elements in common with each other. If you have two mutually exclusive events, the probability of getting A and B is actually 0â€”so P(A âˆ© B) = 0. Letâ€™s revisit our black-or-red example. In this bet, getting a red pocket on the roulette wheel and getting a black pocket are mutually exclusive events, as a pocket canâ€™t be both red and black. This means that P(Black âˆ© Red) = 0, so that part of the equation just disappears.
If events A and B are exclusive, then P(A âˆ© B) = 0 If events A and B are exhaustive, then P(A âˆª B) = 1
We know that the probability of the ball landing on black or even is 0.684, but, unfortunately, the ball landed on 23, which is red and odd. Even with the odds in our favor, weâ€™ve been unlucky with the outcomes at the roulette table. The croupier decides to take pity on us and offers a little inside information. After she spins the roulette wheel, sheâ€™ll give us a clue about where the ball landed, and weâ€™ll work out the probability based on what she tells us.
How does the probability of getting even given that we know the ball landed in a black pocket compare to our last bet that the ball would land on black or even. Letâ€™s figure it out. The croupier says the ball has landed in a black pocket. Whatâ€™s the probability that the pocket is also even?
We donâ€™t want to find the probability of getting a pocket that is both black and even, out of all possible pockets. Instead, we want to find the probability that the pocket is even, given that we already know itâ€™s black. In other words, we want to find out how many pockets are even out of all the black ones. Out of the 18 black pockets, 10 of them are even, so It turns out that even with some inside information, our odds are actually lower than before. The probability of even given black is actually less than the probability of black or even. However, a probability of 0.556 is still better than 50% odds, so this is still a pretty good bet. Letâ€™s go for it. So how can we generalize this sort of problem? First of all, we need some more notation to represent conditional probabilities, which measure the probability of one event occurring relative to another occurring. If we want to express the probability of one event happening given another one has already happened, we use the â€œ|â€ symbol to mean â€œgiven.â€ Instead of saying â€œthe probability of event A occurring given event B,â€ we can shorten it to say P(A | B) The probability of A give that we know B has happened. So now we need a general way of calculating P(A | B). What weâ€™re interested in is the number of outcomes where both A and B occur, divided by all the B outcomes. Looking at the Venn diagram, we get: We can rewrite this equation to give us a way of finding P(A âˆ© B) P(A âˆ© B) = P(A | B) Ã— P(B) It doesnâ€™t end there. Another way of writing P(A âˆ© B) is P(B âˆ© A). This means that we can rewrite the formula as P(B âˆ© A) = P(B | A) Ã— P(A) In other words, just flip around the A and the B.
Donâ€™t worry, thereâ€™s another sort of diagram you can useâ€”a probability tree. Itâ€™s not always easy to visualize conditional probabilities with Venn diagrams, but thereâ€™s another sort of diagram that really comes in handy in this situationâ€”the probability tree. Hereâ€™s a probability tree for our problem with the roulette wheel, showing the probabilities for getting different colored and odd or even pockets. The first set of branches shows the probability of each outcome, so the probability of getting a black is 18/38, or 0.474. The second set of branches shows the probability of outcomes Probability trees donâ€™t just help you visualize probabilities; they can help you to calculate them, too. Letâ€™s take a general look at how you can do this. Hereâ€™s another probability tree, this time with a different number of branches. It shows two levels of events: A and AI and B and BI. AI refers to every possibility not covered by A, and BI refers to every possibility not covered by B. You can find probabilities involving intersections by multiplying the probabilities of linked branches together. As an example, suppose you want to find P(A âˆ© B). You can find this by multiplying P(B) and P(A | B) together. In other words, you multiply the probability on the first level B branch with the probability on the second level A branch. Using probability trees gives you the same results you saw earlier, and itâ€™s up to you whether you use them or not. Probability trees can be time-consuming to draw, but they offer you a way of visualizing conditional probabilities. You placed a bet that the ball would land in an even pocket given weâ€™ve been told itâ€™s black. Unfortunately, the ball landed in pocket 17, so you lose a few more chips. Maybe we can win some chips back with another bet. This time, the croupier says that the ball has landed in an even pocket. Whatâ€™s the probability that the pocket is also black? This is the opposite of the previous bet.
Our previous task was to figure out P(Even | Black), and we can use the probabilities we found solving that problem to calculate P(Black | Even). Hereâ€™s the probability tree we used before: So how do we find P(Black | Even)? Thereâ€™s still a way of calculating this using the probabilities we already have even if itâ€™s not immediately obvious from the probability tree. All we have to do is look at the probabilities we already have, and use these to somehow calculate the probabilities we donâ€™t yet know. Letâ€™s start off by looking at the overall probability we need to find, P(Black | Even). Using the formula for finding conditional probabilities, we have If we can find what the probabilities of P(Black âˆ© Even) and P(Even) are, weâ€™ll be able to use these in the formula to calculate P(Black | Even). All we need is some mechanism for finding these probabilities. Sound difficult? Donâ€™t worry, weâ€™ll guide you through how to do it.
Letâ€™s start off with the first part of the formula, P(Black âˆ© Even). We want to find the probability P(Black | Even). We can do this by evaluating The next step is to find the probability of the ball landing in an even pocket, P(Even). We can find this by considering all the ways in which this could happen. A ball can land in an even pocket by landing in either a pocket thatâ€™s both black and even, or in a pocket thatâ€™s both red and even. These are all the possible ways in which a ball can land in an even pocket. This means that we find P(Even) by adding together P(Black âˆ© Even) and P(Red âˆ© Even). In other words, we add the probability of the pocket being both black and even to the probability of it being both red and even. The relevant branches are highlighted on the probability tree. Can you remember our original problem? We wanted to find P(Black | Even) where Putting these together means that we can calculate P(Black | Even) using probabilities from the probability tree This means that we now have a way of finding new conditional probabilities using probabilities we already knowâ€”something that can help with more complicated probability problems. Letâ€™s look at how this works in general. Imagine you have a probability tree showing events A and B like this, and assume you know the probability on each of the branches. Now imagine you want to find P(A | B), and the information shown on the branches above is all the information that you have. How can you use the probabilities you have to work out P(A | B)? We can start with the formula we had before: Now we can find P(A âˆ© B) using the probabilities we have on the probability tree. In other words, we can calculate P(A âˆ© B) using P(A âˆ© B) = P(A) Ã— P(B | A) But how do we find P(B)? Take a good look at the probability tree. How would you use it to find P(B)? To find P(B), we use the same process that we used to find P(Even) earlier; we need to add together the probabilities of all the different ways in which the event we want can possibly happen. There are two ways in which even B can occur: either with event A, or without it. This means that we can find P(B) using: P(B) = P(A âˆ© B) + P(AI âˆ© B) Add together both of the intersections to get P(B). We can rewrite this in terms of the probabilities we already know from the probability tree. This means that we can use: P(A âˆ© B) = P(A) Ã— P(B | A) P(AI âˆ© B) = P(AI) Ã— P(B | AI) This gives us:
This is sometimes known as the Law of Total Probability, as it gives a way of finding the total probability of a particular event based on conditional probabilities. Now that we have expressions for P(A âˆ© B) and P(B), we can put them together to come up with an expression for P(A | B). We started off by wanting to find P(A | B) based on probabilities we already know from a probability tree. We already know P(A), and we also know P(B | A) and P(B | AI). What we need is a general expression for finding conditional probabilities that are the reverse of what we already know, in other words P(A | B). We started off with:
Donâ€™t worry if it looks complicatedâ€”this is as tough as itâ€™s going to get. And even though the formula is tricky, visualizing the problem can help. This is called Bayesâ€™ Theorem. It gives you a means of finding reverse conditional probabilities, which is really useful if you donâ€™t know every probability up front. If you have two events A and B, then The Law of Total Probability is the denominator of Bayesâ€™ Theorem. If you have n mutually exclusive and exhaustive events, A1 through to An, and B is another event, then Congratulations, this time the ball landed on 10, a pocket thatâ€™s both black and even. Youâ€™ve won back some chips. Before you leave the roulette table, the croupier has offered you a great deal for your final bet, triple or nothing. If you bet that the ball lands in a black pocket twice in a row, you could win back all of your chips. Hereâ€™s the probability tree. Notice that the probabilities for landing on two black pockets in a row are a bit different than they were in our probability tree in Bad luck!, where we were trying to calculate the likelihood of getting an even pocket given that we knew the pocket was black. The probability of getting black followed by black is a slightly different problem from the probability of getting an even pocket given we already know itâ€™s black. Take a look at the equation for this probability:
For P(Even | Black), the probability of getting an even pocket is affected by the event of getting a black. We already know that the ball has landed in a black pocket, so we use this knowledge to work out the probability. We look at how many of the pockets are even out of all the black pockets. If we didnâ€™t know that the ball had landed on a black pocket, the probability would be different. To work out P(Even), we look at how many pockets are even out of all the pockets
These two probabilities are different P(Even | Black) gives a different result from P(Even). In other words, the knowledge we have that the pocket is black changes the probability. These two events are said to be dependent. In general terms, events A and B are said to be dependent if P(A | B) is different from P(A). Itâ€™s a way of saying that the probabilities of A and B are affected by each other. Look at the probability tree on the previous page again. What do you notice about the sets of branches? Are the events for getting a black in the first game and getting a black in the second game dependent? Why? Not all events are dependent. Sometimes events remain completely unaffected by each other, and the probability of an event occurring remains the same irrespective of whether the other event happens or not. As an example, take a look at the probabilities of P(Black) and P(Black | Black). What do you notice?
These probabilities are the same. The events are independent. These two probabilities have the same value. In other words, the event of getting a black pocket in this game has no bearing on the probability of getting a black pocket in the next game. These events are independent. Independent events arenâ€™t affected by each other. They donâ€™t influence each otherâ€™s probabilities in any way at all. If one event occurs, the probability of the other occurring remains exactly the same. If events A and B are independent, then the probability of event A is unaffected by event B. In other words
for independent events. We can also use this as a test for independence. If you have two events A and B where P(A | B) = P(A), then the events A and B must be independent. Itâ€™s easier to work out other probabilities for independent events too, for example P(A âˆ© B). We already know that If A and B are independent, P(A | B) is the same as P(A). This means that or
If A and B are mutually exclusive, then if event A occurs, event B cannot. This means that the outcome of A affects the outcome of B, and so theyâ€™re dependent. Similarly if A and B are independent, they canâ€™t be mutually exclusive. for independent events. In other words, if two events are independent, then you can work out the probability of getting both events A and B by multiplying their individual probabilities together. If two events A and B are independent, then P(A | B) = P(A) If this holds for any two events, then the events must be independent. Also P(A âˆ© B) = P(A) x P(B) On both spins of the wheel, the ball landed on 30, a red square, and you doubled your winnings. Youâ€™ve learned a lot about probability over at Fat Danâ€™s roulette table, and youâ€™ll find this knowledge will come in handy for whatâ€™s ahead at the casino. Itâ€™s a pity you didnâ€™t win enough chips to take any home with you, though. [Note from Fat Dan: Thatâ€™s a relief.]
Betting on an event that has a very low probability may be worth it if the payoff is high enough to compensate you for the risk. In the next chapter, weâ€™ll look at how to factor these payoffs into our probability calculations to help us make more informed betting decisions. |