# Probability Basics

Probability is the certainty of an event taking place.

**Conditional Probability**

Assuming that B has been observed, the following tells us about the probability that A will take place:

**P(A given B) = P(A and B)/P(B)**

That is, we calculate the ratio of number of times both A and B occurred, and, the number of times B has occurred.

For short, we write:

**P(A|B) = P(AB)/P(B)**

where **P(A|B) **is the conditional probability, **P(AB) **is the joint, and **P(B) **is the marginal.

If we have more events, we can use chain rule: **P(ABC) = P(A|BC).P(AB|C).P(C)**

If A is not dependent on B, then **P(AB) = P(A).P(B)**

Let me walk you through some examples:

1. Assume we have a box with 3 red balls and 1 blue ball. What is the probability of drawing red balls in the first 2 trails?

By chain rule,

**P(B1=r,B2=r) = P(B2=r|B1=r).P(B1=r)** = (2/3).(3/4) = 1/2

where,

**P(B1=r,B1=r)** is the probability of drawing a red ball in the first trial and picking the second ball in the next try.

**P(B2=r|B1=r)** is the probability of drawing the red ball in the second trail *given* having already picked the red ball in the first try.

**P(B)** is the probability of drawing red ball.

2. What is the probability that the 2nd ball drawn from a set {r,r,r,b} will be red?

Using marginalization, **P(B2=r) = P(B1=r, B2=r) + P(B1=b,B2=r)** = 1/2 + 1/4 = 3/4

Alright that’s it for now! Thank you for spending your time. Cheers!