Intuition The one core idea
Correlation and multicollinearity are both about overlap : when two columns of numbers rise and fall together, they carry the same information twice . This whole topic is a toolkit for measuring that overlap so we can spot — and remove — redundant features before they make a model unstable.
Before we can measure overlap, we need to be fluent in every symbol the parent note throws at us. This page builds each one from nothing, in an order where every symbol is earned before it is used. Nothing here assumes you have seen statistics before.
Common mistake A notation warning before we start
One letter, X , is traditionally used for two different things : a single feature column, and the whole table of features stacked side by side. To avoid confusion, this page uses the bold capital X only for the whole table (the "design matrix", Section 6) and the plain capital X for a single feature column everywhere else. Watch for the bold.
Everything starts with a table of numbers . Each row is one sample (one house, one patient, one photo). Each column is one feature — one measured quantity, like square footage.
Definition Feature and its notation
A feature is a single column of measurements. We call it X (a plain capital letter).
The individual numbers inside it are x 1 , x 2 , … , x n (small letters with a counter).
n = the number of samples (how many rows).
x i = the value of the feature in row number i .
Look at the figure: the column of blue dots is the feature X . Each dot is one x i . The subscript i is just a pointer that says "which row" — x 3 means "the value in row 3". We need this pointer because every formula in the topic is a recipe applied to every row and then summed up.
Mnemonic Capital vs small
Plain capital X = one whole column (one feature). small x i = one number inside it. Bold X = the entire table (comes later).
Before we can talk about "above average" or "below average", we need the average itself.
Definition Mean (average)
The mean of feature X , written x ˉ (read "x-bar"), is the sum of all its values divided by how many there are:
x ˉ = n 1 ∑ i = 1 n x i
The symbol ∑ (Greek capital sigma) is just shorthand for "add these up" . The bits around it are instructions:
Definition The summation symbol
∑
∑ i = 1 n ( something with i )
reads: "start the counter i at 1 , plug it into the expression, go up one at a time until i = n , and add all the results together ."
In the figure, x ˉ is the horizontal line where the column would balance like a see-saw. Why the topic needs it: every measure of relationship asks "is this point above or below its own average?" — so the average is the reference line we measure from .
This single quantity carries the sign that everything downstream depends on:
x i − x ˉ > 0 → the sample is above average.
x i − x ˉ < 0 → the sample is below average.
x i − x ˉ = 0 → the sample sits exactly on the average line.
Why the topic needs it: correlation is built from pairs of deviations. When we ask "do X and Y move together?", we really ask "when X is above its line, is Y also above its line?" — that is a statement about the signs of two deviations.
We now measure how spread out a feature is.
Intuition Why square the deviations?
If we averaged the raw deviations ( x i − x ˉ ) , the positives and negatives would cancel and always give zero (that is what "balance point" means!). Squaring makes every term positive, so nothing cancels — big spreads produce big variance. Squaring (rather than taking absolute values) is chosen because it makes the algebra — and the Cauchy–Schwarz bound later — clean.
Definition Standard deviation
σ X
The standard deviation is the square root of variance:
σ X = σ X 2 = n 1 ∑ i = 1 n ( x i − x ˉ ) 2
Squaring inflated the units (sqft became sqft²); the square root brings us back to the original units. Think of σ X as the feature's typical distance from its mean — its "room to vary".
The symbol σ is Greek small sigma. Why the topic needs it: correlation divides by σ X σ Y to cancel units. Without σ , correlation would depend on whether you measured area in sqft or m², which would be nonsense.
1/ n ) vs sample (1/ ( n − 1 ) )
This page divides by n — the population formula, which treats your data as the whole world . In practice you will often see n − 1 1 instead — the sample formula, which treats your data as a sample drawn from a bigger world and corrects a slight underestimate. For correlation r it does not matter which you use : the same factor (n or n − 1 ) sits in the top and the bottom of the fraction and cancels. So we keep the simpler n 1 throughout.
Common mistake Zero-variance features break the formula
If a feature never changes (all x i equal), then σ X = 0 . Any measure that later divides by σ X — such as the correlation coefficient built in Section 5, or standardization σ X x i − x ˉ — then tries to divide by zero , so the result is undefined , not "no relationship". Always drop constant columns before computing correlations.
Now we bring in a second feature Y (its values y i , mean y ˉ ).
Cov ( X , Y ) = n 1 ∑ i = 1 n ( x i − x ˉ ) ( y i − y ˉ )
It multiplies the two deviations for the same row and averages the products.
Read the figure quadrant by quadrant (the crossing lines are x ˉ vertical, y ˉ horizontal):
Top-right (both above average): ( + ) ( + ) = + → pushes covariance up.
Bottom-left (both below average): ( − ) ( − ) = + → also pushes up.
Top-left / bottom-right (one above, one below): ( + ) ( − ) = − → pulls covariance down.
So covariance is positive when points cluster on the diagonal (move together), negative when they cluster on the anti-diagonal (move oppositely), and near zero when they scatter into all four quadrants equally.
E [ ⋅ ]
The parent note also writes covariance as E [( X − μ X ) ( Y − μ Y )] . Here E [ ⋅ ] means expected value — the theoretical long-run average — and μ X is the true mean. For a finite dataset, E [ ⋅ ] is just "n 1 ∑ " and μ X is just x ˉ . Same idea, cleaner symbol.
Why the topic needs covariance: it is the raw "co-movement" number. But its size depends on units, so we normalise it next. Stacking every pairwise covariance into a grid gives the covariance matrix, which we notate and connect to X T X in Section 6.
r = + 1 : perfect straight line sloping up.
r = − 1 : perfect straight line sloping down.
r = 0 : no linear pattern (points may still form a curve!).
r = 0 does not mean "unrelated"
Correlation only sees straight-line relationships. A perfect U-shape (parabola) can have r = 0 while being fully predictable. Never read r = 0 as "independent".
The reason the value can never escape [ − 1 , 1 ] is the Cauchy–Schwarz inequality , which guarantees ∣ Cov ( X , Y ) ∣ ≤ σ X σ Y . You do not need to prove it here — just know it is the mathematical fence that bounds r .
The multicollinearity half of the topic lives inside linear regression. First, one indexing convention we will lean on throughout this section.
Definition The feature index
j and the count p
When there are several features, we number the columns with j , running j = 1 , 2 , … , p , where p = the number of features (columns). So X j means "the j -th feature column", and X 1 , X 2 , … , X p are all the columns. (Keep i and j separate: i counts rows/samples up to n ; j counts columns/features up to p .)
β j and its estimate β ^ j
β j (Greek beta) is the true weight the model gives feature X j — the real amount the prediction changes per unit of X j . The subscript j ties each weight to its own feature column (j = 1 , … , p ).
β ^ j (beta with a hat) is our estimate of it computed from data. The hat always means "our best guess of", not the true value.
Definition The target vector
y
y is the thing we are trying to predict — one number per row (e.g. the house price). It is a column with entries y 1 , y 2 , … , y n , exactly like a feature but held apart because it is the answer , not an input. Regression hunts for the weights β ^ that make the features best reproduce y .
R j 2 — how predictable a feature is
R j 2 is the coefficient of determination when we regress feature X j on all the other features (j still runs 1 , … , p ). It is defined as
R j 2 = 1 − S S tot S S res = 1 − ∑ i = 1 n ( x ij − x ˉ j ) 2 ∑ i = 1 n ( x ij − x ^ ij ) 2
where x ij is the value of feature j in row i , x ^ ij is the value the other features predict for it, x ˉ j is feature j 's mean, S S res is the residual sum of squares (leftover error) and S S tot is the total sum of squares (original spread). It answers: "what fraction (0 to 1) of X j 's spread can the other columns already explain?"
R j 2 = 0 : the others explain nothing → X j is independent of them.
R j 2 → 1 : the others explain everything → X j is almost a copy → multicollinearity.
This feeds the Variance Inflation Factor : VIF j = 1 − R j 2 1 . As R j 2 → 1 , the denominator → 0 and VIF → ∞ .
Definition The design matrix
X , its transpose X T , and the covariance matrix Σ
When we stack every feature column side by side we get the design matrix X (bold , meaning the whole table of n rows and p columns, not one column). The symbol X T is its transpose — the table tipped on its side so that rows become columns and columns become rows (see figure below). The product X T X is a small p × p grid whose entry in row j , column k is the dot-product of columns j and k . If the columns are first mean-centred (each x ˉ j subtracted), then dividing that grid by n gives exactly the covariance matrix Σ (Greek capital sigma):
Σ = n 1 X T X (columns mean-centred) , Σ j k = Cov ( X j , X k ) .
So X T X is the covariance matrix up to the scale factor n — the grid of all pairwise covariances from Section 4. See Covariance Matrix .
Definition Condition number
κ ( X )
The condition number measures how close X T X is to being non-invertible (which is what breaks regression under collinearity). It is the ratio of the largest to the smallest singular value of X (a singular value is a non-negative number measuring how much X stretches space along one direction):
κ ( X ) = σ m i n ( X ) σ m a x ( X ) = λ m i n ( X T X ) λ m a x ( X T X ) ,
where λ m a x , λ m i n are the largest/smallest eigenvalues of X T X (the square root appears because X T X squares the singular values). A large κ means at least one direction is almost flat — collinear columns. The full treatment lives in Condition Number .
In the figure, the transpose simply flips the table across its diagonal: the entry in row a , column b of X lands in row b , column a of X T . Nothing is invented or lost — the numbers are just relabelled by position.
variance and std dev sigma
Multicollinearity topic 2.1.15
Each arrow means "you must understand the tail before the head makes sense." Correlation needs both variance and covariance; multicollinearity needs correlation plus the matrix picture.
Test yourself — reveal only after answering out loud.
What does the subscript i in x i point to? The row number — which sample the value comes from.
What does the summation symbol ∑ i = 1 n tell you to do? Add up the expression for every row from i = 1 to i = n .
Why do we compute x i − x ˉ before anything else? It tells us, with a sign, whether a sample is above (+ ) or below (− ) its own average — the raw ingredient of co-movement.
Why do we square deviations to get variance? Raw deviations always sum to zero (they cancel); squaring makes them all positive so spread is measured, not cancelled.
Does it matter whether variance uses 1/ n or 1/ ( n − 1 ) when computing correlation r ? No — the factor appears in top and bottom of the fraction and cancels; it only changes the raw variance/covariance numbers.
What happens to correlation if a feature has zero variance? It is undefined — you would divide by σ X = 0 ; drop constant columns first.
What does σ X represent in a picture? The typical distance of the points from the mean line — the feature's "room to vary".
When is Cov ( X , Y ) positive? When the two features tend to be above/below their means together (points cluster on the rising diagonal).
Why divide covariance by σ X σ Y to get r ? To cancel units and bound the result to [ − 1 , 1 ] , making feature pairs comparable.
Does r = 0 mean the features are unrelated? No — it only means no straight-line relationship; a curved relationship can still give r = 0 .
What is the difference between the indices i and j ? i counts rows/samples (up to n ); j counts columns/features (up to p ).
What does the hat in β ^ j mean? "Our data-based estimate of", as opposed to the unknown true value β j .
What is the target vector y ? The column of answers we are trying to predict — one number per row.
What is the formula for R j 2 and what does it measure? R j 2 = 1 − S S res / S S tot ; the fraction of feature X j 's spread the other features can explain (0 = independent, near 1 = redundant).
How does X T X relate to the covariance matrix Σ ? With mean-centred columns, Σ = n 1 X T X — the same grid of pairwise covariances up to the factor n .
How is the condition number κ ( X ) computed? As
σ m a x / σ m i n , the ratio of largest to smallest singular value of
X (equivalently
λ m a x / λ m i n of
X T X ).
What does the plain X mean versus the bold X ? Plain X is a single feature column; bold X is the whole table (design matrix); X T is that table transposed.
See also: Feature Selection , Principal Component Analysis (PCA) , Ridge Regression , Lasso Regression , Linear Regression Assumptions , Variance-Bias Tradeoff , Condition Number , and the parent 2.1.15 Correlation analysis and multicollinearity (Hinglish) .