# Lecture 5: conditional probability

• [[../../2017sp/lectures/lec13-conditioning.html|Last semester's notes]]
• Definitions: conditional probability
• Modeling with conditional probability
• Bayes's rule, Law of total probability

## Conditional probability

Definition: If and are events, then the probability of A given B, written is given by Note that is only defined if .

Intuitively, is the probability of in a new sample space created by restricting our attention to the subset of the sample space where occurs. We divide by so that .

Note: is not defined, only ; this is an abuse of notation, but is standard.

## Probability trees

Using conditional probability, we can draw a tree to help discover the probabilities of various events. Each branch of the tree partitions part of the sample space into smaller parts.

For example: suppose that it rains with probability 30%. Suppose that when it rains, I bring my umbrella 3/4 of the time, while if it is not raining, I bring my umbrella with probability 1/10. Given that I bring my umbrella, what is the probability that it is raining?

One way to model this problem is with the sample space

 = \{(r,u), (nr,u), (r,nu), (nr,nu)\}

[/math]

Let be the event "it is raining". Then . Let be the event "I bring my umbrella". Then .

The problem tells us that . It also states that while . We can use the following fact:

Fact: . Proof left as exercise.

to conclude that and .

We can draw a tree:

File:Lec05-tree.svg
caption Probability tree (<a href="lec05-tree.tex">LaTeX source</a>)

We can compute the probabilities of the events at the leaves by multiplying along the paths. For example,

To answer our question, we are interested in . We know . We can compute using the third axiom; . We can then plug this in to the above formula to find .

Note we could also answer this using Bayes's rule and the law of total probability (see below); it would amount to exactly the same calculation. The tree just helps organize all of the variables.

## Bayes's Rule

Bayes's rule is a simple way to compute from .

Claim: (Bayes's rule): .

Proof: Write down the definitions; proof left as exercise.

## Law of total probability

Claim: (law of total probability) If partition the sample space (that is, if for and ), then

Proof sketch: Write . Apply third axiom to conclude . Apply definition of .