Mathematics · live now

Sums, covariance and correlation

Combine random variables. Find the variance of a sum of independent random variables and of an average, then measure how two random variables move together with covariance, see why uncorrelated random variables need not be independent, find the variance of any sum, and finish with correlation, which measures the strength of the relationship whatever the units.

No account needed to read a lesson · 30-day money-back guarantee

See the full learning path

4

lessons

47

practice questions

78

prerequisite lessons

See it taught

1 of the 4 lessons here is free to preview - the whole explanation and worked example, with no account and no email.

Live, not a screenshot

Lesson 03 · Covariance

0
1
2
3
0
1
2
3
x
y
Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 1: The joint PMF

Over a three-day weekend, X is the number of hot days and Y is the number of days a family goes to the beach.

Each dot is a pair of values (x,y), with area proportional to its probability p(x,y).

Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 2: The means

The dashed lines mark the means, μX=1.65 and μY=1.65. Each term of the sum measures a pair from these lines.

Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 3: A positive term

The pair (3,3) lies to the right of μX and above μY, so both deviations are positive:

(3−1.65)(3−1.65)(0.25)=(1.35)(1.35)(0.25)≈0.46

A positive times a positive is positive, so this term adds to the covariance.

Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 4: A negative term

The pair (1,2) lies to the left of μX but above μY, so its deviations have opposite signs:

(1−1.65)(2−1.65)(0.05)=(−0.65)(0.35)(0.05)≈−0.01

A negative times a positive is negative, so this term takes away from the covariance.

Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 5: All the terms

Every pair to the right of and above both means, or to the left of and below both, gives a positive term. The other two regions give negative terms.

Weekends with more hot days tend to have more beach days, so the large terms are positive. The positive terms add to about 1.10 and the negative terms to about −0.02, so Cov(X,Y)≈1.08>0.

Cov(X,Y)= ∑(x,y) (x−μX)(y−μY) p(x,y)

Step 6: A negative covariance

Now let Y be the number of days the family stays indoors instead. Each day they do one or the other, so every dot moves from y to 3−y, and μY=1.35.

Each deviation y−μY changes sign, so every term keeps its size and changes sign. The negative terms now add to about −1.10 and the positive terms to about 0.02, so Cov(X,Y)≈−1.08<0.

The diagram from the lesson itself, running live.

4 of 7 lessons

4 lessons you can take today, and 3 more being written. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.

01

Variance and standard deviation of a sum of independent random variables

13 questions

Learn how to find the variance and standard deviation of a sum, difference or scaled sum of independent random variables.

Covers

Adding variances

Differences and scaled sums

Standard deviation of a sum

02

The variance of an average

14 questions

Learn how to find the mean, variance and standard deviation of the average of independent and identically distributed random variables, and how its variance and standard deviation fall as more terms are averaged.

Covers

The average as a random variable

The variance of an average

The standard deviation of an average

03

Covariance

Preview

8 questions

Learn what the covariance of two random variables measures, how to judge its sign, and how to compute it from a joint PMF.

Covers

What covariance measures

Computing covariance from a joint table

Preview this lesson - no account needed

04

Properties of covariance

12 questions

Learn how scaling, shifting and adding random variables change their covariance, and how to expand the covariance of two weighted sums term by term.

Covers

Scaling and shifting

The covariance of a sum

The covariance of two sums

—

Uncorrelated is not independent

In drafting

—

The variance of a sum in general

In drafting

—

Correlation

In drafting

Where this unit sits in the curriculum

This unit is part of our Essential Probability & Statistics for ML learning path, which contains 205 lessons. Every one of them is drawn below.

The diagnostic test lets you skip any lesson you already know, including the ones in this unit.

Every dot is a lesson and every line a prerequisite. The 4 red dots are the lessons in Sums, covariance and correlation; the 78 blue dots feeding into them are the lessons Sums, covariance and correlation depends on; the 123 pale dots are the rest of the learning path, which come after Sums, covariance and correlation or alongside it.Sums, covariance and correlationFirst lessons on the left205 lessons

Hover any dot to name its lesson.

4 lessons in this unit

78 prerequisite lessons across the unit, counting every step back to the start

123 other lessons in the learning path - after this unit, or alongside it

Every dot is a lesson, every line a prerequisite. You can only start a lesson once you have mastered all of its prerequisites, so you are always building on solid foundations.

Start Sums, covariance and correlation

One subscription covers every learning path, and you can test out of anything you already know.

One subscription covers every learning path · 30-day money-back guarantee

More in Probability and Statistics: Sample spaces and events, Counting, Probability fundamentals, Conditional probability and independence, Bayes' theorem and evidence, Discrete random variables, Expectation and variance, Named discrete distributions, Multiple discrete random variables, Continuous random variables