Skip to main content

Rules of covariance and the variance of a sum

Covariance is symmetric and linear in each slot. Derive those rules, then the variance of any sum, Var(X) + Var(Y) + 2 Cov(X, Y), find the course’s covariance again from the flip the two counts share, and see why an ensemble wants errors that do not move together.
M06.10.2L1 Core25 min
In review (what this means)

The maths and code on this page are checked by automated tests on every change, but an independent reader has not signed it off yet. Spot a mistake or a confusing step? Tell us.

Before this lesson: M06.10.1 Covariance: do they move together?

What you will be able to do
  • Derive Cov(aX + b, Y) = a Cov(X, Y) and Cov(X + W, Y) = Cov(X, Y) + Cov(W, Y), and use them to expand the covariance of sums.
  • Derive Var(X + Y) = Var(X) + Var(Y) + 2 Cov(X, Y), with the independent case of M06.7.3 as the special case Cov = 0.
  • Find the covariance of the course’s table again as the variance of the shared flip, and check Var(X + Y) = 3/2 against the PMF of X + Y.
  • Write the 2 by 2 covariance matrix of a pair, and compute the variance of the average of two predictors as (σ² + Cov)/2.

The question

Two models predict house prices, and each is off by an error with variance 4. Average their predictions. If the two errors were independent, the variance of the average would be 2, half of either one. But two models trained on the same data tend to make the same mistakes. How much does averaging help then, and what number decides it?

From the last lesson

1. State the shortcut for the covariance.

Show answer

\({\operatorname{Cov}(X, Y)}\) \({= \E[XY] - \E[X]\,\E[Y]}\).

2. What is \({\operatorname{Cov}(X, X)}\)?

Show answer

\({\operatorname{Var}(X)}\): with \({Y = X}\) every rectangle is a square.

Intuition

Take one outcome. Call its two deviations \({a = x - \mu_X}\) and \({b = y - \mu_Y}\). The deviation of the sum \({X + Y}\) from its mean \({\mu_X + \mu_Y}\) is then \({a + b}\), and its square is a square of side \({a + b}\). Cut that square along the two sides and it falls into four pieces: a square \(a^2\), a square \(b^2\), and two rectangles \(ab\).

Left: a square of side a plus b, where a is x minus mu X and b is y minus mu Y, cut into four pieces: a grey square a squared at top left, a grey square b squared at bottom right, and two green rectangles a b; underneath, one outcome: a plus b squared equals a squared plus b squared plus 2 a b. Right, titled Var of X plus Y, on average: two stacked bars. The bar labelled if independent has two grey blocks, Var of X equals 1/2 and Var of Y equals 1/2, total 1. The bar labelled the course's table has the same two blocks and a green block on top, 2 Cov equals 1/2, total 3/2.
M06.10.2-F1

Left: for one outcome, the square on the deviation of the sum is two squares and two rectangles. Right: averaged over the course’s table, the squares give the two variances and the rectangles give twice the covariance, \({1/2 + 1/2 + 1/2 = 3/2}\).

Average each piece over all outcomes. The squares average to \({\operatorname{Var}(X)}\) and \({\operatorname{Var}(Y)}\). The rectangles are the rectangles of M06.10.1, and they average to the covariance, twice. So the spread of a sum is the two spreads plus twice the covariance. When the variables move together the sum spreads more; when they move apart it spreads less.

Build it up

Step 1. Order does not matter. The rectangle of the point \({(x, y)}\) has the same area as the rectangle of \({(y, x)}\), so \({\operatorname{Cov}(X, Y) = \operatorname{Cov}(Y, X)}\).

Step 2. A shift changes nothing. Add 3 to every value of \(X\). Every point moves 3 to the right, and so does the mean of \(X\). No deviation changes, so no rectangle changes.

Step 3. A stretch scales the rectangles. Double every value of \(X\). Each horizontal deviation doubles, so every rectangle is twice as wide and the covariance doubles. Multiply by \(-1\) instead and every rectangle flips sign.

Two scatter plots on the same horizontal scale from 0 to 14, each with seven blue points, orange lines at the means and green or purple rectangles to the crossing. Top, titled X against Y: the points sit between about 1 and 5, and the note reads Cov equals 0.75. Bottom, titled 2X plus 3 against Y: the same points stretched to between about 5 and 13, the mean line moved to 9, and every rectangle twice as wide; the note reads Cov equals 2 times 0.75 equals 1.50.
M06.10.2-F2

\({2X + 3}\) against \(Y\). The shift by 3 moves the points and their mean together, so it changes no rectangle; the stretch by 2 doubles every width, so it doubles the covariance.

Step 4. A sum in one slot splits. The deviation of \({X + W}\) is the deviation of \(X\) plus the deviation of \(W\). A rectangle whose width is a sum of two widths is two rectangles side by side.

The formal statement

NoteRules of covariance

For random variables \(X\), \(W\), \(Y\) and numbers \(a\), \(b\):

  • Symmetric: \({\operatorname{Cov}(X, Y) = \operatorname{Cov}(Y, X)}\).
  • Shift and stretch: \({\operatorname{Cov}(aX + b, Y)}\) \({= a\operatorname{Cov}(X, Y)}\).
  • Sum: \({\operatorname{Cov}(X + W, Y)}\) \({= \operatorname{Cov}(X, Y) + \operatorname{Cov}(W, Y)}\).

By symmetry the last two hold in the second slot as well.

Shift and stretch. By linearity, \({\E[aX + b] = a\mu_X + b}\). The deviation of \({aX + b}\) is

\[ (aX + b) - (a\mu_X + b) = a(X - \mu_X). \]

The shift \(b\) has cancelled. Then

\[ \begin{aligned} &\operatorname{Cov}(aX + b, Y) \\ &\quad= \E\big[a(X - \mu_X)(Y - \mu_Y)\big] \\ &\quad= a\,\E\big[(X - \mu_X)(Y - \mu_Y)\big] \\ &\quad= a\operatorname{Cov}(X, Y). \end{aligned} \]

Sum. The mean of \({X + W}\) is \({\mu_X + \mu_W}\), so its deviation is \({(X - \mu_X) + (W - \mu_W)}\). Multiply by \({Y - \mu_Y}\) and use linearity:

\[ \begin{aligned} &\operatorname{Cov}(X + W, Y) \\ &\quad= \E\big[(X - \mu_X)(Y - \mu_Y)\big] \\ &\qquad + \E\big[(W - \mu_W)(Y - \mu_Y)\big] \\ &\quad= \operatorname{Cov}(X, Y) + \operatorname{Cov}(W, Y). \end{aligned} \]

Together these rules say that covariance is linear in each slot, so the covariance of two sums expands like a product of two brackets: every piece of the first with every piece of the second.

The variance of a sum. A variance is a covariance with itself, so expand both slots:

\[ \begin{aligned} &\operatorname{Var}(X + Y) \\ &\quad= \operatorname{Cov}(X + Y, X + Y) \\ &\quad= \operatorname{Cov}(X, X) + \operatorname{Cov}(X, Y) \\ &\qquad + \operatorname{Cov}(Y, X) + \operatorname{Cov}(Y, Y) \\ &\quad= \operatorname{Var}(X) + \operatorname{Var}(Y) \\ &\qquad + 2\operatorname{Cov}(X, Y). \end{aligned} \]

For independent \(X\) and \(Y\), \({\E[XY] = \E[X]\,\E[Y]}\) (M06.7.2), so the covariance is 0 and the rule of M06.7.3 comes back: variances add. The same expansion with \({aX + bY}\) gives the general form

\[ \begin{aligned} &\operatorname{Var}(aX + bY) \\ &\quad= a^2\operatorname{Var}(X) + b^2\operatorname{Var}(Y) \\ &\qquad + 2ab\operatorname{Cov}(X, Y), \end{aligned} \]

and with \({a = 1}\), \({b = -1}\), the difference: \({\operatorname{Var}(X - Y)}\) \({= \operatorname{Var}(X) + \operatorname{Var}(Y)}\) \({- 2\operatorname{Cov}(X, Y)}\).

The covariance matrix, a first look. The three numbers in that formula fit in a 2 by 2 table, the covariance matrix of the pair: variances on the diagonal, the covariance off it. For the course’s table,

\[ \mat{\Sigma} = \begin{pmatrix} \operatorname{Var}(X) & \operatorname{Cov}(X, Y) \\ \operatorname{Cov}(Y, X) & \operatorname{Var}(Y) \end{pmatrix} \]

\[ = \begin{pmatrix} 1/2 & 1/4 \\ 1/4 & 1/2 \end{pmatrix} . \]

It is symmetric because covariance is. The variance of any combination \({aX + bY}\) is read off it: \(a^2\) times the top left, \(b^2\) times the bottom right, \(2ab\) times the corner. Principal component analysis (M03.6) and the multivariate Gaussian (M07.3) are built on this matrix.

Go deeper: the same formula as a matrix product

Put the weights in a column \({\vect{w} = (a, b)}\). Then the variance of \({aX + bY}\) is \({\vect{w}\T \mat{\Sigma}\, \vect{w}}\). Multiplying out,

\[ \begin{aligned} \vect{w}\T \mat{\Sigma}\, \vect{w} &= a^2 \Sigma_{11} + ab\,\Sigma_{12} \\ &\quad + ba\,\Sigma_{21} + b^2 \Sigma_{22}, \end{aligned} \]

which is the formula above because \({\Sigma_{12} = \Sigma_{21}}\). Since a variance is never negative, \({\vect{w}\T \mat{\Sigma}\, \vect{w} \ge 0}\) for every \(\vect{w}\): a covariance matrix is always positive semidefinite, the property M03.4 studies.

Averaging two predictors. Let \({E_1}\) and \({E_2}\) be the errors of two predictors, each with variance \({\sigma^2}\) and covariance \(C\). The averaged prediction has error \({(E_1 + E_2)/2}\), so by the rule with \({a = b = 1/2}\):

\[ \begin{aligned} &\operatorname{Var}\Big(\tfrac{E_1 + E_2}{2}\Big) \\ &\quad= \tfrac14\big(\sigma^2 + \sigma^2 + 2C\big) \\ &\quad= \tfrac{\sigma^2 + C}{2} . \end{aligned} \]

A straight vermillion line rising from 0 at covariance minus 4 to 4 at covariance 4, with the covariance of the two errors across and the variance of the average up. A dashed grey line at height 4 is labelled one predictor alone: 4. Dots on the line are labelled opposite errors: 0 at covariance minus 4, independent errors: 2 at covariance 0, and errors move together: 3.5 at covariance 3.
M06.10.2-F4

Two predictors whose errors each have variance 4. The variance of their average is \({(4 + C)/2}\): half of 4 when the errors are independent, 3.5 when their covariance is 3, and no gain at all when it reaches 4.

With \({\sigma^2 = 4}\): independent errors give 2; errors with covariance 3 give 3.5, barely better than one predictor. This is why an ensemble (ML02.2) is built from members that err differently: different data, different features, different kinds of model. However many members are added, the variance of the average never falls below the covariance they share (exercise 3).

Worked example

The course’s covariance, found again. Let \({H_1, H_2, H_3}\) be 1 for a head and 0 for a tail on the three flips. Each has variance \({\tfrac12 \cdot \tfrac12 = \tfrac14}\) (a Bernoulli variable, M06.7.3). The flips are independent, so for \({i \ne j}\), \({\E[H_i H_j] = \E[H_i]\,\E[H_j]}\) and \({\operatorname{Cov}(H_i, H_j) = 0}\).

Now \({X = H_1 + H_2}\) and \({Y = H_2 + H_3}\). Expand both slots, every piece with every piece:

\[ \begin{aligned} &\operatorname{Cov}(H_1 + H_2,\; H_2 + H_3) \\ &\quad= \operatorname{Cov}(H_1, H_2) + \operatorname{Cov}(H_1, H_3) \\ &\qquad + \operatorname{Cov}(H_2, H_2) + \operatorname{Cov}(H_2, H_3) \\ &\quad= 0 + 0 + \tfrac14 + 0 = \tfrac14 . \end{aligned} \]

Left: three circles H1, H2 and H3 for the three flips, with H2 shaded yellow. A blue bracket above H1 and H2 is labelled X equals H1 plus H2, and a sky-blue bracket below H2 and H3 is labelled Y equals H2 plus H3; underneath, each H k: 0 or 1, Var equals 1/4. An arrow labelled split leads to a 2 by 2 grid with rows H1 and H2 and columns H2 and H3. Three cells read 0; the yellow cell in row H2, column H2 reads Var of H2 equals 1/4. Underneath, Cov of X and Y equals 0 plus 0 plus 1/4 plus 0, equals 1/4.
M06.10.2-F3

Cov(X, Y) by the rules. Each count is split into flips, and the covariance into one cell per pair of flips. Only the shared flip, \({H_2}\) with itself, contributes: its variance, \({1/4}\).

The covariance of the two counts is the variance of the one flip they share, the same \({1/4}\) that the table gave in M06.10.1, now with a reason.

The variance of the sum. By the rule,

\[ \begin{aligned} \operatorname{Var}(X + Y) &= \tfrac12 + \tfrac12 + 2 \cdot \tfrac14 \\ &= \tfrac32 . \end{aligned} \]

Check it directly. \({X + Y = H_1 + 2H_2 + H_3}\) takes the values 0 to 4 with probabilities \({\tfrac18, \tfrac28, \tfrac28, \tfrac28, \tfrac18}\) (count the eight outcomes). Its mean is 2, and

\[ \begin{aligned} &\E\big[(X + Y - 2)^2\big] \\ &\quad= \tfrac{4 \cdot 1 + 1 \cdot 2 + 0 \cdot 2 + 1 \cdot 2 + 4 \cdot 1}{8} \\ &\quad= \tfrac{12}{8} = \tfrac32 . \end{aligned} \]

The variance of the difference. \({\operatorname{Var}(X - Y)}\) \({= \tfrac12 + \tfrac12 - 2 \cdot \tfrac14}\) \({= \tfrac12}\). Check: \({X - Y = H_1 - H_3}\), the shared flip cancels, and two independent flips give \({\tfrac14 + \tfrac14 = \tfrac12}\).

Code

From scratch, with every variable a function of the eight equally likely outcomes, so that each rule is checked exactly.

from fractions import Fraction
from itertools import product

outcomes = list(product([0, 1], repeat=3))          # (H1, H2, H3), each 1/8
P = Fraction(1, 8)

def E(f):
    return sum(f(w) * P for w in outcomes)

def cov(f, g):
    mf, mg = E(f), E(g)
    return E(lambda w: (f(w) - mf) * (g(w) - mg))

X = lambda w: w[0] + w[1]
Y = lambda w: w[1] + w[2]
W = lambda w: w[2]
print("Cov(X, Y) =", cov(X, Y), "  Var(H2) =", cov(lambda w: w[1], lambda w: w[1]))
print("Cov(2X + 3, Y) =", cov(lambda w: 2 * X(w) + 3, Y))
print("Cov(X + W, Y) =", cov(lambda w: X(w) + W(w), Y), " =", cov(X, Y), "+", cov(W, Y))
S, D = (lambda w: X(w) + Y(w)), (lambda w: X(w) - Y(w))
print("Var(X + Y) =", cov(S, S), "  Var(X - Y) =", cov(D, D))
Cov(X, Y) = 1/4   Var(H2) = 1/4
Cov(2X + 3, Y) = 1/2
Cov(X + W, Y) = 1/2  = 1/4 + 1/4
Var(X + Y) = 3/2   Var(X - Y) = 1/2

Now the covariance matrix from simulated flips, and the two predictors. Their errors are built as a shared part \(S\) with variance 3 plus a private part with variance 1, so each error has variance 4 and the two have covariance 3.

import numpy as np

rng = np.random.default_rng(4)
flips = rng.integers(0, 2, size=(200_000, 3))
Xs, Ys = flips[:, 0] + flips[:, 1], flips[:, 1] + flips[:, 2]
print("covariance matrix:\n", np.cov(Xs, Ys, bias=True).round(3))

n = 200_000
shared = rng.normal(scale=np.sqrt(3), size=n)
e1 = shared + rng.normal(size=n)
e2 = shared + rng.normal(size=n)
print("each error:", e1.var().round(2), e2.var().round(2), "  covariance:", np.cov(e1, e2, bias=True)[0, 1].round(2))
print("variance of the average:", ((e1 + e2) / 2).var().round(2), "  formula (4 + 3)/2 =", (4 + 3) / 2)
covariance matrix:
 [[0.5   0.25 ]
 [0.25  0.499]]
each error: 3.99 3.98   covariance: 2.99
variance of the average: 3.49   formula (4 + 3)/2 = 3.5

Explore

The correlation explorer of M06.10.3 shows the rule for a stretch at work: switch the heights from metres to centimetres, which multiplies them by 100, and watch the covariance grow by exactly that factor.

Pitfalls

Two PMFs over the values 0 to 4 of X plus Y. Left, marked with a cross and titled As if independent: vermillion bars of 1/16, 4/16, 6/16, 4/16 and 1/16, with the note Var equals 1/2 plus 1/2 equals 1. Right, marked with a tick and titled The real PMF: grey bars of 1/8, 2/8, 2/8, 2/8 and 1/8, flatter and wider, with the note Var equals 1/2 plus 1/2 plus 2 times 1/4 equals 3/2.
M06.10.2-F5

Wrong beside right. Adding the variances treats the two counts as independent and predicts the peaked PMF on the left. The real sum spreads further, because both counts rise with the shared flip.

“Variances add.”

Only when the covariance is 0, for example for independent variables. For the course’s table \({\operatorname{Var}(X) + \operatorname{Var}(Y) = 1}\), but \({\operatorname{Var}(X + Y) = 3/2}\). In a sum of measurements that share a source of error, such as readings from one badly calibrated instrument, the shared part does not average away.

“Cov(2X, 2Y) = 2 Cov(X, Y).”

The rule applies in each slot: \({\operatorname{Cov}(2X, 2Y)}\) \({= 2 \cdot 2 \operatorname{Cov}(X, Y)}\) \({= 4\operatorname{Cov}(X, Y)}\). Doubling both variables doubles both sides of every rectangle, so each area grows four times, just as \({\operatorname{Var}(2X) = 4\operatorname{Var}(X)}\).

“Var(X − Y) = Var(X) − Var(Y).”

The variances still add; only the covariance term changes sign: \({\operatorname{Var}(X - Y)}\) \({= \operatorname{Var}(X) + \operatorname{Var}(Y)}\) \({- 2\operatorname{Cov}(X, Y)}\). For the course’s table that is \({1/2}\), not 0. A positive covariance makes a difference less variable, which is why comparing two models on the same test examples (a paired comparison) gives a steadier verdict than comparing them on separate examples.

Check yourself

Recall

1. What is \({\operatorname{Cov}(aX + b, Y)}\)?

Show answer

\({a\operatorname{Cov}(X, Y)}\). The shift \(b\) cancels from the deviations; the stretch \(a\) scales them.

2. What is \({\operatorname{Cov}(X + W, Y)}\)?

Show answer

\({\operatorname{Cov}(X, Y) + \operatorname{Cov}(W, Y)}\).

3. State the variance of a sum for any \(X\) and \(Y\).

Show answer

\({\operatorname{Var}(X + Y)}\) \({= \operatorname{Var}(X) + \operatorname{Var}(Y)}\) \({+ 2\operatorname{Cov}(X, Y)}\).

4. For the course’s table, why is \({\operatorname{Cov}(X, Y) = 1/4}\)?

Show answer

\({X = H_1 + H_2}\) and \({Y = H_2 + H_3}\); expanding, only \({\operatorname{Cov}(H_2, H_2)}\) \({= \operatorname{Var}(H_2) = 1/4}\) survives, because different flips are independent.

5. Two predictors’ errors each have variance \({\sigma^2}\) and covariance \(C\). What is the variance of the error of their average?

Show answer

\({(\sigma^2 + C)/2}\).

Exercises

1. ★ \({\operatorname{Var}(X) = 4}\), \({\operatorname{Var}(Y) = 9}\) and \({\operatorname{Cov}(X, Y) = -2}\). Find \({\operatorname{Var}(X + Y)}\), \({\operatorname{Var}(X - Y)}\) and \({\operatorname{Var}(2X - Y)}\).

Show solution

\({\operatorname{Var}(X + Y)}\) \({= 4 + 9 + 2(-2)}\) \({= 9}\). \({\operatorname{Var}(X - Y)}\) \({= 4 + 9 - 2(-2)}\) \({= 17}\). With \({a = 2}\), \({b = -1}\):

\[ \begin{aligned} &\operatorname{Var}(2X - Y) \\ &\quad= 4 \cdot 4 + 1 \cdot 9 \\ &\qquad + 2 \cdot 2 \cdot (-1) \cdot (-2) \\ &\quad= 16 + 9 + 8 = 33 . \end{aligned} \]

2. ★★ For the course’s table, find \({\operatorname{Cov}(X, X + Y)}\) and \({\operatorname{Cov}(X + Y, X - Y)}\).

Show solution

\({\operatorname{Cov}(X, X + Y)}\) \({= \operatorname{Var}(X) + \operatorname{Cov}(X, Y)}\) \({= 1/2 + 1/4}\) \({= 3/4}\). For the second, expand both slots:

\[ \begin{aligned} &\operatorname{Cov}(X + Y, X - Y) \\ &\quad= \operatorname{Var}(X) - \operatorname{Cov}(X, Y) \\ &\qquad + \operatorname{Cov}(Y, X) - \operatorname{Var}(Y) \\ &\quad= \tfrac12 - \tfrac14 + \tfrac14 - \tfrac12 = 0 . \end{aligned} \]

The sum and the difference of two variables with equal variances always have covariance 0.

3. ★★★ An ensemble averages \(n\) predictors. Each error has variance \({\sigma^2}\) and every pair of errors has covariance \(C\). Show that the averaged error has variance \({C + (\sigma^2 - C)/n}\), and evaluate it for \({\sigma^2 = 4}\), \({C = 3}\), \({n = 10}\).

Show solution

Expand the covariance of the sum with itself: \(n\) variances, one for each predictor, and a covariance for each ordered pair \({i \ne j}\), of which there are \({n(n - 1)}\):

\[ \begin{aligned} &\operatorname{Var}\Big(\sum_i E_i\Big) \\ &\quad= n\sigma^2 + n(n - 1)C . \end{aligned} \]

Dividing the sum by \(n\) divides the variance by \(n^2\):

\[ \begin{aligned} &\frac{n\sigma^2 + n(n - 1)C}{n^2} \\ &\quad= \frac{\sigma^2}{n} + C - \frac{C}{n} \\ &\quad= C + \frac{\sigma^2 - C}{n} . \end{aligned} \]

For \({\sigma^2 = 4}\), \({C = 3}\), \({n = 10}\): \({3 + 1/10 = 3.1}\). However many members are added, the variance never falls below the shared part \(C\).

Summary card

The variance of a sum is two variances plus twice the covariance.

The anchor figure again: a square of side a plus b cut into two grey squares and two green rectangles, beside two stacked bars: Var of X plus Var of Y, total 1, if independent, and the same plus 2 Cov, total 3/2, for the course's table.
M06.10.2-F1

Two squares, two rectangles.

  • \({\operatorname{Cov}(aX + b, Y)}\) \({= a\operatorname{Cov}(X, Y)}\); covariance is linear in each slot.
  • \({\operatorname{Var}(X \pm Y)}\) \({= \operatorname{Var}(X) + \operatorname{Var}(Y)}\) \({\pm 2\operatorname{Cov}(X, Y)}\).
  • Course’s table: Cov is \({\operatorname{Var}(H_2) = 1/4}\); \({\operatorname{Var}(X + Y) = 3/2}\).
  • Covariance matrix: variances on the diagonal, covariances off it.
  • Average of two predictors: \({(\sigma^2 + C)/2}\).

Sources and next steps

Sources. Each was opened and checked against this lesson on 14 November 2026.

  • Hossein Pishro-Nik, Covariance and Correlation, Section 5.3.1 of Introduction to Probability, Statistics, and Random Processes: Lemma 5.3 (symmetry, \({\operatorname{Cov}(aX, Y) = a\operatorname{Cov}(X, Y)}\), adding a constant changes nothing, additivity in each argument, and the double-sum form for linear combinations) and Equation 5.21 for \({\operatorname{Var}(aX + bY)}\).
  • Jeremy Orloff and Jonathan Bloom, Reading 7b: Covariance and Correlation, MIT OpenCourseWare 18.05, Spring 2022. Section 2.1 lists the properties, including \({\operatorname{Var}(X + Y)}\) \({= \operatorname{Var}(X) + \operatorname{Var}(Y)}\) \({+ 2\operatorname{Cov}(X, Y)}\); Example 1 in Section 2.3 redoes the three-flip covariance with \({X = X_1 + X_2}\) and \({Y = X_2 + X_3}\), where only \({\operatorname{Cov}(X_2, X_2) = 1/4}\) survives; Section 4.1 proves the properties.
  • NumPy, numpy.cov: two 1-D inputs give the 2 by 2 covariance matrix, variances on the diagonal.

Next. M06.10.3 Correlation: covariance without units divides the covariance by the two standard deviations, proves that the result lies between −1 and 1, and finds it inside the best straight line.

This lesson unlocks

M06.10.3 Correlation: covariance without units M03.6 Low-rank approximation and PCA M07.3 The multivariate Gaussian (planned) ML02.2 Bagging and random forests

Your progress is saved in this browser only. No account, no tracking.
Back to top