Sources and coverage
- Lecture A (Monday): CS Lens on Fibonacci numbers and iterated squaring; special cases of matrix multiplication (covectors, outer product); mixed products and the cost of different evaluation orders. The recording stops at the break (the transcript turns into noise during the clicker on multiplying three matrices), so the second half of Monday is missing. The clicker topic is reconstructed in §4.3 with a standard example; the numbers used in the lecture could not be recovered.
- Lecture B (Wednesday): invertible functions, the inverse of a linear transformation, when a matrix transformation is invertible, invertible/singular matrices, the inverse matrix, the and formulas, and the rules for inverting products and transposes.
- Handouts “Gauss Elimination, Worked Example” (
nice,ugly,failure, B. Gärtner): a preview of Chapter 3, which according to the lecturer starts on Friday. They are worked through completely in §4.5–4.7.- Script numbers were taken from the audio. Numbers marked (no. inferred) were unclear in the recording and should be checked against the official script.
Discrepancies and corrections
- Lemma 2.50 was named for both cases (“wide matrix → not invertible” and “tall matrix → not invertible”). In the script these are most likely two separate statements (2.50 / 2.51). Check the script.
- On the rule the lecturer first said “first undo , then ” and corrected himself straight away: means first , then , so the inverse first undoes , then .
- On the question “does imply the columns are dependent?” he briefly said “independent” and corrected it: if , the columns are linearly dependent.
- The CS Lens material (Fibonacci) is explicitly not exam-relevant. It is background only.
1. Executive Overview & Core Objectives
This week has two halves.
Monday: every product of a matrix with a vector, covector or scalar can be computed with the rules of matrix multiplication, but the objects involved are mathematically different, and the order of evaluation decides how expensive the computation is.
Wednesday: the result is the same no matter which bracketing you choose (associativity), which leads to the central question of the week: when can a matrix transformation be undone? The answer: exactly when is square and has linearly independent columns. Equivalently, there is a matrix with . This is unique and is called the inverse matrix .
The Gauss handouts show the algorithm (Chapter 3) for solving systematically, and when it fails.
Learning objectives. After this week you should be able to:
- Classify the special cases of matrix multiplication by the type of their result: matrix·vector, covector·matrix, scalar product, outer product, scalar multiples.
- Evaluate mixed products such as correctly, recognise them (e.g. ), and choose an efficient evaluation order.
- Define invertible (bijective) functions and give the two ways a function can fail to be invertible.
- Prove: the inverse of an invertible linear transformation is linear (Lemma 2.48).
- State and prove the three equivalent characterisations of invertible matrix transformations (Lemma 2.52).
- Define invertible / singular / , prove that the inverse is unique, and use .
- Invert and matrices and verify the result.
- Use and .
- Carry out Gauss elimination with elimination matrices , permutation matrices and back substitution, and recognise the failure case.
2. Core Concepts & Formal Definitions
2.1 Special cases of matrix multiplication (Monday)
Recall that the product of an matrix and an matrix is the matrix whose entry is the scalar product of row of and column of . Column of is times column of .
If one of the two factors is flat (only one row or one column), the product is numerically identical to an operation we already know. The objects involved are still different:
| Product | Dimensions as matrices | Result type | Meaning |
|---|---|---|---|
| matrix · vector | vector in | applying a matrix transformation | |
| covector · matrix | covector | ”transformation of covectors” | |
| covector · vector | scalar | scalar product | |
| vector · covector | matrix | outer product (äußeres Produkt) | |
| matrix · | vector | scalar multiple, scalar written on the right | |
| · covector | covector | scaling a covector | |
| · | scalar | ordinary real multiplication |
Covector (Kovektor) and outer product
A covector is a row vector (""). It can be multiplied with a matrix from the left if it has as many entries as the matrix has rows:
The outer product of and is the matrix
Compare: covector · vector number, while vector · covector matrix.
Intuition: same arithmetic, different objects
Matrix·vector and matrix·( matrix) produce the same numbers, but the first is applying a transformation to a vector, while the second is a composition of two transformations. The lecturer deliberately keeps vectors and matrices apart (different brackets). Gilbert Strang, for example, treats vectors as matrices; the lecturer’s view is “that is bad”. For computing, though, you may treat every object as a matrix.
Exam Trap: scalar multiplication is not a special case of matrix multiplication
for an arbitrary matrix cannot be written as a matrix product with a matrix: the dimensions only match when has a single row or column. Scalar multiplication is a separate operation (Def. 2.2). Writing the scalar on the right () is not officially defined, but it is accepted (“to break the rules, you first have to master them”).
2.2 Mixed products (gemischte Produkte)
A mixed product contains matrices, vectors, covectors and scalars together, e.g. . You evaluate it by treating every factor as a matrix:
- vectors in as matrices;
- covectors in as matrices;
- scalars as matrices.
Then you only need to adjust the brackets of the result to its type. Two rules from last week carry over:
Lemma 2.40 (generalised associativity)
The value of a product of matrices does not depend on how it is bracketed.
Lemma 2.38 (transpose of a product)
(transpose the factors, reverse the order).
Exam Trap: same value, different cost
All bracketings give the same result, but the computational effort can differ by orders of magnitude. Rule of thumb: never form a large intermediate matrix (e.g. or an outer product ) if you can work with vectors instead.
2.3 Invertible functions (Wednesday)
Definition (invertible / bijective function)
Let be sets and a function. is called invertible (umkehrbar), or bijective (bijektiv), if
i.e. each possible output comes from exactly one input. In that case is the forward transformation (Vorwärtstransformation) and
is the inverse (Inverse / Umkehrfunktion), i.e. the backward transformation (Rückwärtstransformation).
A function can fail to be invertible in two ways:
- There is a with no such that (not surjective).
- There is a with more than one such that (not injective).
The course does not need “surjective” or “injective”; it only talks about invertible functions.
Non-examples
- on : has the two preimages and (failure of type 2).
- The “least invertible linear function” , (the zero matrix): every has no preimage (type 1); has all as preimages when (type 2).
Fact 2.47 (inverses cancel) (no. inferred: "2.47")
If is invertible, then is invertible with , and
Practical meaning: in an expression you may “cancel” and , just as multiplying and then dividing by the same number cancels.
2.4 Invertible linear and matrix transformations
Lemma 2.48 (the inverse of a linear transformation is linear)
Let be an invertible linear transformation. Then is also a linear transformation.
This is not automatic: an inverse function does not in general inherit the properties of the original. For linearity it does hold (proof in §3.1).
Corollary 2.49
If the matrix transformation is invertible, then is also a matrix transformation.
Lemma 2.50 (only square matrices can be invertible)
Let be an matrix.
- If (wide matrix), then is not invertible.
- If (tall matrix), then is not invertible either. (Probably Lemma 2.51 in the script.)
Intuition (not a rigorous proof)
- Wide: there are “more inputs than outputs”, so two inputs will probably land on the same output (failure of type 2).
- Tall: there are “more outputs than inputs”, so some output will probably have no input (failure of type 1).
Caution: this argument is valid only for linear transformations. There are non-linear bijections , so “size of the spaces” alone proves nothing. The rigorous argument is in the script around Lemma 2.50.
So only remains, and even then not every matrix works (the zero matrix fails).
Q&A: the empty matrix is invertible. contains exactly one element, so the only map is the identity, which is invertible.
Lemma 2.52 (characterising invertible matrix transformations) (no. inferred)
Let be an matrix. The following three statements are equivalent:
- is invertible.
- There is an matrix with .
- The columns of are linearly independent.
Statement 3 is the practical test: check whether the columns are linearly independent. An equivalent formulation (from a question during the break): the null space (Nullraum) of contains only .
Lemma 2.53
Let be matrices with . Then also .
This is remarkable, because matrix multiplication is not commutative in general (). It holds here because the transformations undo each other in either order; a student found this argument himself. The proof is in the script.
2.5 Invertible matrices and the inverse (§2.4.2)
Definition 2.54 (invertible / singular) (no. inferred)
Let be an matrix. is invertible (invertierbar) if there is an matrix with
Otherwise is called singular (singulär).
- By Lemma 2.52, “invertible” is equivalent to “the columns are linearly independent”. Keep both interpretations in mind.
- “Singular” is used only for square matrices. Wide and tall matrices are never invertible, so they are not called singular.
Observation 2.55 (equivalent conditions, uniqueness) (no. inferred)
For matrices the following are equivalent:
All three versions appear as definitions in the literature. The third has the advantage that it does not presuppose Lemma 2.53. If such a exists, it is unique.
Definition 2.56 (inverse matrix)
Let be an matrix. is invertible iff there is an matrix with (equivalently , equivalently ). This is unique; it is called the inverse (Inverse) of and written
Moreover, is itself invertible and .
Inverses of small matrices
:
Matrix inversion generalises taking reciprocals of real numbers, including the restriction “not ”.:
If , the matrix is singular: its columns are linearly dependent (proof in §3.5).
The scalar factor multiplies every entry (scalar multiplication); it is just written compactly in front. Where the formula comes from is covered in the second part of the course (determinants). For larger there is still a closed formula (Cramer’s rule, Cramersche Regel), but it grows quickly and is inefficient. Chapter 3 gives an efficient algorithm (Gauss).
Lemma 2.58 (inverse of a product) (no. inferred)
If and are invertible matrices, then is invertible and
More generally .
Lemma 2.59 (inverse and transpose)
If is invertible, then is invertible and
Intuition: socks and shoes
means first , then (as transformations, ). To undo it you first undo the step done last, , and then . You put on socks and then shoes in the morning, and take off shoes and then socks in the evening.
3. Step-by-Step Derivations & Mathematical Proofs
3.1 Proof of Lemma 2.48 ( is linear)
A linear transformation is defined axiomatically by two properties:
- ;
- .
We check both for .
Idea. We have to use the linearity of somewhere, so we have to bring into play. The trick is to write (Fact 2.47) and then apply at the end; the pairs cancel.
Axiom 1. To show: for all .
Name and . By linearity of (axiom 1 for ):
The last step is Fact 2.47: “does nothing”. Now apply to both sides. A function gives equal outputs for equal inputs, so this is allowed:
That is exactly the claim, read backwards. ✓
Axiom 2. To show: .
With , axiom 2 for gives
Applying to both sides, the on the left cancels:
3.2 Proof of Corollary 2.49
Three known results combine into a new one:
- is a linear transformation, because every matrix transformation is linear (Observation 2.20).
- is linear by Lemma 2.48.
- Every linear transformation is a matrix transformation (Theorem 2.23). Hence for some matrix .
An aside from the lecture
This is a typical proof pattern: the power lies in the known results, and the proof only combines them. According to the lecturer, AI systems that recently solved hundreds of open mathematical problems often work exactly this way. Their advantage is finding which known results fit together.
3.3 Proof of Lemma 2.52 (circular chain )
Proof pattern: if every statement implies the next one in a circle, then all three are true or all three are false.
. Let be invertible.
- By Corollary 2.49, is a matrix transformation, so for some matrix .
- Since undoes (Fact 2.47), for every standard unit vector :
The last equality is re-bracketing (Corollary 2.35: the product matrix represents the composition). - But is column of . So column of equals for every , i.e. . ✓
. Let . To show: the columns of are linearly independent.
- is a linear combination of the columns of with coefficients .
- Independence means: the only combination giving is the trivial one, i.e. (Observation 2.5).
- So let . Then
The steps use , associativity, the assumption , and “matrix times zero vector is zero”. ✓
. Let the columns of be linearly independent.
- Existence: linearly independent vectors in span all of (Lemma 1.26; the Scratch animation). In matrix language: for every there is an with .
- Uniqueness: the coefficients of a linear combination of linearly independent vectors are unique (Lemma 1.22). So this is unique.
- “For every exactly one ” is precisely the definition of invertible. ✓
3.4 Uniqueness of the inverse (Observation 2.55)
Let and both satisfy the (equivalent) conditions, so in particular and . Then
- Step 2 uses .
- Step 3 uses associativity.
- Step 4 uses .
This direct algebraic computation is all that is needed. (The high-level argument via the uniqueness of the matrix of a transformation also works.)
3.5 The formula and the case
Verification. It is enough to check one product (Lemma 2.53), but both are easy:
Without the factor you get a diagonal matrix, but not . Dividing by fixes this.
Student question: does imply the columns are dependent? Yes. Write and . If :
- If , the first combination is non-trivial.
- If , the second one is.
- If both are zero, and the columns are trivially dependent.
So the columns are dependent is singular. In the second part of the course, will be called the determinant.
3.6 Proofs of Lemmas 2.58 and 2.59 (in the script; not done in lecture)
(2.58) By Observation 2.55 it suffices to find one matrix with :
So is invertible with . For three factors, apply the rule twice:
(2.59) Using Lemma 2.38 ():
So is invertible with .
3.7 CS Lens: Fibonacci with matrix powers (not exam-relevant)
Fibonacci numbers.
The naive method, a Python list where each new value is F[-1] + F[-2], computes all , even if only is wanted.
Key observation: one step is one matrix–vector multiplication.
- Row 1 of times the vector keeps .
- Row 2 adds the two entries, which gives .
Applying this repeatedly (formally by induction) gives
The second equality uses associativity: compute first, then apply it to the vector. Since , the vector is the second column of . So is the bottom-right entry of . (In fact .)
Iterated squaring (iteratives Quadrieren). Use and :
Working back up:
| Power | Matrix |
|---|---|
| bottom right: |
This takes only about matrix multiplications instead of about additions.
Why not use Binet’s formula? From the exercise sheet,
On a computer, is only available as a floating-point number (Fließkommazahl), an approximation. For large rounding errors appear and the result has to be rounded to an integer. The lecturer considers iterated squaring the most practical method.
Reference: J. Matoušek, Thirty-three Miniatures: Mathematical and Algorithmic Applications of Linear Algebra.
4. Worked Examples & Applications
4.1 Evaluating the mixed product (Monday)
Let and .
Bracketing 1: .
- is covector·matrix, so a covector.
- is a vector.
- Covector·vector is a scalar.
- By Lemma 2.38, , so
(squared Euclidean norm: the scalar product of with itself, without the square root).
Bracketing 2: .
- is an matrix.
- Covector·matrix is a covector; covector·vector is a scalar.
- The same scalar results, by associativity.
Exam Trap: efficiency
Bracketing 2 computes the matrix product . For a large this costs about multiplications. Bracketing 1 only needs , about multiplications, plus a scalar product of length . Same value, very different running time.
4.2 The extreme example
Let .
- is scalar times scalar, . Cost: about multiplications plus one squaring.
- forms the outer product , an matrix; then matrix·vector and covector·vector. The result is the same scalar.
For , the first variant needs about operations, while the outer product alone has entries. Massively inefficient.
4.3 Clicker (Monday): in which order should three matrices be multiplied? (reconstructed)
The clicker’s exact dimensions were lost in the recording; the fragments mention , , . The principle:
Cost of a matrix product
Multiplying an matrix by an matrix in the standard way takes scalar multiplications. The result is .
Example (standard textbook example)
: , : , : .
- : costs and gives a matrix; costs . Total 7500.
- : costs and gives a matrix; costs . Total 75000.
Same result, ten times the effort. Rule of thumb: first collapse the dimension that makes the intermediate result small.
4.4 Clicker (Wednesday): how many matrices with entries in are invertible?
There are matrices. Use the criterion “columns linearly independent” and go through the cases for column 1:
- Column 1 : always dependent, so invertible.
- Column 1 is one of the 3 non-zero vectors :
- column 2 : dependent;
- column 2 column 1: dependent;
- the remaining 2 choices: independent. (Two distinct non-zero 0/1 vectors in are never multiples of each other.)
Result: 6 of 16 are invertible, 10 are singular. Most of the class answered correctly.
Intuition: almost all real matrices are invertible
This example is somewhat misleading. With larger entries, say between and , singular matrices are the exception: for , column 2 would have to be exactly a multiple of column 1. Over , the singular matrices form a null set (Nullmenge): a “randomly drawn” real matrix is invertible. In the Scratch animation, the “L” only becomes non-invertible at the exact moment it collapses onto a line, which happens extremely rarely.
4.5 Example from the beginning of Wednesday
scales by in the -direction. The backward transformation scales by :
Check with the formula: , so . ✓
Gauss elimination: the handouts (preview of Chapter 3)
Algorithm (Gauss elimination + back substitution)
Given with :
- Elimination (column by column ):
- If the pivot (current entry) is , swap row with a lower row whose entry in column is . This is a permutation matrix (Permutationsmatrix) . If no such row exists: give up.
- For each row : subtract row from row , with , so that entry becomes .
- Always apply each operation to as well.
- Back substitution (Rückwärtseinsetzen): solve the resulting upper triangular system from the bottom up for .
Elimination and permutation matrices
“Subtract row from row ” is multiplication from the left by the elimination matrix (Eliminationsmatrix)
Swapping rows and is multiplication by (the identity with rows and swapped). For example,
Both are applied to and : .
Connection to this week
- is invertible with (“add back”). is its own inverse.
- So every step is reversible, and the transformed system has exactly the same solutions as the original.
- is precisely an outer product from Monday.
4.6 Handout “nice” (with a row exchange)
Step 0, zero pivot. , so swap rows 1 and 2 ():
Column 1 (pivot ):
| Step | Computation | New row |
|---|---|---|
| : | row 2 row 1 () | |
| : | ||
| : |
Column 2 (pivot ):
| Step | Computation | New row |
|---|---|---|
| : | ||
| : |
Column 3 (pivot ):
| Step | Computation | New row |
|---|---|---|
| : |
Here has the entry at position .
Upper triangular form and back substitution:
| Eq. | Before substitution | After substitution | Solution |
|---|---|---|---|
| 4 | — | ||
| 3 | |||
| 2 | |||
| 1 |
Check (row 4 of the original system): . ✓
4.7 Handout “ugly” (fractions, but it works)
Column 1 (pivot ):
| Step | New row | |
|---|---|---|
Column 2 (pivot ):
, with . The scaled row 2 is , so
, with . The scaled row 2 is , so
Column 3 (pivot ):
, with . The scaled row 3 is , so
Back substitution:
| Eq. | Equation | Solution |
|---|---|---|
| 4 | ||
| 3 | ||
| 2 | ||
| 1 |
This was checked with exact rational arithmetic.
Lesson from "ugly"
The algorithm is purely mechanical. Ugly fractions are not a sign of a mistake. Only a pivot that is (with no possible swap) stops it.
4.8 Handout “failure” (singular matrix)
Column 1 ():
| Row | Result |
|---|---|
| 2 | |
| 3 | |
| 4 |
Column 2 (pivot ; ):
| Row | Computation | Result |
|---|---|---|
| 3 | ||
| 4 |
Column 3: the pivot is , and every entry below it in column 3 is as well. No row exchange is possible: give up!
Interpretation. Rows 3 and 4 now say and , so the system has no solution. The matrix has only two linearly independent rows; its columns are linearly dependent, e.g.
By Lemma 2.52, is singular.
Exam Trap: two kinds of failure
- If is singular, the system has either no solution or infinitely many, depending on . Here the last entries give no solution. With a that produces in both of those rows, there would be infinitely many.
- A zero pivot alone is not a failure (see “nice”). Only a zero pivot with no non-zero entry below it to swap in stops the algorithm.
5. Intuition & Conceptual Bridges
- Transformations explain the algebra. looks like a coincidence algebraically, but as transformations it is obvious: “forward then back” and “back then forward” both return to the start. The same view explains (socks and shoes).
- Inversion generalises division. : for . : division by , which must be . In general: ” is not zero” becomes “the columns of are independent”.
- Three views of “invertible”:
- Geometric: the transformation does not flatten anything (the “L” does not collapse).
- Algebraic: there is with .
- Combinatorial: the columns are independent; equivalently, only for .
- Link to Chapter 1: Lemma 1.22 (unique coefficients) and Lemma 1.26 ( independent vectors span ) are exactly the two parts of “exactly one preimage”.
- Link to Discrete Mathematics: “bijective” and the inverse function appear there in §3.6 (Functions). There, functions are special relations and the inverse is the inverse relation .
- Coming next:
- Chapter 3 (Friday): Gauss elimination as the efficient algorithm for solving and computing (the handouts are the preview).
- Second part of the course: determinants (where comes from) and mixed products such as (least squares, quadratic forms).
- CS perspective: associativity guarantees a correct result, but efficiency depends on the evaluation order. This is the classic “matrix chain multiplication” problem, solved with dynamic programming in algorithms courses.
6. Summary & Self-Assessment Questions
Cheat sheet
| Concept | Fact |
|---|---|
| Covector·matrix | is a covector; needs entries of rows of |
| Outer product | is an matrix; is a scalar |
| Mixed products | treat everything as matrices; associativity (L. 2.40); (L. 2.38) |
| ; evaluate as | |
| Cost of | multiplications |
| Bijective | |
| L. 2.48 | linear and invertible linear |
| L. 2.50 | wide or tall not invertible |
| L. 2.52 | invertible columns independent |
| L. 2.53 | (square matrices) |
| Def. 2.54 / 2.56 | invertible / singular; unique; |
| inverse | for |
| inverse | for |
| L. 2.58 | |
| L. 2.59 | |
| Gauss | : subtract times row ; : swap rows; then back substitution |
| Fibonacci | = bottom-right entry of ; iterated squaring |
Practice questions
Q1. Compute for and verify both and . Then solve using .
Solution to Question 1
Inverse. , so is invertible:
Verification.
(By Lemma 2.53 one check would have been enough.)Solving. :
Check: and . ✓
Q2. Prove: if is invertible, then for every the system has exactly one solution, namely .
Solution to Question 2
Existence. Put . Then
using associativity and (Def. 2.56 / Lemma 2.53).Uniqueness. Let also satisfy . Then
So there is exactly one solution.
This is exactly invertibility of from Lemma 2.52 (1): every has exactly one preimage.
Q3. True or false? Give a proof or a counterexample.
(a) If and are invertible, then is invertible.
(b) If is invertible ( square), then and are invertible.
(c) for all invertible .
Solution to Question 3
(a) False. and are both invertible, but is singular.
(b) True. Let .
- is invertible. , so is a left inverse of . By Def. 2.54, is invertible.
- is invertible. by Lemma 2.53, i.e. . By Observation 2.55 (the equivalent condition with ), is invertible.
(c) False in general. The correct rule is (Lemma 2.58). Counterexample: , .
- and .
- and .
- , and its inverse (determinant ) is .
The rule happens to hold when and commute.
Q4. Solve with Gauss elimination, writing out every elimination/permutation matrix:
Solution to Question 4
Zero pivot. , so apply
Column 1.
- : , so .
- : , . Row 3: .
Column 2.
- : , . Row 3: .
Back substitution.
- .
- .
- .
Check row 3: . ✓
Q5. Let and . Estimate the number of scalar multiplications needed to evaluate (a) as and (b) as . What is the value, interpreted geometrically?
Solution to Question 5
Let .
(a) .
- : , so .
- : covector·matrix, .
- covector·vector: .
- Total about .
(b) .
- : .
- Scalar product of with itself: .
- Total about , i.e. about 1000 times faster.
Value. , the squared Euclidean length of the transformed vector (using , Lemma 2.38). Both bracketings give the same number (Lemma 2.40). Only the cost differs.