Covariance and correlation from a joint probability table
Weight each scenario's product of returns by its probability to get E[XY], then subtract E[X]E[Y]: the unconditional covariance. Divide by both standard deviations for the correlation. Row and column totals of a joint table are marginal probabilities; if joint equals marginal times marginal everywhere, the variables are independent.
Watch the lesson 21 min
This lesson's video is for Plus members. The written lesson below is free, as always.
Before this: Unconditional expected value, variance and standard deviation
On the exam
- Calculate, interpret, and evaluate unconditional expected values for mean, variance, and covariance
- Calculate, interpret, and evaluate conditional expectations, variances, and covariances
Calculate and interpret the unconditional covariance and correlation of two returns from a scenario table, and read joint and marginal probabilities from a joint or contingency table. Expect a three-state table where equal-weighting the states or stopping at E[XY] are answer options, and a question on what independence implies.
How deeply to learn each part
- Know the idea
- Understand it in general. It frames other topics, but you will not calculate with it.
- Use it
- Understand it well enough to solve a question with it. Recognize when it applies.
- Memorize
- Learn it by heart. The exam will not give it to you.
You know this one. The full lesson is folded away. The takeaways, formulas and checkpoint below are your quick refresher, and the checkpoint is a fair test of whether you still do.
You tested strong here. The full lesson is folded away. The takeaways, formulas and checkpoint below are your quick refresher, and the checkpoint is a fair test of whether you still know it.
What is a joint probability table?
A joint probability is the chance that two random variables take particular values at the same time. A joint probability table (also called a joint distribution) lists those chances. In finance it usually looks like a short scenario analysis : a handful of states of the world, each with a probability and a return for each asset. When you have forecasts rather than history, this table is the raw material for the unconditional covariance : the covariance computed over all scenarios, before you know which one happens. Its symbol is σ_XY = Cov(X, Y); for two assets A and B we write σ_AB or Cov(R_A, R_B).
Here is the running example. Two assets face three states of the economy.
| State | Probability | R_A | R_B |
|---|---|---|---|
| Strong | 0.25 | 18% | 4% |
| Steady | 0.45 | 6% | 10% |
| Weak | 0.30 | −4% | 0% |
How do you find the covariance from the table?
Work in three steps: the expected returns, the expected product of the two returns, then subtract. This shortcut is the main route, because it needs no deviations.
The expected product of two assets' returns is 45 (%²). Their expected returns are 6% and 5.5%. The covariance (%²) is closest to:
45 − 6 × 5.5 = 12
Covariance (%²)12
- 45−(6×5.5)=
- 45ENTER6ENTER5.5×−
ENTER enter (on the HP, puts the number on the stack)
Why the shortcut works: the deviation form
Covariance is the probability-weighted average of the product of the two deviations from the means. That is what the shortcut computes without taking the deviations, and it is the form that shows what the sign means.
Try this 0 of 3
- Change one return so the covariance turns negative
- Double all three of B's returns and compare Cov and ρ
- Switch to independent returns and compare E[R_A R_B] with E[R_A] × E[R_B]
Bubble area is the state's probability. The dashed cross-hairs sit at the two expected returns; each label shows the state's vote, P × (deviation of A) × (deviation of B).
The "+" quadrants vote 16.50 and the "−" quadrants −4.50, so the covariance is 12.00 (%²): the returns tend to move together. Correlation 0.34.
Show working
Shortcut: σ_AB = E[R_A R_B] − E[R_A]E[R_B] = 45.00 − 6.00 × 5.50 = 45.00 − 33.00 = 12.00 (%²).
E[R_A R_B] = 0.25 × 72 + 0.45 × 60 + 0.3 × 0 = 45.00.
E[R_A] = 0.25 × 18 + 0.45 × 6 + 0.3 × (−4) = 6.00%.
E[R_B] = 0.25 × 4 + 0.45 × 10 + 0.3 × 0 = 5.50%.
Deviations of A: 12, 0, −10. Deviations of B: −1.5, 4.5, −5.5.
Why it works, the deviation form: σ_AB = Σ P × (R_A − E[R_A]) × (R_B − E[R_B]) = 0.25 × 12 × (−1.5) + 0.45 × 0 × 4.5 + 0.3 × (−10) × (−5.5) = (−4.5) + 0 + 16.5 = 12.00 (%²).
σ_A = √(0.25 × 12² + 0.45 × 0² + 0.3 × (−10)²) = √66.00 = 8.12%; σ_B = √18.75 = 4.33%.
ρ_AB = σ_AB ÷ (σ_A × σ_B) = 12.00 ÷ (8.12 × 4.33) = 0.34.
- (0.25×12×1.5+|-)+(0.45×0×4.5)+(0.3×10+|-×5.5+|-)=STO112.00, the covariance (%²)
- (0.25×12x²)+(0.45×0x²)+(0.3×10+|-x²)=√xSTO28.12, σ of A
- (0.25×1.5+|-x²)+(0.45×4.5x²)+(0.3×5.5+|-x²)=√xSTO34.33, σ of B
- RCL1÷RCL2÷RCL3=0.3411, the correlation
+|- change sign · STO store · x² square · √x square root · RCL recall a stored number
- 0.25ENTER12×1.5CHS×0.45ENTER0×4.5×+0.3ENTER10CHS×5.5CHS×+STO112.00, the covariance (%²)
- 0.25ENTER12ENTER××0.45ENTER0ENTER××+0.3ENTER10CHSENTER××+g√xSTO28.12, σ of A
- 0.25ENTER1.5CHSENTER××0.45ENTER4.5ENTER××+0.3ENTER5.5CHSENTER××+g√xSTO34.33, σ of B
- RCL1RCL2÷RCL3÷0.3411, the correlation
ENTER enter (on the HP, puts the number on the stack) · CHS change sign · STO store · g blue shift key · √x square root · RCL recall a stored number
Neither calculator's statistics mode takes probability-weighted pairs, so the sums are built term by term. Work in percent throughout: the covariance comes out in %², and ρ has no units.
Change a return and watch where each state sits relative to the cross-hairs at the two expected returns. Top right and bottom left add to the covariance, the other two corners subtract from it, and a bigger probability means a bigger bubble and a bigger vote. The Independent returns view adds row and column totals, the marginal probabilities.
How do you turn the covariance into a correlation?
Covariance on its own tells you only the direction. A large covariance does not by itself mean a strong relationship: covariance grows with the volatility of both variables. Strength is the correlation’s job. Divide by both standard deviations to get a number between −1 and +1. The standard deviations come from the same table: weight each squared deviation by its probability, with no n − 1.
- 1. Expected returns Memorize E[R_A] = Σ P × R_A and E[R_B] = Σ P × R_B
- 2. Unconditional covariance Memorize E[R_A R_B] − E[R_A] E[R_B]
- Deviation form Σ P × (R_A − E_A) × (R_B − E_B)
-
- 3. Standard deviations Use it √ of Σ P × (R − E)²
- 4. Correlation Memorize Cov ÷ (σ_A σ_B), between −1 and +1
Exam tip The positive covariance 12.0 looks large, yet the correlation is only 0.34. Always convert to correlation before judging strength.
What if the joint table is a grid?
Sometimes the joint probabilities come as a grid, with A’s possible returns down the side and B’s across the top. Each cell holds the probability that both happen together. The formula is unchanged: take every cell with a non-zero probability, treat it as a scenario, and sum.
| P(R_A, R_B) | R_B = 12% | R_B = 5% | R_B = −2% |
|---|---|---|---|
| R_A = 18% | 0.05 | 0.20 | 0 |
| R_A = 7% | 0.25 | 0.05 | 0 |
| R_A = −4% | 0 | 0.20 | 0.25 |
What are joint and marginal distributions?
The joint distribution function gives the probability that both variables are at or below chosen values at the same time. It is built from the joint probabilities.
In the grid above, P(R_A ≤ 7% and R_B ≤ 5%) adds the cells (7, 5), (7, −2), (−4, 5) and (−4, −2): 0.05 + 0 + 0.20 + 0.25 = 0.50.
The marginal probability is the distribution of one variable on its own. For a grid it is the row or column total, as in the expected-return step above. For continuous variables you find it by integrating the joint density over the other variable; that is for understanding only.
A contingency table shows how often combinations of categories occur, and works with counts. Here are 500 corporate bonds by rating and by whether they were downgraded within a year.
| Downgraded | Not downgraded | Total | |
|---|---|---|---|
| Investment grade | 38 | 287 | 325 |
| High yield | 42 | 133 | 175 |
| Total | 80 | 420 | 500 |
What changes when returns are independent?
Two random variables are independent random variables when the joint probability of any pair of outcomes is the product of the separate probabilities.
Suppose X has a 0.80 chance of “up” and Y has a 0.70 chance, and they are independent. Every joint cell is the product of its row and column totals.
| P(X, Y) | Y up (0.70) | Y down (0.30) | Total |
|---|---|---|---|
| X up (0.80) | 0.56 | 0.24 | 0.80 |
| X down (0.20) | 0.14 | 0.06 | 0.20 |
| Total | 0.70 | 0.30 | 1.00 |
For continuous variables the same idea holds: the joint density is the product of the marginal densities, and the joint cumulative function is the product of the marginal cumulative functions. With a table like this, the expected product splits too, and the covariance collapses to zero:
Many financial quantities are products of random variables. Revenue is price times quantity: if expected price is 20 and expected quantity is 300 and the two are uncorrelated, expected revenue is 20 × 300 = 6,000. The rule is for uncorrelated returns in the sense of zero covariance, and independent variables satisfy it automatically.
- Independent Use it P(X, Y) = P(X) P(Y); knowing one tells you nothing about the other
- Implies covariance 0, correlation 0, E[XY] = E[X]E[Y]
-
- Uncorrelated Use it covariance 0 but a nonlinear link may remain
- Positive covariance Memorize returns tend to sit on the same side of their means
- Negative covariance Memorize one tends to be above while the other is below
Go deeper Zero covariance does not imply independence
Let X be −1, 0 or +1, each with probability 1/3, and let Y = X². Then Y is completely determined by X, so the two are certainly not independent. But E[X] = 0 and E[XY] = E[X³] = (−1 + 0 + 1) ÷ 3 = 0, so Cov(X, Y) = 0 − 0 × E[Y] = 0.
Covariance and correlation only detect straight-line association. Independence is the stronger property, which is why independent variables are always uncorrelated but uncorrelated variables are not always independent.
Go deeper Where scenario tables are used
An analyst builds a table like this by choosing a few states of the world, assigning probabilities and forecasting each asset’s return in each state. The same layout supports stress testing, where one state is made deliberately extreme. Because the probabilities are forecasts, the covariance is forward-looking, and there is no n − 1 anywhere. A sample covariance from historical data (Learning Module 5), in contrast, divides by n − 1. Learning Module 8 uses the same scenario table to get a portfolio’s variance directly.
Memorize this
MemorizeReading the signs of the products
| R_A vs mean | R_B vs mean | Product | Pushes covariance |
|---|---|---|---|
| above | above | + | up |
| below | below | + | up |
| above | below | − | down |
| below | above | − | down |
Memory hook Each scenario casts a vote: same side of the means is a plus, opposite sides a minus, and the probability is the size of the vote.
Know it cold , or . Independent: and Cov = 0.
- 1. Expected returns Memorize E[R_A] = Σ P × R_A and E[R_B] = Σ P × R_B
- 2. Unconditional covariance Memorize E[R_A R_B] − E[R_A] E[R_B]
- Deviation form Σ P × (R_A − E_A) × (R_B − E_B)
-
- 3. Standard deviations Use it √ of Σ P × (R − E)²
- 4. Correlation Memorize Cov ÷ (σ_A σ_B), between −1 and +1
- Independent Use it P(X, Y) = P(X) P(Y); knowing one tells you nothing about the other
- Implies covariance 0, correlation 0, E[XY] = E[X]E[Y]
-
- Uncorrelated Use it covariance 0 but a nonlinear link may remain
- Positive covariance Memorize returns tend to sit on the same side of their means
- Negative covariance Memorize one tends to be above while the other is below
Quick example
Probabilities 0.25, 0.50, 0.25 with returns 12%, 6% and −4%. 0.25 × 12 + 0.50 × 6 + 0.25 × (−4) = 3 + 3 − 1 = 5%.
- 0.25×12+(0.5×6)+(0.25×4+|-)= 5
+|- change sign
- 0.25ENTER12×0.5ENTER6×+0.25ENTER4CHS×+ 5
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Two states, probabilities 0.6 and 0.4: A returns 10% and −5% (mean 4%), B returns 6% and 2% (mean 4.4%). E[R_A R_B] = 0.6 × 60 + 0.4 × (−10) = 32. Cov = 32 − 4 × 4.4 = 14.4 (%²).
- 0.6×60+(0.4×10+|-)=−(4×4.4)= 14.4
+|- change sign
- 0.6ENTER60×0.4ENTER10CHS×+4ENTER4.4×− 14.4
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Two states with probabilities 0.6 and 0.4. A returns 10% and −5% (mean 4%); B returns 6% and 2% (mean 4.4%). 0.6 × (6)(1.6) + 0.4 × (−9)(−2.4) = 5.76 + 8.64 = 14.4 (%²).
- 0.6×(10−4)×(6−4.4)+(0.4×(5+|-−4)×(2−4.4))= 14.4
+|- change sign
- 10ENTER4−6ENTER4.4−×0.6×5CHSENTER4−2ENTER4.4−×0.4×+ 14.4
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Covariance −12, standard deviations 6% and 4%. −12 ÷ (6 × 4) = −0.50.
- 12+|-÷(6×4)= -0.5
+|- change sign
- 12CHSENTER6ENTER4×÷ -0.5
CHS change sign · ENTER enter (on the HP, puts the number on the stack)
Quick example
In the grid below, P(R_A ≤ 7% and R_B ≤ 5%) adds the cells (7, 5), (7, −2), (−4, 5) and (−4, −2): 0.05 + 0 + 0.20 + 0.25 = 0.50.
- 0.05+0.20+0.25= 0.5
- 0.05ENTER0.20+0.25+ 0.5
ENTER enter (on the HP, puts the number on the stack)
Quick example
P(X = 1) = 0.35 and P(Y = 1) = 0.60, with X and Y independent. P(X = 1 and Y = 1) = 0.35 × 0.60 = 0.21.
- 0.35×0.6= 0.21
- 0.35ENTER0.6× 0.21
ENTER enter (on the HP, puts the number on the stack)
Quick example
Revenue is price times quantity. If expected price is 20 and expected quantity is 300 and they are uncorrelated, expected revenue is 20 × 300 = 6,000.
- 20×300= 6000
- 20ENTER300× 6000
ENTER enter (on the HP, puts the number on the stack)
How it is asked
-
Covariance from a three-state table
Probabilities 0.55, 0.25, 0.20. A: 14%, 6%, −8%. B: 3%, 9%, −5%. Covariance?
E[A] = 7.6, E[B] = 2.9. Weight each product of deviations: 22.56. Traps: 38.04 (equal weights), 44.60 (no deviations).
-
Joint against marginal from counts
500 bonds; 175 high yield; 80 downgraded; 42 both. P(high yield and downgraded)?
42 ÷ 500 = 8.4%. Traps: 5.6% (product of marginals), 24% (conditional).
-
Independent returns
Two assets have independent returns. Their covariance is?
Zero, and so is the correlation.
-
Joint probability when independent
P(X = 1) = 0.35, P(Y = 1) = 0.60, independent. P(both)?
0.35 × 0.60 = 0.21. Traps: 0.95 (sum), 0.25 (difference).
-
What does the sign tell you?
The covariance from a joint table is negative. Meaning?
Returns tend to be on opposite sides of their means. Says nothing about strength.
Exam traps
- Equal-weighting the states instead of using their probabilities.
- Forgetting to subtract the expected returns, that is, using E[R_A R_B] alone.
- Dividing by n − 1 as if the states were a sample. A forecast uses probabilities.
- Reading a negative or small covariance as 'weak'. The sign gives the direction; only correlation gives the strength.
- Assuming zero covariance means independence. Independence implies zero covariance, not the reverse.
- Multiplying the marginal probabilities to get a joint probability when the variables are not independent.
Checkpoint
6 exam-style questions. About 90 seconds each.
1Three states have probabilities 0.2, 0.5 and 0.3. Asset A returns 12%, 7% and −2%; asset B returns −4%, 3% and 8%. The covariance of the returns (in %²) is closest to:
2If the returns on two assets are independent, their covariance is:
3The sign of a covariance computed from a joint probability table most likely tells the analyst:
4In the same three-state table (probabilities 0.2, 0.5, 0.3; expected returns 5.3% and 3.1%; covariance −20.33 %²), the standard deviations are 5.139% for A and 4.158% for B. The correlation of the returns is closest to:
5The returns on two assets are independent. The probability that asset X has a good year is 0.40 and the probability that asset Y has a good year is 0.25. The probability that both have a good year is closest to:
6Of 400 corporate bonds, 120 are high yield and 48 were downgraded within a year; 30 bonds were both high yield and downgraded. The joint probability that a randomly chosen bond is high yield and was downgraded is closest to:
Key takeaways
- Unconditional covariance: Cov = E[R_A R_B] − E[R_A] E[R_B].
- Or: Cov = Σ P × (deviation of A) × (deviation of B), summed over the scenarios.
- Correlation = Cov ÷ (σ_A σ_B), between −1 and +1.
- Independent returns have zero covariance and zero correlation.
- Row and column totals of a joint table are the marginal probabilities.
Quick example
Probabilities 0.25, 0.50, 0.25 with returns 12%, 6% and −4%. 0.25 × 12 + 0.50 × 6 + 0.25 × (−4) = 3 + 3 − 1 = 5%.
- 0.25×12+(0.5×6)+(0.25×4+|-)= 5
+|- change sign
- 0.25ENTER12×0.5ENTER6×+0.25ENTER4CHS×+ 5
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Two states, probabilities 0.6 and 0.4: A returns 10% and −5% (mean 4%), B returns 6% and 2% (mean 4.4%). E[R_A R_B] = 0.6 × 60 + 0.4 × (−10) = 32. Cov = 32 − 4 × 4.4 = 14.4 (%²).
- 0.6×60+(0.4×10+|-)=−(4×4.4)= 14.4
+|- change sign
- 0.6ENTER60×0.4ENTER10CHS×+4ENTER4.4×− 14.4
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Two states with probabilities 0.6 and 0.4. A returns 10% and −5% (mean 4%); B returns 6% and 2% (mean 4.4%). 0.6 × (6)(1.6) + 0.4 × (−9)(−2.4) = 5.76 + 8.64 = 14.4 (%²).
- 0.6×(10−4)×(6−4.4)+(0.4×(5+|-−4)×(2−4.4))= 14.4
+|- change sign
- 10ENTER4−6ENTER4.4−×0.6×5CHSENTER4−2ENTER4.4−×0.4×+ 14.4
ENTER enter (on the HP, puts the number on the stack) · CHS change sign
Quick example
Covariance −12, standard deviations 6% and 4%. −12 ÷ (6 × 4) = −0.50.
- 12+|-÷(6×4)= -0.5
+|- change sign
- 12CHSENTER6ENTER4×÷ -0.5
CHS change sign · ENTER enter (on the HP, puts the number on the stack)
Quick example
In the grid below, P(R_A ≤ 7% and R_B ≤ 5%) adds the cells (7, 5), (7, −2), (−4, 5) and (−4, −2): 0.05 + 0 + 0.20 + 0.25 = 0.50.
- 0.05+0.20+0.25= 0.5
- 0.05ENTER0.20+0.25+ 0.5
ENTER enter (on the HP, puts the number on the stack)
Quick example
P(X = 1) = 0.35 and P(Y = 1) = 0.60, with X and Y independent. P(X = 1 and Y = 1) = 0.35 × 0.60 = 0.21.
- 0.35×0.6= 0.21
- 0.35ENTER0.6× 0.21
ENTER enter (on the HP, puts the number on the stack)
Quick example
Revenue is price times quantity. If expected price is 20 and expected quantity is 300 and they are uncorrelated, expected revenue is 20 × 300 = 6,000.
- 20×300= 6000
- 20ENTER300× 6000
ENTER enter (on the HP, puts the number on the stack)
Questions about this lesson?
Where this comes back
- Portfolio expected return, variance and the role of correlation Portfolio Return and Risk
- Portfolio Risk and Return: Part I Portfolio Construction
Questions candidates ask
How do you calculate covariance from a joint probability table?
Find each asset's expected return from the probabilities. In every scenario, multiply the two deviations from those means, then multiply by the scenario's probability. Add the results. Use the probabilities as weights, never an equal split and never n − 1.
Are independent returns uncorrelated?
Yes. Independence means the joint probability is the product of the separate probabilities, which makes the covariance and correlation zero. The reverse is not true: returns can be uncorrelated and still linked in a nonlinear way, so zero correlation alone does not prove independence.
What is the difference between joint and marginal probability?
A joint probability is the chance that two things happen together, such as a bond being high yield and downgraded (42 of 500, 8.4%). A marginal probability looks at one variable alone, from a row or column total: 175 of 500 bonds are high yield, 35%.
Spotted an error? Tell us and we will fix it.