# Artificial Intelligence

## Probability

**Probability** is about how **Likely** something is.

Probability is a **Number** between 0 and 1.

## Probability

**Probability** is about how likely something is to occur,
or how likely something is true.

The mathematic probability is a number between 0 and 1, where 0 indicates impossibility and 1 indicates certainty.

The probability of an event is:

The Number of ways it can happen / The number of possible outcomes.

**Probability = Ways / Outcomes**

## Tossing Coins

When tossing a coin, there are two possible outcomes:

Heads | Probability is 0.5 |

Tails | Probability is 0.5 |

**1 possibility (Heads) / 2 outcomes (Heads / Tails) = 1/2 = 0.5**

## P(A) - The Probability

The probability of an event **A** is often written as **P(A)**.

When tossing two coins, there are 4 possible outcomes:

Event | P(A) |
---|---|

Heads + Heads | 0.25 |

Tails + Tails | 0.25 |

Heads + Tails | 0.25 |

Tails + Heads | 0.25 |

**1 possibility (Heads + Heads) / 4 outcomes = 1/4 = 0.25**

## Throwing Dices

When throwing a dice, there are 6 possible outcomes:

Event | P(A) |
---|---|

Lands on 1 | 0.1666666... |

Lands on 2 | 0.1666666... |

Lands on 3 | 0.1666666... |

Lands on 4 | 0.1666666... |

Lands on 5 | 0.1666666... |

Lands on 6 | 0.1666666... |

**1 Possibility: Lands on 1 / 6 outcomes = 1/6 = 0.1666666...**

## P(A) = P(B)

P(A) = P(B) | Events A and B have the same chance to occur. |

P(A) > P(B) | the event A has a higher chance to occur. |

P(A) < P(B) | the event A has a lower chance to occur. |

## Choosing a King

The probability of choosing a king in a deck of cards is 4 in 52.

Number of **ways** it can happen are 4 (there are 4 kings).

Number of **outcomes** are 52 (there are 52 cards).

The probability is 4 out of 52: 4/52 = 0.076923...

The probability is written P(king) = 0.076923.

**Probability = Ways / Outcomes**

## 6 Balls

I have 6 balls in a bag: 3 reds, 2 are green, and 1 is blue.

Blindfolded. What is the probability that I pick a green one?

Number of **ways** it can happen are 2 (there are 2 greens).

Number of **outcomes** are 6 (there are 6 balls).

The probability is 2 out of 6: 2/6 = 0.333333...

The probability is written P(red) = 0.333333.

**Probability = Ways / Outcomes**