# Generalizing the Rules¶

So far we have seen that we can make a probability tree and think about combinations of outcomes in terms of ANDs or ORs.

For the ANDs we look across one branch to find outcomes that happen *together*, for the ORs we look at different branches that make *separate* options.

In both cases we learnt rules for these combinations: the Product Rule and the Addition Rule. Let's summarize them:

### $P(A \ and \ B)=P(A)\times P(B)$, $P(A \ or \ B)=P(A)+P(B)$.¶

Remember that both rules have conditions for using them, but we'll go into more detail in future lessons.

Now, the important thing to notice is that we can use these rules even without a probability tree whenever we have events combined in terms of ANDs or ORs, because often we will have experiments that involve many cases, and building those trees can be quite difficult, while using the rules is much simpler.

Let's see this with an example: Imagine we throw a dice $5$ times and let's start by calculating the probability of getting all $1$s.

$P(all 1s)=P(1^{st} 1 \ and \ 2^{nd} 1 \ and \ 3^{rd} 1 \ and \ 4^{th} 1 \ and \ 5^{th} 1)=P(1^{st} 1)\times P(2^{nd} 1)\times P(3^{rd} 1)\times P(4^{th} 1)\times P(5^{th} 1)=\dfrac{1}{6}\times\dfrac{1}{6}\times\dfrac{1}{6}\times\dfrac{1}{6}\times\dfrac{1}{6}=\left(\dfrac{1}{6}\right)^{5}$

```
p_all_ones = (1/6) ** 5
p_all_ones
```

Now let's calculate the probability of getting always the same number.

$P(all \ the \ same)=P(all \ 1s \ or \ all \ 2s \ or \ all \ 3s \ or \ all \ 4s \ or \ all \ 5s \ or \ all \ 6s)=P(all \ 1s)+P(all \ 2s)+P(all \ 3s)+P(all \ 4s)+P(all \ 5s)+P(all \ 6s)=5\times\left(\dfrac{1}{6}\right)^{5}$

```
p_all_the_same = 5*p_all_ones
p_all_the_same
```

Notice how in one line we were able to find a probability by making good use of the product and addition rules, whereas if we wanted to do a probability tree for this case, it would have had $6$ branches and $5$ levels of depth.