Linear algebra
Matrix arithmetic
Addition and subtraction work for matrices of identical dimensions.
Multiplication works when the "inner two" dimensions are the same. Meaning: columns of first matrix = rows of second matrix.
The matrix multiplication A3x2 times B2x3 is defined. Putting the dimensions next to each other: 3x2 2x3
The "inner two" are the same.
To multiply, a visual aid is to raise the second matrix:
1 0 0 3 2 1 2 3 1 0 4 1
Then, for the first item, add the product of 2*1 and 3*3.
An identity matrix I, in Swedish denoted E, looks like this. The zeroes are shorthand for "there are zeroes all over here".
1 0 1 1 0 1
A square matrix has two possible properties:
- EITHER its determinant is zero
- OR it is invertible
Take two square matrices A and B. If AB = I and BA = I, they are inverses to each other. The inverse is unique. The inverse of A is denoted A-1.
Powers function like you expect: (AB)-1 = B-1 A-1 but only square matrices
Calculating a determinant - Sarrus' rule, Laplace utveckling, or Gauss-Jordan elimination
Calculating the inverse of a 2x2 matrix: determinant (ad-bc) times the adjugate.
Calculating the inverse of a 3x3 matrix:
Your original KhanAcademy method involves the determinant, the matrix of minors, the cofactor matrix and the adjugate matrix.
- Matrix of minors is nine 2x2 determinants.
- This produces something called the cofactor matrix.
- Taking the transpose of the cofactor produces the adjugate matrix.
- You know this. 1/det(A) times adj(A) produces the inverse to A, same as for 2x2 matrices.
The Gaussian method
- Draw your matrix. Draw a vertical line. Draw the identity matrix on the other side.
- Do elementary row operations, and whatever you do to the first matrix, you have to do to the identity matrix.
- Goal: the first matrix should become the identity matrix.
- Result: the original identity matrix has become the inverse matrix.
Determinants
Take a couple of 2x2 matrices, call them A and B. Say that
det(A) = -1 and
det(B) = -3.
What are the following?
det(AB) det(2A) det(A+) det((B2)-1) det(B5)
How to calculate a determinant:
You can Gauss it until you have a triangular matrix. Then the determinant is the product of the diagonal elements.
For a 2x2 matrix, the determinant is node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Gauss-Jordan
Write a system of equations as a talschema (this is not a matrix). Reduce.
Elementary row-ops:
- Swap two rows
- Multiply row with something
- Add the expanded row to another row
Reduced row echelon form -- trappstegsform. 1 * * * * | * 1 * * | * 1 * | * 1 | *
Each 1 in the diagram above is a "pivot".
Three possibilities
- There is a row
0 0 ... 0 | a
. No solutions. - There is a pivot in every column. One unique solution!
- There are columns without pivots. Infinite solutions.
- If there is a row
0 0 ... 0 | 0
, you can just toss that row. 0=0 is true but adds no info. - If there are two identical rows, you can toss one of them. It adds no info.
Vectors
Warning: Can have node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Subtraction is tricky: get the order right. Take three points A, B, C. AB minus AC is what? Look at the minuend(?), AB. The thing being subtracted from is AB. Therefore, AB is pointing at the same point that the resulting vector will point at. So the resulting vector is CB: it goes from C to B.
If you ever have coordinates X, Y, neither of which are in the origin, you can point at either of them with vector addition. Take a point O in the origin and add OY to YX to get OX. Or add OX to XY to get OY.
Scalar product🔗
A scalar is just a number.
- Multiplying a vector with a scalar obviously gives you a different vector.
- Multiplying a vector by another vector gives you a scalar.
The scalar product of two vectors comes from multiplying them together like node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
The second clause is necessary because, though node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
You can see that if the angle is 90 degrees – i.e. they are orthogonal – the scalar product will be zero, because what is the cosine of 90 degrees?
Note, often in linear algebra, the angle between two objects indicates the smaller of the two possible angles – the pointy angle, so node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
A formula that does not use the angle, is this. Let node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Cross product🔗
So named because a you get a vector out of it. Also called cross product. Only defined in 3D-space.
There is no "the" normal-vector of a plane. A normal-vector is determined by its direction, but its length can be whatever you like. As such, the cross product of two vectors within a plane is one possible normal to that plane.
To get the coordinates of a vector product, the practical method is this:
Let node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
As a memory rule, you can use the nonsensical expression
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
nonsensical because determinants shouldn't contain vectors, but it works here as a memory rule to produce the formula. Do not forget the negative sign in the formula.
Absolute value
The magnitude, or length of a vector, is calculated with the Pythagorean theorem.
Want to find the parallellogram between two vectors? Take the cross product of the two, and calculate the absolute value of it. It's the same as the determinant of the two.
Positive/negative orientation🔗
In two-dimensional space, two vectors u and v, create a positively oriented base if:
when you rotate the first vector, u, counter-clockwise, you can make it point in the same direction as v without rotating more than 180 degrees.
In three-dimensional space… imagine yourself perched on the top of the third vector, looking down at the plane made by the other two. Apply the above rules.
(VERIFY) Alternatively, you can use the hand rule:
Form your right hand so that your thumb, index and middle fingers are orthogonal to each other. May require some stretching of muscles.
You can pivot your hand any way you like, the point being… if your palm is facing upwards, your middle finger is pointing upwards, and the thumb to your right. Then the thumb should represent the x-axis (the first vector), the index finger the y-axis (the second vector), and the middle finger the z-axis (or a cross product of two vectors). Now that you've named your fingers, you can pivot the hand around.
If the vectors you are looking at don't follow that arrangement, they create a negatively oriented base(?).
ON-base
An orthonormal base is one where the base vectors are orthogonal to each other and have length 1.
There are several different ON-bases: it can be orientated all manner of ways. In particular, some rules are different if it has a "positive" versus "negative" orientation, see Positive/negative orientation.
Plane
If in R3 you have a plane node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Think before you read on!
…
Does it matter what y or z are?
The plane doesn't give a shit about y or z, but x must be zero. So, at any point on the plane, x must be zero. That means, that the x-axis is orthogonal to our plane.
Good going! Now, find a normal to that plane. It is easy: pick any value of x: node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Notice how you can get that from reading the plane's equation: they are the coefficients to x, y, z.
You know that it is a normal because the Scalar product of orthogonal vectors should be zero, right? A vector node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Let a new plane node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Let a new plane node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Angle between lines
Use both ways to do the dot product. The only unknown becomes node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Also, a trick is: the angle between two lines is the same as the angle between their normals. (Draw this)
Projection formula
To project the vector u on the vector v, the formula is
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Linear dependence
Look at R2. If you have two vectors pointing different directions, you can create any other vector in R2 by scaling those two and adding them to each other an appropriate amount of times.
If those two vectors are on the same line, you can only ever get another vector on that line. Make sense?
Zero vectors, regardless of scaling, can only produce another zero vector.
Now, you can extend this to higher dimensions. If two vectors are within a plane, there is no combination of those two vectors that can produce a vector poking out of the plane. It is said that any set of three vectors within the plane is a linearly dependent set, because the other two can be used to produce the third – there is redundancy.
A linearly independent set of three vectors within R3 is one where none of the vectors can be produced by a combination of the other two.
To check for linear dependence, e.g. to check if three vectors within space are in the same plane, put them in a determinant like so: det(u, v, w):
node:internal/modules/cjs/loader:1228
throw err;
^
Error: Cannot find module 'katex'
Require stack:
- /home/kept/private-dotfiles/.config/emacs/texToMathML.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Module._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.
Fundamental Theorem of Linear Algebra
determinant=0, system of equations solutions, invertability of matrix
Idempotent matrix
What links here
- Math