Prerequisite toolkit
On this page 16 headings
Learning goal: Learn the notation needed for probability bounds and random projections.
- Review these foundations before starting the main lessons.
- Each idea includes an explanation and a small example.
0.1 Random variable, sample space, probability
- The ideaA random variable is a number whose value you only learn after an experiment.
- Roll a die: before rolling you don't know the number, after rolling you do.
- That number is a random variable, usually called X.
Sample space: all the values X can take.
For a die: {1, 2, 3, 4, 5, 6}.
Event: any set of outcomes you might ask about, such as "the roll is 5 or more" = {5, 6}.
The collection of all events you can ask about is the event space.
For a die it is every subset of {1,…,6}, called the power set (there are 2⁶ = 64 of them).
Probability: a number between 0 and 1 for each event.
For a fair die each face has probability 1/6, so .
- Non-negative random variable: one that can never be below 0, such as a distance, a count or a waiting time.
0.2 Expectation (the average) and linearity
The ideaThe expected value E[X] is the average you would get if you repeated the experiment a huge number of times and averaged the results.
Multiply each value by its probability and add up:
Worked example
- Fair die: .
- You can never roll 3.5, but over many rolls the average approaches 3.5.
- Linearity of expectation is used again and again in Lesson 8 and Lesson 9.
- For any random variables (independent or not) and fixed numbers :
In words: you can pull fixed numbers out of an expectation and split a sum into separate expectations.
0.3 Variance and standard deviation
- The ideaThe average alone does not tell the whole story.
- The class averages 50 % whether everyone scores 50 or half the class scores 0 and half scores 100.
- Variance measures how spread out the values are around the average.
σ (sigma) is the standard deviation, a "typical distance from the average" measured in the same units as X.
Worked example
- Fair die: .
- So , and .
Two facts used in Lesson 8:
- If , then , because the second term vanishes.
- , and for independent X, Y: .
0.4 Independence
- Two random variables are independent if knowing one tells you nothing about the other, like two separate coin tosses.
- The key consequence used in Lesson 8 and Lesson 9 is that the expectation of a product splits:
"i.i.d." means independent and identically distributed: separate draws from the same distribution.
0.5 The normal (Gaussian) distribution
- The ideaThe famous bell curve.
- Heights, measurement errors and many sums of small random effects follow it: most values sit near the middle, and values far away are rare.
- means "X is normal with mean μ and variance σ²".
- The standard normal is : mean 0, variance 1.
- Facts we need:
- About 68 % of values lie within 1σ of the mean, 95.4 % within 2σ, and 99.7 % within 3σ.
- If then , .
Sums of independent normals are normal. If are independent and are fixed numbers, then .
This is the engine of Lesson 8.
0.6 Vectors, dot product and length
- The ideaA data point with d features is a list of d numbers, which is a vector in .
- A house with (area, rooms, age) is a vector in .
- A word embedding with 10,000 numbers is a vector in .
Dot product: .
The result is a single number.
The notation ("r transpose u") means exactly this.
Length (norm): .
This is Pythagoras in d dimensions.
The squared length is .
The small 2 under the bars in just says "ordinary (Euclidean) length".
- Distance between two points x and y is the length of their difference: .
Two vectors are orthogonal (perpendicular) when their dot product is 0.
A set of vectors is orthonormal when every pair is orthogonal and each has length 1.
Worked example
- : , so .
- With and : , so and the distance is 5.
0.7 Matrices, matrix × vector, transpose, identity
- A k × d matrix R has k rows and d columns.
- Multiplying it by a vector gives a vector in .
- Entry i of the result is the dot product of row i with u:
- So a k × d matrix is a machine that turns d-dimensional vectors into k-dimensional vectors.
- If k < d, it reduces dimension.
- This matrix operation is called a linear transformation.
- Transpose : flip rows and columns, so a k × d matrix becomes d × k.
Identity matrix I: 1s on the diagonal, 0s elsewhere.
It leaves vectors unchanged: .
- Useful identity: .
Worked example
- (2 × 3), .
- Row 1 · u ; row 2 · u .
- So : three numbers went in, two came out.
0.8 Random vectors and the covariance matrix
- A random vector is a list of random variables.
- Its mean is the vector of means, and its spread is described by the covariance matrix, a k × k table:
- When the mean is zero, these become simply on the diagonal and off it.
- If the covariance matrix is the identity, every coordinate has variance 1 and no two coordinates move together.
- , the standard multivariate normal, means the k coordinates are independent standard normals.
- Its squared length has average k.
- This quantity is the hero of Lesson 9.
0.9 Estimators and maximum likelihood
- The ideaAn estimator is a recipe that turns observed data into a guess for an unknown number.
- It is unbiased if, averaged over many repetitions, the guess equals the true value exactly.
- The maximum likelihood estimate (MLE) is the guess that makes the observed data most probable.
- The case we need: you observe from , where the mean 0 is known but σ² is unknown.
- The MLE is
It is unbiased: .
Worked example
Observations 3, −5, 4, −2 from : .
For the curious: why this is the MLE
- The log-likelihood is .
- Setting the derivative with respect to σ² to zero gives , so .
0.10 Logs, e−x and big-O
grows very slowly.
and .
Doubling n adds only a constant to log n.
- shrinks very fast: , , .
Big-O: means "k is at most a fixed constant times ".
The constant is hidden, and the base of the log does not matter (it only changes that constant).
So big-O tells you how k grows, not its exact value.
- ε (epsilon) is a small positive number used for "allowed error", for example 0.1 = 10 %.
Key points to remember
- Expectation is an average; variance measures spread.
- Keep original dimension d, target dimension k, and number of points n distinct.
- Mean zero and identity covariance do not establish normality unless Gaussianity is also known.
