# Discrete Mathematics - Probability

Closely related to the concepts of counting is Probability. We often try to guess the results of games of chance, like card games, slot machines, and lotteries; i.e. we try to find the likelihood or probability that a particular result with be obtained.

**Probability** can be conceptualized as finding the chance of occurrence of an event. Mathematically, it is the study of random processes and their outcomes. The laws of probability have a wide applicability in a variety of fields like genetics, weather forecasting, opinion polls, stock markets etc.

## Basic Concepts

Probability theory was invented in the 17th century by two French mathematicians, Blaise Pascal and Pierre de Fermat, who were dealing with mathematical problems regarding of chance.

Before proceeding to details of probability, let us get the concept of some definitions.

**Random Experiment** − An experiment in which all possible outcomes are known and the exact output cannot be predicted in advance is called a random experiment. Tossing a fair coin is an example of random experiment.

**Sample Space** − When we perform an experiment, then the set S of all possible outcomes is called the sample space. If we toss a coin, the sample space $S = \left \{ H, T \right \}$

**Event** − Any subset of a sample space is called an event. After tossing a coin, getting Head on the top is an event.

The word "probability" means the chance of occurrence of a particular event. The best we can say is how likely they are to happen, using the idea of probability.

$Probability\:of\:occurence\:of\:an\:event = \frac{Total\:number\:of\:favourable \: outcome}{Total\:number\:of\:Outcomes}$

As the occurrence of any event varies between 0% and 100%, the probability varies between 0 and 1.

### Steps to find the probability

Step 1 − Calculate all possible outcomes of the experiment.

Step 2 − Calculate the number of favorable outcomes of the experiment.

Step 3 − Apply the corresponding probability formula.

### Tossing a Coin

If a coin is tossed, there are two possible outcomes − Heads $(H)$ or Tails $(T)$

So, Total number of outcomes = 2

Hence, the probability of getting a Head $(H)$ on top is 1/2 and the probability of getting a Tails $(T)$ on top is 1/2

### Throwing a Dice

When a dice is thrown, six possible outcomes can be on the top − $1, 2, 3, 4, 5, 6$.

The probability of any one of the numbers is 1/6

The probability of getting even numbers is 3/6 = 1/2

The probability of getting odd numbers is 3/6 = 1/2

### Taking Cards From a Deck

From a deck of 52 cards, if one card is picked find the probability of an ace being drawn and also find the probability of a diamond being drawn.

Total number of possible outcomes − 52

Outcomes of being an ace − 4

Probability of being an ace = 4/52 = 1/13

Probability of being a diamond = 13/52 = 1/4

## Probability Axioms

The probability of an event always varies from 0 to 1. $[0 \leq P(x) \leq 1]$

For an impossible event the probability is 0 and for a certain event the probability is 1.

If the occurrence of one event is not influenced by another event, they are called mutually exclusive or disjoint.

If $A_1, A_2....A_n$ are mutually exclusive/disjoint events, then $P(A_i \cap A_j) = \emptyset $ for $i \ne j$ and $P(A_1 \cup A_2 \cup.... A_n) = P(A_1) + P(A_2)+..... P(A_n)$

## Properties of Probability

If there are two events $x$ and $\overline{x}$which are complementary, then the probability of the complementary event is −

$$p(\overline{x}) = 1-p(x)$$

For two non-disjoint events A and B, the probability of the union of two events −

$P(A \cup B) = P(A) + P(B)$

If an event A is a subset of another event B (i.e. $A \subset B$), then the probability of A is less than or equal to the probability of B. Hence, $A \subset B$ implies $P(A) \leq p(B)$

## Conditional Probability

The conditional probability of an event B is the probability that the event will occur given an event A has already occurred. This is written as $P(B|A)$.

Mathematically − $ P(B|A) = P(A \cap B)/ P(A)$

If event A and B are mutually exclusive, then the conditional probability of event B after the event A will be the probability of event B that is $P(B)$.

**Problem 1**

In a country 50% of all teenagers own a cycle and 30% of all teenagers own a bike and cycle. What is the probability that a teenager owns bike given that the teenager owns a cycle?

**Solution**

Let us assume A is the event of teenagers owning only a cycle and B is the event of teenagers owning only a bike.

So, $P(A) = 50/100 = 0.5$ and $P(A \cap B) = 30/100 = 0.3$ from the given problem.

$P(B|A) = P(A \cap B)/ P(A) = 0.3/ 0.5 = 0.6$

Hence, the probability that a teenager owns bike given that the teenager owns a cycle is 60%.

**Problem 2**

In a class, 50% of all students play cricket and 25% of all students play cricket and volleyball. What is the probability that a student plays volleyball given that the student plays cricket?

**Solution**

Let us assume A is the event of students playing only cricket and B is the event of students playing only volleyball.

So, $P(A) = 50/100 =0.5$ and $P(A \cap B) = 25/ 100 =0.25$ from the given problem.

$P\lgroup B\rvert A \rgroup= P\lgroup A\cap B\rgroup/P\lgroup A \rgroup =0.25/0.5=0.5$

Hence, the probability that a student plays volleyball given that the student plays cricket is 50%.

**Problem 3**

Six good laptops and three defective laptops are mixed up. To find the defective laptops all of them are tested one-by-one at random. What is the probability to find both of the defective laptops in the first two pick?

**Solution**

Let A be the event that we find a defective laptop in the first test and B be the event that we find a defective laptop in the second test.

Hence, $P(A \cap B) = P(A)P(B|A) =3/9 \times 2/8 = 1/12$

## Bayes' Theorem

**Theorem** − If A and B are two mutually exclusive events, where $P(A)$ is the probability of A and $P(B)$ is the probability of B, $P(A | B)$ is the probability of A given that B is true. $P(B | A)$ is the probability of B given that A is true, then Bayesâ€™ Theorem states −

$$P(A|B) = \frac{P(B|A) P(A)}{\sum_{i = 1}^{n}P(B|Ai)P(Ai)}$$

### Application of Bayes' Theorem

In situations where all the events of sample space are mutually exclusive events.

In situations where either $P( A_i \cap B )$ for each $A_i$ or $P( A_i )$ and $P(B|A_i)$ for each $A_i$ is known.

**Problem**

Consider three pen-stands. The first pen-stand contains 2 red pens and 3 blue pens; the second one has 3 red pens and 2 blue pens; and the third one has 4 red pens and 1 blue pen. There is equal probability of each pen-stand to be selected. If one pen is drawn at random, what is the probability that it is a red pen?

**Solution**

Let $A_i$ be the event that i^{th} pen-stand is selected.

Here, i = 1,2,3.

Since probability for choosing a pen-stand is equal, $P(A_i) = 1/3$

Let B be the event that a red pen is drawn.

The probability that a red pen is chosen among the five pens of the first pen-stand,

$P(B|A_1) = 2/5$

The probability that a red pen is chosen among the five pens of the second pen-stand,

$P(B|A_2) = 3/5$

The probability that a red pen is chosen among the five pens of the third pen-stand,

$P(B|A_3) = 4/5$

According to Bayes' Theorem,

$P(B) = P(A_1).P(B|A_1) + P(A_2).P(B|A_2) + P(A_3).P(B|A_3)$

$= 1/3 . 2/5\: +\: 1/3 . 3/5\: +\: 1/3 . 4/5$

$= 3/5$