---
title: "Joint Distributions, Covariance and Independence"
description: "A joint distribution describes two variables together. Summing or integrating gives their marginals. With finite second moments, independence implies zero covariance, but zero covariance does not impl"
canonical: https://lightmysky.com/learn/mathematics/joint-distributions-covariance-and-independence-mt_YyTFTAqhSF
source: https://lightmysky.com/learn/mathematics/joint-distributions-covariance-and-independence-mt_YyTFTAqhSF.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Joint Distributions, Covariance and Independence

A joint distribution describes two variables together. Summing or integrating gives their marginals. With finite second moments, independence implies zero covariance, but zero covariance does not imply independence.

Subject: Mathematics · Area: Probability · Ages 19 to 20
Page: https://lightmysky.com/learn/mathematics/joint-distributions-covariance-and-independence-mt_YyTFTAqhSF

## Ready when they can

- Find marginal distributions from a joint table or density
- Compute a covariance and interpret its sign
- Test independence by factorisation and give dependent variables with zero covariance

## Lesson: Two variables moving together

A joint mass p(x,y) means P(X=x,Y=y). Find P(X=x) by adding over all y; find P(Y=y) by adding over all x. For an event such as Y>0, include every cell satisfying it. Take p(0,0)=0.4, p(0,2)=0.1, p(1,0)=0.2 and p(1,2)=0.3, with no other masses. Then P(X=1)=0.2+0.3=0.5 and P(Y=2)=0.1+0.3=0.4.

*(drawing: Each bar is one joint mass. To find P(X=1), add the two bars whose labels have X=1.)*

Discrete X and Y are independent when p(x,y)=P(X=x)P(Y=y) for every pair. One mismatch proves dependence. One matching cell does not prove independence in a general table. In our example, P(X=0)=0.5 and P(Y=0)=0.6. Their product is 0.3, but p(0,0)=0.4, so X and Y are dependent.

Assume X and Y have finite second moments. Cov(X,Y)=E[(X-E[X])(Y-E[Y])]=E[XY]-E[X]E[Y]. For a joint table, E[X]=Σx p(x,y), E[Y]=Σy p(x,y) and E[XY]=Σxy p(x,y), each summed over all cells. Find the probability-weighted product mean, then subtract the product of the two means.

**Example.** For our example, E[X]=0.5 and E[Y]=2(0.1+0.3)=0.8. Every product xy is zero except at (1,2). Thus E[XY]=1×2×0.3=0.6 and Cov(X,Y)=0.6-0.5×0.8=0.2.

Covariance is the average product of deviations from the means. A positive value means this weighted average is positive; a negative value means it is negative. Neither sign proves cause. Units affect size: Cov(aX,bY)=ab Cov(X,Y). With finite, positive variances, correlation divides covariance by SD(X)SD(Y). Its absolute value measures linear association on a unit-free scale.

With finite second moments, independence gives E[XY]=E[X]E[Y], hence zero covariance. The converse fails. Let X take -1, 0 and 1 equally and Y=X². Then E[X]=E[XY]=0, so covariance is zero. Yet p(0,0)=1/3 differs from P(X=0)P(Y=0)=1/9, proving dependence. A function of X can be constant and independent of X; the formula Y=g(X) alone does not prove dependence.

*(drawing: Each pair has probability 1/3. The XY values are -1, 0 and 1, so their weighted average is zero.)*

A joint density f(x,y) is nonnegative and has total integral 1. Find f_X(x)=∫f(x,y)dy over allowed y-values; find f_Y(y)=∫f(x,y)dx over allowed x-values. Each is zero outside its support. Hold the retained variable fixed and integrate term by term. For f=2x on 0≤x,y≤1, zero elsewhere, f_X(x)=∫₀¹2x dy=2x and f_Y(y)=∫₀¹2x dx=1 on [0,1].

Limits follow the support. Let f=1/2 on 0≤y≤x≤2 and zero elsewhere. At fixed y, y≤x≤2, so f_Y(y)=∫ᵧ²(1/2)dx=1-y/2 on [0,2]. Integrate this marginal over an interval: for 0≤a≤2, P(Y≤a)=∫₀ᵃ(1-y/2)dy=a-a²/4. A density value is not a point probability.

For a joint density, E[g(X,Y)]=∫∫g f dx dy over its support when ∫∫|g|f is finite. Use g=x, y and xy for covariance. For f=2x on the unit square, E[X]=∫₀¹2x² dx=2/3, E[Y]=1/2 and E[XY]=1/3, giving covariance 0. Independence of densities requires f=f_X f_Y almost everywhere, except on a set of area zero. Here (2x)(1)=f on the square, so X and Y are independent.

**Recap.** Sum or integrate out one variable to get a marginal. Covariance is E[XY]-E[X]E[Y]. With finite second moments, independence gives zero covariance, but zero covariance does not prove independence.

*Lesson, practice questions and flashcards written for this dataset.*

## Practice

13 questions on this page, each with its working shown.

## Needs first

- [Expectation and Variance by Integration](https://lightmysky.com/learn/mathematics/expectation-and-variance-by-integration-mt_kRSaKgp3bs)

## Optional connections

- [Correlation and the Product-Moment Coefficient](https://lightmysky.com/learn/mathematics/correlation-and-the-product-moment-coefficient-mt_Rs_Z0P7ELJ)
- [Double Integrals over General Regions](https://lightmysky.com/learn/mathematics/double-integrals-over-general-regions-mt_UKS9_AhAWw)

## Opens up

- [The Law of Large Numbers and the Central Limit Theorem](https://lightmysky.com/learn/mathematics/the-law-of-large-numbers-and-the-central-limit-theorem-mt_NknG3L5rQp)
- [Brownian motion and its defining properties](https://lightmysky.com/learn/mathematics/brownian-motion-and-its-defining-properties-mt_T5KtWIk07Z)
- [Concentration Bounds and a High-Probability Guarantee](https://lightmysky.com/learn/computing/concentration-bounds-and-a-high-probability-guarantee-mt_WIltjK12oW)
