This notebook covers the basics of probability theory, with Python 3 implementations. (You should have some background in probability and Python.)

In 1814, Pierre-Simon Laplace wrote:

*Probability … is thus simply a fraction whose numerator is the number of favorable cases and whose denominator is the number of all the cases possible … when nothing leads us to expect that any one of these cases should occur more than any other.*

Pierre-Simon Laplace

1814

Laplace really nailed it, way back then! If you want to untangle a probability problem, all you have to do is be methodical about defining exactly what the cases are, and then careful in counting the number of favorable and total cases. We’ll start being methodical by defining some vocabulary:

**Experiment:** An occurrence with an uncertain outcome that we can observe.

*For example, rolling a die.*
**Outcome:** The result of an experiment; one particular state of the world. What Laplace calls a “case.”

*For example:* `4`

.
**Sample Space:** The set of all possible outcomes for the experiment.

*For example,* `{1, 2, 3, 4, 5, 6}`

.
**Event:** A subset of possible outcomes that together have some property we are interested in.

*For example, the event “even die roll” is the set of outcomes* `{2, 4, 6}`

.
**Probability:** As Laplace said, the probability of an event with respect to a sample space is the number of favorable cases (outcomes from the sample space that are in the event) divided by the total number of cases in the sample space. (This assumes that all outcomes in the sample space are equally likely.) Since it is a ratio, probability will always be a number between 0 (representing an impossible event) and 1 (representing a certain event).

*For example, the probability of an even die roll is 3/6 = 1/2.*

This notebook will develop all these concepts; I also have a second part that covers paradoxes in Probability Theory.

http://nbviewer.jupyter.org/url/norvig.com/ipython/Probability.ipynb

### Like this:

Like Loading...

*Related*

## Published by irrlab

https://about.me/irocha
View all posts by irrlab