 A really important element of the mathematics and data science and one of its foundational principles is probability. Now one of the things that probability comes in intuitively for a lot of people is something like rolling dice or looking at sports outcomes. And really the fundamental question, what are the odds of something that gets at the heart of probability? Now let's take a look at some of the basic principles. We got our friend Albert Einstein here to explain things. The principles of probability work this way. Probability is range from 0 to 1. That's like 0% to 100% chance. When you put P, that stands for probability, and then in parentheses, here A, that means the probability of whatever in parentheses. So P, A means the probability of A, and then P of B is the probability of B. When you take all of the probabilities together, you get what's called the probability space, and that's why we have S, and it all adds up to 1, because you've now covered 100% of the possibilities. Also you can talk about the complement. The tilde here is used to say probability of not A is equal to 1 minus the probability of A, because those have to add up. So let's take a look at something also about conditional probabilities, which is really important in statistics. A conditional probability is the probability of something if something else is true. You write it this way, the probability of, and that vertical line is called a pipe and it's read as assuming that or given that. So you can read this as probability of A given B is the probability of A occurring if B is true. And so you can say, for instance, what's the probability if something's orange, what's the probability that's a carrot given in this picture. Now the place where this comes in really important for a lot of people is the probabilities of type one and type two errors in hypothesis testing, which we'll mention at some other point. But I do want to say a few things about arithmetic with probabilities, because it doesn't always work the way that people think it will. Let's start by talking about adding probabilities. Let's say you have two events, A and B. And let's say you want to find the probability of either one of those events, so that's like adding the probabilities of the two events. Well, it's kind of easy. You take the probability of event A and you add the probability of event B. However, you may have to subtract something. You may have to subtract this little piece, because maybe there's some overlap between the two of them. On the other hand, if A and B are disjoint, which means they never occur together, then that's equal to zero. And then you can, you know, subtract zero, which is you get back to the original probabilities. But let's take a really easy example of this. I've created my super simple sample space. I have 10 shapes. I got five squares on the top, five circles on the bottom. I've got a couple of red shapes on the right side. Let's say we want to find the probability of a square or a red shape. So we are adding the probabilities, but we have to adjust for the overlap between the two. Well, here's our squares on top, five out of the 10 are squares. And over here on the right, we have two red shapes, two out of 10. So let's go back to our formula here and let's change a little bit. Change the A and the B to S and R for square and red. Now we can start this way. Let's get the probability that something is a square. Well, we go back to our probability space. You see we have five squares out of 10 shapes total. So we do five over 10, that reduces to 0.5. Okay. Next up, the probability of something red in our sample space. Well, we have 10 shapes total, two of them on the far right are red. So that's two over 10. And you do the division, you get 0.2. Now the trick is the overlap between these two categories. Do we have anything that is both square and red? Because we don't want to count that twice. So we have to subtract it. So let's go back to our sample space and we're looking for something that is square. There's the squares on top and there's the things that are red on the side. And you see they overlap and this is our little overlapping red square. So there's one shape that meets both of those one out of 10. So we come back here, we do one out of 10, that reduces to 0.1. And then we just do the addition and subtraction here, 0.5 plus 0.2 minus 0.1 gets us 0.6. And so what that means is there's a 60% chance of an object being square or red. And you can look at it right here, we got six shapes outlined now. And so that's the visual interpretation that lines up with the mathematical one we just did. Now let's talk about multiplication for probabilities. Now the idea here is you want to get what are called joint probabilities. So the probability of two things occurring together simultaneously. And what you need to do here is you need to multiply the probabilities. And we can say probability of A and B because we're asking about A and B occurring together, a joint occurrence. And it's equal to the probability of A times the probability of B, that's easy. But you do have to expand it just a little bit because you can have the problem of things overlapping a little bit. And so you actually need to expand it to an conditional probability, the probability, rephrase, the probability of B given A, again, that's the vertical pipe there. On the other hand, if A and B are independent, if they never co-occur or they, B is no more likely to occur if A happens, then it just reduces to the probability of B and you get your slightly simpler equation. But let's go and take a look at our sample space right here. So we've got our 10 shapes, five of each kind, and then two that are red. And we're going to look at, originally, the probability of something being square or red. Now we're going to look at the probability of it being square and red. Now, I know we can eyeball this one really easy, but let's run through the math. The first thing we need to do is get the ones that are square. There's those five on the top, and the ones that are red. And there's those two on the right. In terms of the ones that are both square and red, obviously, there's just this one red square at the top right. But let's do the numbers here. We change our formula to be SNR for square and red. We get the probability of square. Again, that's those five out of ten, so we do five out of ten, reduces to point five. And then we need the probability of red given that it's a square. So we only need to look at the squares here. There's the squares, five of them, and one of them is red. So that's one over five. That reduces to point two. You multiply those two numbers, point five times point two. And what you get is point one, or a 10% chance, or 10% of our total sample space is red squares. And you come back and you look at it, you say, yeah, there's one out of ten. So that just confirms what we were able to do intuitively. So that's our short presentation on probabilities and in some, what do we get out of that? Number one, probability, it's not always intuitive. And also the idea that conditional values can help in a lot of situations, but they may not work the way you expect them to. And really the arithmetic of probability can surprise people. So pay attention when you're working with it, so you can get a more accurate conclusion in your own calculations.