4.9.12 · D4Probability Theory & Statistics

Exercises — Covariance and correlation

1,872 words9 min readBack to topic

Before we start, one shared reminder of the two engines we will use over and over:


Level 1 — Recognition

Goal: recognise which quantity a question asks for, and read signs.

L1.1 — Sign of covariance from a picture

The scatter of points in the figure below trends downward (as grows, falls). Without any arithmetic, state the sign of and of .

Figure — Covariance and correlation
Recall Solution

What the picture shows: when is above its mean (right of the vertical dashed line) the points sit below their mean (below the horizontal dashed line), and vice-versa. So one variable being high pairs with the other being low. Deviation product: and have opposite signs for most points, so their product is negative. Averaging negatives gives a negative average. Answer: , and since is divided by the two positive spreads , it keeps the sign: .

L1.2 — Which formula?

You are told , , . Which listed formula gives , and what is its value?

Recall Solution

Recognise: we have means and the mean of the product — that is exactly the working formula . Compute: . Answer: .

L1.3 — Covariance of a variable with itself

Simplify in one word.

Recall Solution

Set in the definition: . Answer: it is the variance of . (Covariance generalises variance — see Variance and Standard Deviation.)


Level 2 — Application

Goal: run the full arithmetic pipeline on real numbers.

L2.1 — Discrete joint pmf

A fair setup gives the joint pmf Find and .

Recall Solution

Marginals (sum over the other variable): , so . By symmetry . : only the corner has ; all other corners have . So . Covariance: . Positive ⇒ mild agreement. Variances: is Bernoulli, so , giving ; likewise . Correlation: . Answer: , .

L2.2 — Sample data

Data : . Compute the sample correlation .

Recall Solution

Means: , . Deviation products : . . . Why these sums? Sample — the same idea, but on data (the factors cancel top and bottom). Answer: . Strong positive.

L2.3 — Variance of a sum

Given , , , find and .

Recall Solution

Tool (property 3): . Sum: . Difference: . Answer: , .


Level 3 — Analysis

Goal: reason about behaviour, not just crank numbers.

L3.1 — Rescaling attack

, , . Now define (change units, e.g. kg→g). Find the new covariance and the new correlation . What does the comparison teach?

Recall Solution

Bilinearity (property 2): . New spread of : . New correlation: . Original correlation: . Insight: covariance exploded (from to ) but correlation is identical (). Rescaling changes units, never the true strength — exactly why we prefer . Answer: , .

L3.2 — Zero covariance, full dependence

Let take values each with probability , and set . Show yet are not independent.

Recall Solution

Means: (symmetric about ). : , values . Average . Covariance: . But dependent: knowing forces ; knowing tells you . So — they share information. Why covariance misses it: covariance only detects the linear part of a relationship (see Independence of Random Variables). Here the link is symmetric, so its "up-slope" and "down-slope" halves cancel. Answer: , yet not independent. ∎

L3.3 — Reading the equality case

Suppose exactly (a deterministic line). Predict before computing, then verify with the tools.

Recall Solution

Prediction: is a perfect increasing linear function of , so the Cauchy–Schwarz equality case gives . Verify: (shift drops out). Spread: . Then . (If the slope were negative, say , the same steps give .) Answer: .


Level 4 — Synthesis

Goal: chain multiple properties into one argument.

L4.1 — Correlation of a sum with a part

and are independent with . Define . Find .

Recall Solution

Covariance: by bilinearity. Independence ⇒ , and . So . Spread of : , so . Correlation: . Answer: . (A part is correlated with its noisy total, but never perfectly, because dilutes it.)

For the data of L2.2, the least-squares line predicting from has slope in sample form, i.e. . Compute the slope , the intercept , and confirm equals the fraction of -variance the line explains.

Recall Solution

From L2.2: , , , , . Slope: . Intercept: . Goodness of fit: . Meaning: about of the up-and-down spread in is explained by the straight-line dependence on (see Linear Regression). Answer: , , .

L4.3 — Building a covariance matrix

For the random vector you found in L2.1 (, ), write the Covariance Matrix and check it is symmetric with the variances on the diagonal.

Recall Solution

Definition: . Fill in: Checks: diagonal holds the variances ; off-diagonal entries are equal () because (symmetry). ✓ Answer: the matrix above.


Level 5 — Mastery

Goal: prove a general fact, no numbers to lean on.

L5.1 — Prove is scale-invariant with a sign flip

Show that for constants and any shifts :

Recall Solution

Numerator (bilinearity, property 2): shifts vanish, scales pull out: Denominator (spreads): , and likewise . Assemble: Reading it: stretching either axis keeps the strength fixed; flipping an axis ( or ) flips the sign. This is why correlation is the honest, unit-free strength score. ∎

L5.2 — Prove the Cauchy–Schwarz bound from scratch

Using only for all real , prove , and state precisely when equality holds.

Recall Solution

Set-up: let , , so , , . A square is never negative: for every real , Read it as a quadratic in : it is , opening upward and never dipping below . A quadratic that stays has discriminant : Translate back: , hence . Equality: the discriminant is exactly when has a real double root , i.e. , meaning with probability — that is, is an exact multiple of . Geometrically is a perfect linear function of , which is the case. ∎ (See Cauchy–Schwarz Inequality.)


Connections