Mathematics - Discrete Mathematics - Conditional Probability

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@drifter1·
0.000 HBD
Mathematics - Discrete Mathematics - Conditional Probability
![](https://upload.wikimedia.org/wikipedia/commons/8/82/Law_of_total_probability.png)

[[Image 1](https://commons.wikimedia.org/wiki/File:Law_of_total_probability.png)]

## Introduction

Hey it's a me again [@drifter1](https://peakd.com/@drifter1)!

Today we continue with **Mathematics**, and more specifically the branch of "**Discrete Mathematics**", in order to get into **Conditional Probability**.

I highly suggest checking the post on [Probability](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-probability) before this one!

So, without further ado, let's get straight into it!

* * *

## Conditional Probability

For dependent events, where the occurrence of one affects the outcome of another, a new kind of probability is defined known as conditional probability. The probability of an event *A* from occurring when an event *B* has already occurred is denoted as *P(A | B)*, and given by:

![](https://quicklatex.com/cache3/69/ql_b506da6a484447a7cf5ded17e862a069_l3.png)

Solving for the intersection, results in:

![](https://quicklatex.com/cache3/73/ql_e5383d153971abc223c3fa7b60686f73_l3.png)

In a similar manner, the probability of event *B* from occurring when *A* has occurred is:

![](https://quicklatex.com/cache3/f2/ql_a5071a165da51121b11d9733d40adaf2_l3.png)

If the events *A* and *B* are independent then:

![](https://quicklatex.com/cache3/76/ql_c874b2e737ca5dfeed0e596eba181876_l3.png)

### Law of Total Probability

Based on conditional probability, it's possible to calculate the total probability of an event *B* for any number of disjoint events *A<sub>i</sub>*. The resulting equation is known as the law of total probability:

![](https://quicklatex.com/cache3/63/ql_1a8d0e96f2e2a394f9c94c0b41e2f563_l3.png)

Each intersection can also be replaced with the corresponding conditional probability equation yielding:

![](https://quicklatex.com/cache3/a7/ql_89e48436dffe2136ebb1101363bd3da7_l3.png)

### Bayes' Theorem

Let's not forget to mention Bayes' Theorem, which is basically an equation that relates *P(A | B)* and *P(B | A)*.

It's easy to derive such an equation from the definition of conditional probability:

![](https://quicklatex.com/cache3/71/ql_5501d4b156fecafe427c8b2ffff9e371_l3.png)

**Note**: Of course commutativity applies for the intersection of *A* and *B*.

So, knowing *P(A)*, *P(B)* and either of the two it's possible to calculate the other using this equation.

* * *

## Full-On Example

Consider a bowl is filled with 3 black and 5 white marbles. What's the probability of picking:

- two consecutive black marbles
- black marble followed by white marble
- three consecutive black marbles
- a black marble in the second pick

![](https://i.ibb.co/L8TSc7t/marbles.png)

The overall number of marbles is 8, and so the probabilities of picking a black and white marble respectively are initially:

![](https://quicklatex.com/cache3/be/ql_a3230ca616d2152fadd887045c9acebe_l3.png)

### Two consecutive black marbles

After picking a black marble, 7 marbles will be remaining, with only 2 being black. The probability of picking a second black marble, after a black one has already been picked, is thus:

![](https://quicklatex.com/cache3/3f/ql_9ab691468f2575a1d470e3cc3515a73f_l3.png)

And so, the total probability for picking two consecutive black marbles is:

![](https://quicklatex.com/cache3/87/ql_1697e79536ae07014a8cbb3a69e07f87_l3.png)

### Black marble followed by white marble

After picking a black marble, 5 out of the 7 remaining ones will be white. So, the probability of picking a white one after a black marble is:

![](https://quicklatex.com/cache3/c7/ql_3c7b8ef0d75eade7da38b06b34ffbcc7_l3.png)

As such, the total probability for picking a black marble followed by a white marble is:

![](https://quicklatex.com/cache3/ed/ql_6228fa51833b87ebd06a54dda0d376ed_l3.png)

**Bonus**: Of course, the order doesn't matter in this problem, as picking a white one and then a black one has the same probability (it's simply the intersection of *B* and *W* in either order). As such, after picking a white one 3 black marbles will remain, giving the same total probability of:

![](https://quicklatex.com/cache3/e0/ql_66c318a0786acff054ed61640007dae0_l3.png)

### Three consecutive black marbles

After two black marbles have already been picked, picking a third marble has a probability of:

![](https://quicklatex.com/cache3/18/ql_321be61d3f955f3c66299ebcb608d018_l3.png)

as 6 marbles will remain with only 1 being black.

As such, the total probability is:

![](https://quicklatex.com/cache3/65/ql_38203902045db723c43cedea83484e65_l3.png)

In other words, the probability is basically the product:

![](https://quicklatex.com/cache3/2d/ql_338de2cd0bfd73284249a3839fee7b2d_l3.png)

as each pick depends on the previous pick.

### Black marble in second pick

This last case is a great example of the law of total probability!

Because it's uncertain what came first, the probability will be a sum of two cases:

- black marble was picked first
- white marble was picked first

So, picking a black marble in the second pick has a probability of:

![](https://quicklatex.com/cache3/87/ql_367d6eed9063fe713f989f0b72a83787_l3.png)

* * *

## RESOURCES:

### References

1. https://www.javatpoint.com/discrete-mathematics-tutorial
2. http://discrete.openmathbooks.org/dmoi3.html
3. https://brilliant.org/wiki/discrete-mathematics/
4. https://www.investopedia.com/terms/b/bayes-theorem.asp

### Images

1. [https://commons.wikimedia.org/wiki/File:Law_of_total_probability.png](https://commons.wikimedia.org/wiki/File:Law_of_total_probability.png)

Mathematical equations used in this article, have been generated using [quicklatex](http://quicklatex.com/).

Block diagrams and other visualizations were made using [draw.io](https://app.diagrams.net/).

* * *

## Previous articles of the series

* [Introduction](https://peakd.com/hive-163521/@drifter1/mathematics-an-introduction-to-discrete-mathematics) → Discrete Mathematics, Why Discrete Math, Series Outline
* [Sets](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-sets) → Set Theory, Sets (Representation, Common Notations, Cardinality, Types)
* [Set Operations](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-set-operations) → Venn Diagrams, Set Operations, Properties and Laws
* [Sets and Relations](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-sets-and-relations) → Cartesian Product of Sets, Relation and Function Terminology (Domain, Co-Domain and Range, Types and Properties)
* [Relation Closures](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-relation-closures) → Relation Closures (Reflexive, Symmetric, Transitive), Full-On Example
* [Equivalence Relations](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-equivalence-relations) → Equivalence Relations (Properties, Equivalent Elements, Equivalence  Classes, Partitions)
* [Partial Order Relations and Sets](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-partial-order-relations-and-sets) → Partial Order Relations, POSET (Elements, Max-Min, Upper-Lower Bounds), Hasse Diagrams, Total Order Relations, Lattices
* [Combinatorial Principles](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-combinatorial-principles) → Combinatorics, Basic Counting Principles (Additive, Multiplicative), Inclusion-Exclusion Principle (PIE)
* [Combinations and Permutations](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-combinations-and-permutations) → Factorial, Binomial Coefficient, Combination and Permutation (with / out repetition)
* [Combinatorics Topics](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-combinatorics-topics) → Pigeonhole Principle, Pascal's Triangle and Binomial Theorem, Counting Derangements
* [Propositions and Connectives](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-propositions-and-connectives) → Propositional Logic, Propositions, Connectives (∧, ∨, →, ↔ and ¬)
* [Implication and Equivalence Statements](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-implication-and-equivalence-statements) → Truth Tables, Implication, Equivalence, Propositional Algebra
* [Proof Strategies (part 1)](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-proof-strategies-part-1) → Proofs, Direct Proof, Proof by Contrapositive, Proof by Contradiction
* [Proof Strategies (part 2)](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-proof-strategies-part-2) → Proof by Cases, Proof by Counter-Example, Mathematical Induction
* [Sequences and Recurrence Relations](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-sequences-and-recurrence-relations) → Sequences (Terms, Definition, Arithmetic, Geometric), Recurrence Relations 
* [Probability](https://peakd.com/hive-163521/@drifter1/mathematics-discrete-mathematics-probability) → Probability Theory, Probability, Theorems, Example

* * *

## Final words | Next up

And this is actually it for today's post!

Next time we will get into an overview of Graph Theory...

See ya!

![](https://steemitimages.com/0x0/https://media.giphy.com/media/ybITzMzIyabIs/giphy.gif)

Keep on drifting!

Posted with [STEMGeeks](https://stemgeeks.net)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,