Probability Theory Fundamentals › Bayes' Theorem

Michael BrenndoerferOctober 19, 20256 min read
Quantitative FinanceAll chapters
Part 1 of 15Mathematical Foundations
Chapter 2Probability Theory Fundamentals › Bayes' Theorem
Reading section 10 of 15 · Bayes' Theorem · 6 minSection 10 of 15 · 6 min

Book contents

Section 10 of 15 · 6 min read

Probability Theory Fundamentals › Bayes' TheoremOne section · Sections in this chapter10 / 15 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Bayes' Theorem provides a systematic method for updating probabilities when new information arrives, establishing the mathematical basis for learning from data and adapting beliefs. These skills are essential in finance, where conditions change constantly.

Bayes' Theorem

For P(A)>0P(A)>0 and P(B)>0P(B)>0:

P(A∣B)=P(B∣A)⋅P(A)P(B)P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}

where:

  • P(A∣B)P(A|B): posterior probability of AA given evidence BB
  • P(B∣A)P(B|A): likelihood of observing BB if AA is true
  • P(A)P(A): prior probability of AA before observing BB
  • P(B)P(B): marginal probability of BB (normalizing constant)

In words: the probability of AA given BB equals the probability of BB given AA, times the prior probability of AA, divided by the probability of BB.

For P(A)>0P(A)>0 and P(B)>0P(B)>0, Bayes' Theorem follows directly from the definition of conditional probability applied twice. Starting from P(A∣B)=P(A∩B)/P(B)P(A|B) = P(A \cap B)/P(B) and noting that P(A∩B)=P(B∣A)⋅P(A)P(A \cap B) = P(B|A) \cdot P(A), we obtain the theorem. If P(A)=0P(A)=0 and P(B)>0P(B)>0, then P(A∣B)=0P(A|B)=0 directly from the joint probability; the elementary ratio defining P(B∣A)P(B|A) is undefined. The theorem gives a practical way to update a specified model under new evidence.

The components have specific names that reflect their roles in the updating process:

  • P(A)P(A): Prior probability, representing our belief about AA before observing BB
  • P(B∣A)P(B|A): Likelihood, measuring how probable the evidence BB is if AA is true
  • P(A∣B)P(A|B): Posterior probability, representing our updated belief about AA after observing BB
  • P(B)P(B): Evidence probability, which is a normalizing constant

Once a prior and likelihood model are specified, the theorem provides the rule for computing the posterior after observing evidence. The posterior can then become the prior for the next round of updating as more evidence arrives.

Worked Example: Updating Default Probabilities

A bank is evaluating a corporate borrower. Based on the firm's industry and size, the bank initially estimates a 3% probability of default within one year. This is the prior probability.

The bank then receives the firm's quarterly financial statements showing deteriorating profit margins. Historical estimates from a comparable borrower cohort, measured at the same observation point before a one-year forecast horizon, show:

  • 40% of companies that defaulted within the following year showed deteriorating margins at the observation date
  • 10% of companies that did not default within that same year showed deteriorating margins at the observation date

The bank wants to update its default probability given this new information.

Step 1: Define events

  • DD = company defaults within one year
  • MM = company shows deteriorating margins

Step 2: List known probabilities

  • P(D)=0.03P(D) = 0.03 (prior default probability)
  • P(Dc)=0.97P(D^c) = 0.97 (prior probability of no default)
  • P(M∣D)=0.40P(M|D) = 0.40 (likelihood of margin deterioration given default)
  • P(M∣Dc)=0.10P(M|D^c) = 0.10 (likelihood of margin deterioration given no default)

Step 3: Calculate P(M)P(M) using the law of total probability

Before applying Bayes' Theorem, we need the total probability of observing deteriorating margins, regardless of whether default occurs. The law of total probability provides this by considering all mutually exclusive ways the evidence could arise:

P(M)=P(M∣D)⋅P(D)+P(M∣Dc)⋅P(Dc)P(M) = P(M|D) \cdot P(D) + P(M|D^c) \cdot P(D^c)

where:

  • P(M)P(M): total probability of observing deteriorating margins
  • P(M∣D)P(M|D): probability of deteriorating margins given the company defaults
  • P(D)P(D): prior probability of default
  • P(M∣Dc)P(M|D^c): probability of deteriorating margins given no default
  • P(Dc)P(D^c): probability of no default

This formula works because every company either defaults or doesn't, so we can decompose the probability of deteriorating margins into these two mutually exclusive cases. We weight each conditional probability by the probability of that case occurring. The law of total probability essentially averages the conditional probabilities, weighted by the probability of each conditioning event.

In[19]:
Code
# Prior probabilities
p_default = 0.03
p_no_default = 0.97

# Likelihoods
p_margin_given_default = 0.40
p_margin_given_no_default = 0.10

# Calculate P(M) using law of total probability
p_margin = p_margin_given_default * p_default + p_margin_given_no_default * p_no_default
Out[20]:
Console
P(Deteriorating Margins) = 0.4 × 0.03 + 0.1 × 0.97
P(Deteriorating Margins) = 0.1090

Step 4: Apply Bayes' Theorem

Now we have all the ingredients to compute the posterior probability:

P(D∣M)=P(M∣D)⋅P(D)P(M)P(D|M) = \frac{P(M|D) \cdot P(D)}{P(M)}

where:

  • P(D∣M)P(D|M): posterior probability of default given deteriorating margins (what we want to find)
  • P(M∣D)P(M|D): likelihood of deteriorating margins among defaulting companies (0.40)
  • P(D)P(D): prior default probability (0.03)
  • P(M)P(M): probability of deteriorating margins (calculated in Step 3)

The numerator P(M∣D)⋅P(D)P(M|D) \cdot P(D) represents the probability of both defaulting and showing deteriorating margins. The denominator normalizes this by dividing by the total probability of the evidence.

In[21]:
Code
# Bayes' Theorem
p_default_given_margin = (p_margin_given_default * p_default) / p_margin
Out[22]:
Console
P(Default | Deteriorating Margins) = (0.4 × 0.03) / 0.1090
P(Default | Deteriorating Margins) = 0.1101

Updated default probability: 11.01%
Prior default probability: 3.00%
Increase factor: 3.7x

The deteriorating margins more than tripled our assessed default probability from 3% to about 11%. This updated probability can inform lending decisions, pricing, and reserve estimates, alongside exposure, recovery assumptions, and applicable accounting rules. The magnitude of this update reflects both the strength of the evidence, since deteriorating margins are much more common among defaulters, and the prior belief that default was already considered unlikely.

Visualizing Bayes' Theorem

The following visualization shows how the prior probability updates to the posterior as we incorporate new evidence.

Out[23]:
Visualization
Bar chart comparing prior and posterior probabilities for default and no-default scenarios.
Bayesian updating of default probability. The prior (left bars) combines with the evidence to produce the posterior (right bars).