Know these first
- M-A08: Summation notation
- M-C10: Covariance and correlation
By the end you will be able to
- 1Write a list of numbers as a vector, and read its size and entries.
- 2Add vectors, multiply them by a number, and take the dot product of two vectors.
- 3Read a matrix: its size, the entry aᵢⱼ, its transpose, and whether it is symmetric.
- 4Read a covariance matrix: variances on the diagonal, covariances off it, and why it is symmetric.
Why you need it
With two quantities you can write every formula out by hand. With twenty you cannot. Vectors and matrices let you write one short formula that works for any number of them.
This Core Path lesson uses them:
L3.1.06: Many assets and the covariance matrix
With many assets, the weights become one vector and all the variances and covariances one matrix.
You need M-A08: Summation notation for the dot product and M-C10: Covariance and correlation for the covariance matrix. This is the first atom of the linear algebra block; M-E02: Matrix multiplication and quadratic forms builds directly on it.
The idea
A list with a direction
A vector is a list of numbers kept in order. The list (3, 2) can be read as an instruction: go 3 across and 2 up. Drawn from the origin, that is an arrow. Drag its tip and watch the two entries change.
A list is an arrow
Drag the tipA list of three numbers is an arrow in three dimensions. A list of fifty is an arrow you cannot draw, but you handle it with exactly the same rules. Stack several such lists side by side and you get a table: a matrix.
The rules
Vectors. Notation first: what the bold letter, the subscripts and the small T mean.
Adding, scaling and the dot product. Adding and scaling work entry by entry. The dot product turns two vectors into a single scalar.
Matrices. Rows first, then columns: for the size, and for the address of each entry.
Try it on a 3 × 4 matrix. Click an entry, then switch to the transpose.
Read an entry
Click a numberShow
a23 = 1: row 2 (shaded across), column 3 (shaded down).
In the transpose this number sits at row 3, column 2: (Aᵀ)₃₂ = a₂₃.
A link you already know
Subtract the mean from two lists of data and the dot product of what is left, divided by n − 1, is their sample covariance from M-C10: Covariance and correlation. Their correlation is the dot product divided by both lengths: the cosine of the angle between the two arrows. Arrows at right angles are uncorrelated.
The rules, for reference
Try it
Set two arrows u and v. Add them tip to tail, subtract, scale u, or take the dot product. Turn v until the dot product is zero: what angle do you see?
Worked examples
1. Arithmetic with two vectors
Step 1 of 4- 1
The set-up
2. Reading a matrix
Step 1 of 4- 1
The set-up
3. Three funds as vectors and a matrix
Step 1 of 4- 1
The set-up
A portfolio holds three funds, A, B and C (illustrative). Its weights and the funds' expected annual returns are two vectors:
Common mistakes
Each line below is a tempting slip. Spot what is wrong, then check.
Reaction
Check what stuck
Question 1 · objective 2
Work out the dot product (1, 2, 3) · (4, −1, 2).
Question 2 · objective 3
B is a 2 × 5 matrix. What size is its transpose Bᵀ?
Question 3 · objective 3
M has first row 7, −2, 5 and second row 0, 4, 9. What is the entry m₂₃?
Question 4 · objective 2
What is the length of the vector (6, 8)?
Question 5 · objective 4
Four quantities have a covariance matrix Σ. Which statement is true?
Glossary
- Vector
- An ordered list of numbers treated as one object, written in bold, such as x. With two entries it can be drawn as an arrow.
- Entry
- One of the numbers in a vector or matrix. Its position is given by a subscript: x₂, or a₂₃ for row 2, column 3.
- Scalar
- A single ordinary number, as opposed to a vector or matrix.
- Dot product
- u · v = u₁v₁ + u₂v₂ + … + uₙvₙ: multiply matching entries and add. The result is one number.
- Matrix
- A rectangular table of numbers, written with a capital letter. An m × n matrix has m rows and n columns.
- Transpose
- The matrix (or vector) with rows turned into columns, written Aᵀ. Entry (i, j) of Aᵀ is entry (j, i) of A.
- Symmetric matrix
- A square matrix equal to its own transpose: aᵢⱼ = aⱼᵢ for every i and j, a mirror image across the main diagonal.
- Main diagonal
- The entries a₁₁, a₂₂, … running from the top left to the bottom right of a square matrix.
- Identity matrix
- The square matrix I with 1 on the main diagonal and 0 everywhere else.