# The Intersection and Union of Sets-Bayesian Inference

## Probability topic- Bayesian Inference Tutorial-2

I had already said about the intersection topic in the previous article of this series. Actually, Intersection and union of sets is not a big concept to understand and there are not many things to write about it in a separate one. But having said that, it is a much-needed concept to understand the Bayes’ theorem. Let’s understand the concept with the help of some animation images.

## Intersection

As I already said, the portion of the two events intersect is the intersection. We usually denote the intersection with this symbol **∩. **We know that, if any outcome is the part of two independent events, we call it the intersection. Then what is the intersection for the distinct independent events? Let's consider the formal example, rolling a dice. We separate the outcome as two events. One is even outcome and another one is odd.

A={2,4,6} B={1,3,5}

Exactly like this, here there is no way to intersect both the events. So the intersection of these events is an empty set.

In Notation,

**A+B=∅ (∅={})**

Consider picking a car from a pack of cards 🂮. Fix getting **King** ♚ is the one event and **Diamond** ♦ as another.

If you get **King of Diamonds** is the** intersection**.

**Bottom Line**: Intersection is the place where both events meet. **AND** represents the intersection.

## Union

All the elements in the two or more sets are considered as a union. So the union is just the summation of all the elements. Unions are denoted as **∪. **Looks like a letter “U” right? and looks like an upside-down of the symbol of the intersection.

To understand this better, let’s take

**A={1,2,3,4} and B={5,6,7}**

The union of A and B is, **A∪B = A+B = {1,2,3,4,5,6,7}**

This is the case of two non-intersecting sets. Let’s do the same in different scenarios. Let’s take two intersecting sets.

**A **= **{1,2,3,4,5}**

**B = {4,6,7,8}**

In which case, the formula differs slightly here

**A∪B = A + B -(A∩B) = {1,2,3,4,5,6,7,8}**

Element **4** is present in both the events(sets), but we took the element one time only in the union of both the events. So, an element is in the union if it belongs to at least one of the sets. We should not do double-counting here.

Asking the union of the A and B is also the same way of asking all the elements from if it is present either of the sets.

Understand this concept with the help of this below image.

Let’s consider the blue circle as cricket and purple color circle as basketball. People inside are the ones who are the players of the respective sports. We are going to add all the players irrespective of the sport. Consider the pink dressed girl in both the sports. Let’s name her our convenience, fix **Mona**. How do we calculate?

**A∪B **(All the players) **= A **(Cricket Players + Mona) **+ B **(Basketball Players +Mona ) -**A∩B **(Mona)

A=4, B=4, A∩B = 1

Finally, A∪B=4+4–1 = **7**

Cool!

There is another one different scenario too. We already dealt with it in the Tutorial-1.

**Subset…**

How do we calculate union if a set completely overlaps another set?

It is much easier than the previous one. The formula is

**A∪B = A + B - B =A**(Cancel out +B and -B)

For example,

**A**={1,2,3,4,5} **B**={4,5}

**A∪B = {**1,2,3,4,5**}**

**Bottom Line: OR **represents union. ( Either A or B = A∪B)

## Conclusion

We have learned two topics so far. Let’s learn about Mutually Exclusive sets in the next tutorial. Happy Learning!