Linear Algebra Primer
A model often needs to work with many measurements at once. Vectors and matrices let us organise those numbers and repeat useful calculations without writing a separate rule for every example.
28 sections · 25 questions · 4 coding challenges
The arrow keys move between sections too.
How Do We Keep Track of Several Quantities at Once?
BOTIE
Systems of linear equations were studied long before modern computing. In his 1858 memoir, Arthur Cayley developed an algebra of matrices, starting from their use in representing linear transformations. Arranging the coefficients in a rectangle let mathematicians reason about a whole operation, rather than continually rewriting every individual equation.
That rectangle is a matrix. A list of quantities is a vector. Multiplying a matrix by a vector applies the recorded combinations to that list. Multiplying matrices lets us describe successive operations as one operation. Machine learning needs exactly this kind of bookkeeping when many measurements enter many calculations, so we will begin with small lists and pictures before working with a whole table.
Sources for this history
Several Measurements, One Calculation
A person may arrive as height, weight, and age; an image arrives as many pixels. A model needs to keep related numbers together without losing what each position means.
Linear algebra describes those arrangements and the operations connecting them. We will start with the objects before the notation.
Keep one observation together
Put a person's measurements in a fixed order. This ordered list is a vector. Exchanging height and age would change what it says, even though the same numbers remain.
Positions mean
- Height
- Weight
- Age
Values
- 170
- 68
- 30
The notation describes recognizable arrangements
A scalar is one value, a vector an ordered list, and a matrix a rectangular arrangement. Their dimensions tell us how many observations or coordinates an operation receives and returns.
We will build dot products and matrix multiplication from those objects, then use transformations and decompositions to describe structure in data.
1. Several Numbers as One Object
One observation usually contains several measurements. A person might be recorded as a height, a weight and an age, and those three numbers describe one example rather than three, so they should travel through a model together rather than separately.
(170, 72, 35)That grouping is a vector. Three things are true of it and worth fixing now. Each position has a defined meaning, so the first entry is the height and stays the height. The order cannot be shuffled, because shuffling it would silently change what every entry means. And the number of entries is called the dimension, so this is a three-dimensional vector.
It is tempting to define a vector as “a list of numbers” and stop, though a list is only how it is written down. The useful idea is that several related quantities have been packaged into one mathematical object, so that one symbol can stand for a whole observation and one operation can act on all of it at once.
A two-entry vector also has a picture, drawn as a point or an arrow on a pair of axes. We stay in two dimensions throughout this primer for exactly that reason, and the geometry is worth having because every operation we see there keeps working in dimensions nobody can draw.
2. Points and Movements
The pair (3, 4) can be read two ways, and both are used constantly.
Read as a location, it is a position in the plane, three across and four up from the origin. Read as a movement, it is a displacement, three across and four up from wherever you happen to be standing. The numbers are identical either way.
Keep in mind
These are not quite the same thing, and it is worth not saying that they are. A point is where something is. A vector is a direction and a distance, which is to say a movement, and it can be applied starting from anywhere.
Coordinates let both be written with the same pair of numbers, which is convenient and occasionally confusing. It matters later, when transformations move the plane around. A transformation acts on movements, and treating a location as a movement is what makes a translation behave unlike everything else in section 14.
Below is one arrow on its own. Drag the tip, and watch the two dashed walks change. The horizontal walk is the first entry and the vertical walk is the second, so moving the tip sideways changes one number and leaves the other alone.
Drag the tip and watch the two walks and the Pythagoras total remeasure.
3. Adding and Scaling Vectors
Two things can be done to vectors before anything is measured on them, and everything later is built out of the pair. They can be added, and they can be scaled.
Adding two vectors means doing one movement and then the other, and in coordinates it is as simple as it sounds. Add the matching entries.
(a₁, a₂) + (b₁, b₂) = (a₁ + b₁, a₂ + b₂)Worked example
Walk (3, 4), then walk (1, −2) from wherever that left you.
(3, 4) + (1, −2) = (3 + 1, 4 − 2) = (4, 2)Geometrically, put the tail of the second arrow at the tip of the first, and the sum is the arrow from the original start to the final tip. Doing them in the other order lands in the same place, which is worth noticing, since it means addition does not care which movement you make first.
Scaling means multiplying a vector by a single number, which stretches or shrinks it without changing the line it lies on.
c·(a₁, a₂) = (c·a₁, c·a₂)| multiplier | (3, 4) becomes | what happened |
|---|---|---|
| 2 | (6, 8) | twice as long, same direction |
| 0.5 | (1.5, 2) | half as long, same direction |
| 1 | (3, 4) | unchanged |
| −1 | (−3, −4) | same length, pointing the opposite way |
| 0 | (0, 0) | collapsed to a point |
These two operations are the whole of what makes the rest possible. Weighted combinations, matrix transformations, eigenvectors and the parameter update every model performs are all additions and scalings wearing different names.
4. Vector Length
Section 3 could stretch an arrow and could add two of them, and never once said how big an arrow is. A model needs that number constantly. How far a point sits from the origin, how big a parameter set is, and in the next section how far apart two examples are, are all the same measurement, and it is called the length.
A vector’s entries describe its movement along each axis separately. Its length is the direct distance from its start to its end, and that is a right triangle, so Pythagoras measures it. The triangle is right-angled because the horizontal walk and the vertical walk run along the two axes, which meet at a right angle, so the arrow itself is the hypotenuse.
Worked example
Take the arrow to (3, 4).
horizontal component 3
vertical component 4
length = √(3² + 4²) = √(9 + 16) = √25 = 5The box in section 2 is drawing exactly this triangle, and its length readout shows 5 on load.
Written generally, with the bars meaning length,
‖v‖ = √(v₁² + v₂²)Run the table from section 3 through it and the lengths behave the way the table said. Scaling by a number multiplies the length by the size of that number, and the sign is invisible to length, which is why the table could say same length, pointing the opposite way.
| vector | squares added | length |
|---|---|---|
| (6, 8) | 36 + 64 = 100 | 10, twice the 5 |
| (1.5, 2) | 2.25 + 4 = 6.25 | 2.5, half of it |
| (−3, −4) | 9 + 16 = 25 | 5, unchanged by the sign |
| (0, 0) | 0 + 0 = 0 | 0, the only vector with no length |
Three dimensions add another squared component under the root, and higher dimensions carry on the same way, one squared entry each. The picture stops being drawable long before the arithmetic stops working.
Worked example
Take the three-dimensional vector (2, 3, 6).
‖(2, 3, 6)‖ = √(2² + 3² + 6²) = √(4 + 9 + 36) = √49 = 7Nothing new was needed. The third entry is one more squared term under the root, and the result is still a single number saying how far the arrow reaches.
‖v‖ = √(v₁² + v₂² + … + vₙ²)5. Differences and Distance
Before measuring the distance between two points, it is worth being explicit about subtraction, because distance is built directly on it.
Take the points a = (1, 2) and b = (4, 6), and ask what movement carries a to b. Subtract the starting coordinates from the ending ones.
Worked example
b − a = (4 − 1, 6 − 2) = (3, 4)So the movement from a to b is three across and four up. Subtracting two positions produces the displacement between them, which is a vector even though both inputs were points.
Distance is then one more step. Find the difference, and measure its length.
distance(a, b) = ‖b − a‖Worked example
‖(4, 6) − (1, 2)‖ = ‖(3, 4)‖ = 5The same 5 as the last section, because it is the same arrow, moved so that its tail sits at the origin.
The box below has two arrows, a in indigo and b in amber. Drag either tip and watch the two lengths and the distance between the tips follow. The dot product readout is the subject of section 8.
Drag either arrow tip. Coordinates snap to halves.
…
Check yourself
Questions on Sections 1 to 5
Question 1 of 5
Shuffling the entries of a vector leaves it describing the same observation.
6. Distance in Machine Learning
Two of the models ahead run almost entirely on the previous section. An example, once its measurements are collected into a vector, is a point in a space with one axis per feature, and examples that resemble each other land near each other in it.
In a model
k-nearest neighbours answers a question about a new example by finding the stored examples closest to it, which is this distance computed once per stored row.
k-means groups examples by repeatedly comparing each one against a set of candidate centres and keeping the nearest, which is the same distance again with the centres standing in for the stored rows.
Keep in mind
Distance takes the features at face value, and it should not be trusted to until they are comparable. A difference of 1 in a column of dollars and a difference of 1 in a column of years are both written as 1, and the formula adds their squares as though they meant the same amount of dissimilarity.
They do not, and the consequence is that whichever column happens to carry the larger numbers dominates every distance in the dataset. Putting the columns on a common footing first is the fix, and it has a page of its own under data preparation.
7. Weighted Sums
Here is a calculation that appears inside almost every model, written out before it is given a name.
A prediction is rarely made from one measurement, and when it is made from several there is no reason every one of them should count equally. What is missing is a way to let each feature count by its own amount. The fix is one number per feature, called its weight, saying how strongly that feature should count.
Suppose a prediction uses two feature values and carries one weight for each.
Worked example
Features (3, 4), weights (4, 3).
3 × 4 = 12 first feature times its weight
4 × 3 = 12 second feature times its weight
────
24 added togetherEach feature is multiplied by its own weight, and the results are added. A larger weight makes its feature count for more, a weight of zero removes the feature from the prediction entirely, and a negative weight makes the feature push the other way.
The claims in that last sentence are easiest to believe by holding the features at (3, 4), keeping the first weight at 4, and changing only the second.
| weights | first term | second term | sum | what the second weight did |
|---|---|---|---|---|
| (4, 3) | 12 | 12 | 24 | counted the second feature three times over |
| (4, 1) | 12 | 4 | 16 | passed it through at its measured value |
| (4, 0) | 12 | 0 | 12 | removed it from the prediction |
| (4, −3) | 12 | −12 | 0 | pushed the other way, and cancelled the first exactly |
The features never changed. Everything the prediction did differently came from the weights, which is why the weights are what a model has to learn and the features are what it is given.
That is the shape of a linear model’s prediction, and with ten features it is ten multiplications and nine additions written out in a row. The next section is the notation that compresses it.
8. The Dot Product
The operation from the last section has a name. The dot product takes two vectors of the same length and produces a single number, by multiplying the entries position by position and adding.
a · b = a₁b₁ + a₂b₂Worked example
(3, 4) · (4, 3) = 3·4 + 4·3 = 12 + 12 = 24The same 24 as the weighted sum, because it is the same arithmetic, and the same 24 the a · b readout shows in the box above.
For any number of entries, written with a summation sign,
a · b = Σᵢ aᵢbᵢThe two vectors must have the same number of entries, and the reason is not a technicality. Every feature needs a weight of its own, so a feature with no matching weight would have nothing to multiply by and no way to contribute.
In a model
A linear model’s score for one example is one dot product plus an offset.
score = x · w + bWhen a later page writes a whole model in a single line, this is that line.
9. Direction, Magnitude, and Alignment
The dot product also has a geometric reading, and it needs stating carefully, because the loose version of it is misleading.
Hold both arrows at fixed lengths and swing one of them. The dot product is largest when they point the same way, falls as they open out, passes through exactly zero when they are perpendicular, and goes negative once they oppose each other. Try it in the box above by dragging b to (−4, 3), a quarter turn from a, and the readout shows 0.
| arrangement | dot product |
|---|---|
| pointing the same way | positive, and largest |
| at right angles | exactly zero |
| pointing opposite ways | negative |
Now change a length rather than an angle, and the value moves too. So the dot product is reporting two things at once, how aligned the arrows are and how long they are, and it does not separate them.
a · b = ‖a‖ · ‖b‖ · cos θKeep in mind
A large positive dot product does not, on its own, mean strong alignment. Two long arrows that only roughly agree can beat two short arrows that agree perfectly.
(10, 0) · (10, 10) = 100 lengths 10 and 14.14, cos θ = 0.71
(2, 0) · (2, 0) = 4 lengths 2 and 2, cos θ = 1.00The first pair scores twenty-five times higher while being less aligned. If alignment alone is what you want, divide the size back out, which gives the cosine and nothing else.
cos θ = (a · b) / (‖a‖ · ‖b‖)That quantity is cosine similarity, and the distance metrics page takes it up properly.
One consequence ties the sections together. Dot a vector with itself. It is perfectly aligned with itself, so the cosine is 1, and the recipe multiplies each entry by itself and adds, which is the squared-length calculation from section 4.
v · v = v₁² + v₂² = ‖v‖²For the vector (3, 4), its dot product with itself gives the squared length.
(3, 4) · (3, 4) = 3² + 4² = 9 + 16 = 25
length = √25 = 5The dot product therefore connects three ideas: length, distance and alignment.
Check yourself
Questions on Sections 6 to 9
Question 1 of 5
Because distance adds the squares of the differences in every column, whichever column happens to carry the larger numbers dominates every distance in the dataset.
10. Several Outputs at Once
A dot product takes a vector and produces one number. A layer of a network, or any transformation of one representation into another, needs several numbers out rather than one.
The fix is unglamorous. Give each output its own weight vector, and do one dot product per output. Suppose two outputs are wanted from two inputs.
o₁ = 2x + 1y
o₂ = 1x + 2yEach line is a weighted sum with its own pair of weights, (2, 1) for the first and (1, 2) for the second. Collect those pairs as rows, and the collection is a matrix.
A = ⎡ 2 1 ⎤
⎣ 1 2 ⎦So a matrix is not a new idea so much as a container. It packages several related weighted sums so they can be written, and performed, as one operation.
Rows rather than columns, because a row is what meets the input. Each row is read against the input vector exactly as section 8 read a weight vector against a feature vector, so writing the weights as rows keeps every one of the dot products visible on its own line.
In a model
A layer of a network is this picture with the rows given a name. Each neuron in the layer holds its own weight vector and answers one number for the row it reads, so a layer of three neurons answers three. Stack the neurons’ weight vectors as rows and the result is the layer’s matrix, which is the convention the next section writes down.
11. Reading Matrix Shapes
A matrix is a rectangle of numbers, described by how many rows and columns it has, in that order. The matrix above has two rows and two columns, so it is a 2 × 2.
The shape says what it accepts and what it returns, and the rule falls straight out of the last section. Each row is one output’s weight vector, so the number of rows is the number of outputs. Each row has one weight per input, so the number of columns is the number of inputs.
| object | shape | meaning |
|---|---|---|
| input vector | 2 | two input values |
| matrix | 2 × 2 | two outputs, each using two inputs |
| output vector | 2 | two calculated results |
That is the convention used throughout this site and on the neural network pages later, rows correspond to outputs and columns correspond to inputs. A 3 × 2 matrix would take a two-entry vector and return a three-entry one.
Worked example
Take a matrix with three rows, (1, 0), (0, 1) and (1, 1), each two entries long, and apply it to (3, 1).
⎡ 1 0 ⎤ (1, 0) · (3, 1) = 3
⎢ 0 1 ⎥ · (3, 1) (0, 1) · (3, 1) = 1
⎣ 1 1 ⎦ (1, 1) · (3, 1) = 4
result (3, 1, 4)Three rows, three outputs, and the input had to have exactly two entries because every row has exactly two weights to pair them with. A three-entry input would leave its third entry with no weight opposite it, which is section 8’s rule again. So the shape says what goes in and what comes out before a single multiplication is done, and the two counts need not agree, which is how a layer can take a representation of one width and hand on one of another.
12. Matrix-Vector Multiplication
Applying a matrix to a vector is the two dot products of section 10, carried out and stacked.
A = ⎡ 2 1 ⎤ A·(x, y) = (2x + 1y, 1x + 2y)
⎣ 1 2 ⎦Worked example
Apply A to the vector (3, 1).
first row (2, 1) · (3, 1) = 2·3 + 1·1 = 7
second row (1, 2) · (3, 1) = 1·3 + 2·1 = 5
A·(3, 1) = (7, 5)Each output came from one row, and each row’s contribution was a dot product with the input. That is the whole operation, and it is why the number of columns has to match the number of entries going in.
Written for any shape, the output’s entry i is row i dotted with the input, and the sum runs along the row, one term per column.
(A·v)ᵢ = Σⱼ Aᵢⱼ·vⱼTwo things fall out of that line. The output has one entry per row of A, so its dimension is the row count whatever the input’s was. And a matrix with a single row is just a weight vector, so the dot product of section 8 is the one-output case of this operation rather than a different operation.
In a model
A layer of a network does this to every example it is handed and then adds one offset per output, which is the plus b of section 8 carried once per row of the matrix.
outputs = A·x + bWhen a later page writes a whole layer in a single line, this is that line.
13. Basis Vectors and Matrix Columns
Two particular vectors are worth naming, because everything else is built from them. Call them the basis vectors.
e₁ = (1, 0) e₂ = (0, 1)One step east and one step north. They matter because every vector in the plane is a scaled copy of the first plus a scaled copy of the second, which is what its coordinates have been saying all along.
(x, y) = x·e₁ + y·e₂Now send both of them through the matrix.
Worked example
A·e₁ = A·(1, 0) = (2, 1)
A·e₂ = A·(0, 1) = (1, 2)Those two results are the columns of A, read top to bottom. That is not a coincidence, it is what the columns are.
And because a matrix distributes over addition and scaling, the two operations from section 3, knowing where the basis vectors land is enough to know where anything lands.
A·(x, y) = x·(A·e₁) + y·(A·e₂)›Why this works
Check it against the worked example above. A sends e₁ to (2, 1) and e₂ to (1, 2), so for the input (3, 1) the rule says
3·(2, 1) + 1·(1, 2) = (6, 3) + (1, 2) = (7, 5)which is the same (7, 5) the row-by-row calculation produced. The two routes are the same arithmetic gathered differently, one grouping by output and the other by input.
This is what justifies the claim that a matrix is completely described by its columns. Two arrows fix the whole transformation.
Check yourself
Questions on Sections 10 to 13
Question 1 of 5
In the convention this primer uses, what do a matrix’s rows and columns count?
14. Transforming the Plane
Since the basis vectors fix everything, the natural picture is not one arrow moving but the entire plane being carried somewhere. The box below draws it. The faint grid is the plane before, the darker one is after, the two arrows are where the basis vectors land, and the shaded shape is what became of the unit square.
The presets are worth walking one at a time, because the four families cover most of what a matrix can do. Scaling stretches along the axes. Reflection flips the plane across a line. Rotation turns everything about the origin by a fixed angle. Shearing slides one axis along while leaving the other where it was, which is what turns a square into a leaning parallelogram.
Keep in mind
Everything a matrix can do to the plane is a linear transformation, and that word carries three commitments. The origin does not move. Adding two vectors and then transforming gives the same answer as transforming both and then adding. Scaling then transforming matches transforming then scaling.
One familiar operation is missing from that list, which is sliding the whole plane sideways. A translation moves the origin, so it is not linear and no matrix of this kind performs one. Models that need translations get them another way, usually by carrying a separate offset, which is exactly the plus b in section 8.
15. Directions That Stay on Their Line
Take one arrow, send it through A, and compare where it pointed with where its image points. Usually the two differ, because the matrix has both stretched the arrow and turned it.
Which raises a question worth asking before any terminology arrives. Are there directions this matrix stretches without turning at all?
Worked example
Try the arrow (1, 1).
A·(1, 1) = (2·1 + 1·1, 1·1 + 2·1) = (3, 3)And (3, 3) is 3·(1, 1). The length changed, from √2 to 3√2. The coordinates changed, from (1, 1) to (3, 3). The direction did not change at all, because the output is just the input scaled.
A direction with that property has a name, and so does the number. The direction is an eigenvector of the matrix, and the factor it is scaled by, 3 here, is the matching eigenvalue.
This matrix has a second one. Try (1, −1) and it comes back as (1, −1) exactly, an eigenvector with eigenvalue 1, a direction the matrix leaves completely alone.
Drag the indigo arrow in the box below and watch the amber image swing away from it, then sweep onto one of the dashed lines and see the two fall into line.
Drag the indigo arrow. The amber arrow is where the matrix sends it.
…
16. Eigenvalues as Scaling Factors
“Stretch factor” undersells the eigenvalue, because its size and its sign say different things and it can do more than stretch.
| eigenvalue | what happens to that direction |
|---|---|
| greater than 1 | stretched |
| between 0 and 1 | shrunk, still pointing the same way |
| exactly 1 | left completely unchanged |
| exactly 0 | collapsed onto the origin |
| negative | reversed, and scaled by its size |
Every row of that table can be seen in the box in section 14, where the two arrows show where the basis vectors land. The matrices below are chosen so that the basis vectors themselves are the preserved directions, which makes each case checkable by hand from section 13.
Worked example
Load the Stretch preset, whose four entries are 2, 0, 0 and 0.5.
⎡ 2 0 ⎤ · (1, 0) = (2, 0) = 2 · (1, 0)
⎣ 0 0.5 ⎦ · (0, 1) = (0, 0.5) = 0.5 · (0, 1)The horizontal direction is stretched by 2 and the vertical one is shrunk to half, still pointing up, so this one matrix shows the first two rows of the table and its eigenvalues are 2 and 0.5.
Load the Shear preset, entries 1, 1, 0 and 1, and e₁ comes back as (1, 0). The horizontal axis is left exactly where it was, an eigenvalue of 1, which is what the worked matrix did to (1, −1). Now type the entries 1, 0, 0 and 0. That matrix sends e₂ to (0, 0), so the vertical direction is collapsed onto the origin, an eigenvalue of exactly 0, and since the basis images fix everything, the whole plane is flattened onto the horizontal axis. Finally type −1, 0, 0 and 1, which is a reflection across the vertical axis. It sends e₁ to (−1, 0), the same line with the arrow reversed, an eigenvalue of −1.
The negative case is the one that needs the earlier phrasing tightened. An eigenvector is not quite a direction the matrix leaves pointing the same way, it is a direction whose line the matrix preserves. A negative eigenvalue flips the arrow end for end while leaving it on that same line, which still counts.
Size and sign are read differently once the matrix comes from data rather than from a preset. On the PCA page every eigenvalue is an amount of variation along its direction, so there the size is what ranks the directions, which is where section 18 ends up.
Check yourself
Questions on Sections 14 to 16
Question 1 of 5
Sliding the whole plane sideways is one of the things a matrix of this kind can do.
17. The Eigenvector Equation
Now that the idea has been seen and computed, the notation adds nothing new. It says exactly what section 15 observed.
A·v = λ·v| symbol | what it is |
|---|---|
| A | the transformation |
| v | a candidate direction, not the zero vector |
| λ | the factor that direction is scaled by |
The eigenvector equation says that multiplying by the matrix preserves the vector’s axis and scales its magnitude. For this matrix, the vector (1, 1) is multiplied by three.
A(1, 1) = (3, 3) = 3(1, 1)The eigenvalue is three.
Finding eigenvectors algebraically is a separate skill, and this primer does not need it. Recognising what one is is enough for everything that follows.
Keep in mind
Not every matrix has such a direction to find. A quarter-turn rotation turns every arrow in the plane by ninety degrees, so no nonzero real arrow ends up back on the line it started on, and the rotation has no real eigenvectors at all.
It does have eigenvalues and eigenvectors in the complex numbers, which is a genuine and useful fact and entirely outside what is needed here. Load the rotation preset in the box above and sweep the arrow all the way round; nothing ever lines up.
18. Eigenvectors in PCA
Here is why any of the last four sections matter, kept to what the later page will actually use.
A dataset usually varies more in some directions than others, and those directions need not line up with the features that were measured. When two features move together, height and weight say, the direction of greatest variation runs diagonally between their axes rather than along either of them.
Principal component analysis builds a matrix describing how each pair of features varies together, called a covariance matrix. That matrix has eigenvectors, and they turn out to name directions the data varies along independently, each eigenvalue saying how much variation lies along its direction.
In a model
So the eigenvectors provide a new set of axes chosen by the data rather than by whoever collected it, and the eigenvalues rank them. Keeping the few directions with the largest eigenvalues keeps most of the variation while describing each example with fewer numbers, which is the whole of what the PCA page does.
One Language Used Across Machine Learning
Everything in this primer reappears, in this order, across the pages that follow.
Read down the table and the pieces chain into one picture of a model. A dataset is a matrix whose rows are example vectors. A model’s parameters are a vector with one entry per feature. A prediction for one example is the dot product of the two plus an offset, the line from section 8. A layer of a network is a matrix that carries that row to a new one, section 12. And principal component analysis takes the eigenvectors of a matrix built from the dataset, section 18. Each page that follows is one of those, said in its own vocabulary.
| idea | where it shows up |
|---|---|
| vector | one example, a parameter set, a prediction, an embedding |
| subtraction | the difference between two examples |
| length | the size of a vector, or its distance from the origin |
| distance | nearness between examples, or to a cluster centre |
| dot product | a weighted combination of features |
| matrix | a dataset, or several weighted sums performed together |
| transformation | a layer mapping one representation to another |
| eigenvectors | important directions, ranked by their eigenvalues |
Keep in mind
That table gives a matrix two rather different jobs, and they are worth keeping apart. A dataset stored as rows and columns is a matrix, and so is an operation that transforms an input vector into an output vector.
Both are grids of numbers and both are called matrices, though one is data at rest and the other is a thing that acts. “A dataset is a matrix” is true, and it does not follow that a dataset is a transformation.
Check yourself
Questions on Sections 17 and 18 and the Summary
Question 1 of 5
Some matrices have no real eigenvector at all.
Try it with Botie
Build with Botie
Write and run Python