An assortment of preliminaries on linear algebra
and also a test for pandoc
This entire document was written entirely in Typst and directly translated to this file by Pandoc. It serves as a proof of concept of a way to do static site generation from Typst files instead of Markdown.
I figured I should write this stuff down before I forgot it.
Basic Notions
Vector spaces
Before we can understand vectors, we need to first discuss vector spaces. Thus far, you have likely encountered vectors primarily in physics classes, generally in the two-dimensional plane. You may conceptualize them as arrows in space. For vectors of size , a hand waving argument is made that they are essentially just arrows in higher dimensional spaces.
It is helpful to take a step back from this primitive geometric understanding of the vector. Let us build up a rigorous idea of vectors from first principles.
Vector axioms
The so-called axioms of a vector space (which we’ll call the vector space ) are as follows:
Commutativity:
Associativity:
Zero vector: a special vector, denoted , such that
Additive inverse: . Such an additive inverse is generally denoted
Multiplicative identity:
Multiplicative associativity:
Distributive property for vectors:
Distributive property for scalars:
It is easy to show that the zero vector and the additive inverse are unique. We leave the proof of this fact as an exercise.
These may seem difficult to memorize, but they are essentially the same familiar algebraic properties of numbers you know from high school. The important thing to remember is which operations are valid for what objects. For example, you cannot add a vector and scalar, as it does not make sense.
Remark. For those of you versed in computer science, you may recognize this as essentially saying that you must ensure your operations are type-safe. Adding a vector and scalar is not just “wrong” in the same sense that is wrong, it is an invalid question entirely because vectors and scalars and different types of mathematical objects. See [@chen2024digression] for more.
Vectors big and small
In order to begin your descent into what mathematicians colloquially recognize as abstract vapid nonsense, let’s discuss which fields constitute a vector space. We have the familiar field of where all scalars are real numbers, with corresponding vector spaces , where is the length of the vector. We generally discuss 2D or 3D vectors, corresponding to vectors of length 2 or 3; in our case, and .
However, vectors in can really be of any length.
Vectors can be viewed as arbitrary length lists of numbers (for the
computer science folk: think C++ std::vector
).
Example.
Keep in mind that vectors need not be in at all. Recall that a vector space need only satisfy the aforementioned axioms of a vector space.
Example. The vector space is similar to , except it includes complex numbers. All complex vector spaces are real vector spaces (as you can simply restrict them to only use the real numbers), but not the other way around.
From now on, let us refer to vector spaces and as .
In general, we can have a vector space where the scalars are in an arbitrary field, as long as the axioms are satisfied.
Example. The vector space of all polynomials of at most degree 3, or . It is not yet clear what this vector may look like. We shall return to this example once we discuss basis.
Vector addition. Multiplication
Vector addition, represented by can be done entrywise.
Example.
This is simple enough to understand. Again, the difficulty is simply ensuring that you always perform operations with the correct types. For example, once we introduce matrices, it doesn’t make sense to multiply or add vectors and matrices in this fashion.
Vector-scalar multiplication
Multiplying a vector by a scalar simply results in each entry of the vector being multiplied by the scalar.
Example.
Linear combinations
Given vector spaces and and vectors and , is the linear combination of and .
Spanning systems
We say that a set of vectors span if the linear combination of the vectors can represent any arbitrary vector .
Precisely, given scalars ,
Note that any scalar could be 0. Therefore, it is possible for a subset of a spanning system to also be a spanning system. The proof of this fact is left as an exercise.
Intuition for linear independence and dependence
We say that and are linearly independent if cannot be represented by the scaling of , and cannot be represented by the scaling of . Otherwise, they are linearly dependent.
You may intuitively visualize linear dependence in the 2D plane as two vectors both pointing in the same direction. Clearly, scaling one vector will allow us to reach the other vector. Linear independence is therefore two vectors pointing in different directions.
Of course, this definition applies to vectors in any .
Formal definition of linear dependence and independence
Let us formally define linear independence for arbitrary vectors in . Given a set of vectors
we say they are linearly independent iff. the equation
has only a unique set of solutions such that all are zero.
Equivalently,
More precisely,
Therefore, a set of vectors is linearly dependent if the opposite is true, that is there exists solution to the equation
such that
Basis
We say a system of vectors is a basis in if the system is both linearly independent and spanning. That is, the system must be able to represent any vector in as well as satisfy our requirements for linear independence.
Equivalently, we may say that a system of vectors in is a basis in if any vector admits a unique representation as a linear combination of vectors in the system. This is equivalent to our previous statement, that the system must be spanning and linearly independent.
Standard basis
We may define a standard basis for a vector space. By convention, the standard basis in is
Verify that the above is in fact a basis (that is, linearly independent and generating).
Recalling the definition of the basis, we can represent any vector in as the linear combination of the standard basis.
Therefore, for any arbitrary vector , we can represent it as
Let us call and the coordinates of the vector. Then, we can write as
For example, the vector
represents
Verify that this aligns with your previous intuition of vectors.
You may recognize the standard basis in as the familiar unit vectors
This aligns with the fact that
However, we may define a standard basis in any arbitrary vector space. So, let
be a standard basis in . Then, the coordinates of a vector represent the following
Using our new notation, the standard basis in is
Matrices
Before discussing any properties of matrices, let’s simply reiterate what we learned in class about their notation. We say a matrix with rows of length , and columns of size (in less precise terms, a matrix with length and height ) is a matrix.
Given a matrix
we refer to the entry in row and column as .
Matrix transpose
A formalism that is useful later on is called the transpose, and we obtain it from a matrix by switching all the rows and columns. More precisely, each row becomes a column instead. We use the notation to represent the transpose of .
Formally, we can say
Linear transformations
A linear transformation is a mapping between two vector spaces , such that the following axioms are satisfied:
, for all scalars
Definition. is a linear transformation iff.
Abuse of notation. From now on, we may elide the parentheses and say that
Remark. A phrase that you may commonly hear is that linear transformations preserve linearity. Essentially, straight lines remain straight, parallel lines remain parallel, and the origin remains fixed at 0. Take a moment to think about why this is true (at least, in lower dimensional spaces you can visualize).
Examples.
Rotation for (i.e. rotation in 2 dimensions). Given , and their linear combination , a rotation of radians of is equivalent to first rotating and individually by and then taking their linear combination.
Differentiation of polynomials. In this case and , where is the field of all polynomials of degree at most .
Matrices represent linear transformations
Suppose we wanted to represent a linear transformation . I propose that we need encode how acts on the standard basis of .
Using our intuition from lower dimensional vector spaces, we know that the standard basis in is the unit vectors and . Because linear transformations preserve linearity (i.e. all straight lines remain straight and parallel lines remain parallel), we can encode any transformation as simply changing and . And indeed, if any vector can be represented as the linear combination of and (this is the definition of a basis), it makes sense both symbolically and geometrically that we can represent all linear transformations as the transformations of the basis vectors.
Example. To reflect all vectors across the -axis, we can simply change the standard basis to
Then, any vector in using this new basis will be reflected across the -axis. Take a moment to justify this geometrically.
Writing a linear transformation as matrix
For any linear transformation , we can write it as an matrix . That is, there is a matrix with rows and columns that can represent any linear transformation from .
How should we write this matrix? Naturally, from our previous discussion, we should write a matrix with each column being one of our new transformed basis vectors.
Example. Our -axis reflection transformation from earlier. We write the bases in a matrix
Matrix-vector multiplication
Perhaps you now see why the so-called matrix-vector multiplication is defined the way it is. Recalling our definition of a basis, given a basis in , any vector can be written as the linear combination of the vectors in the basis. Then, given a linear transformation represented by the matrix containing the new basis, we simply write the linear combination with the new basis instead.
Example. Let us first write a vector in the standard basis in and then show how our matrix-vector multiplication naturally corresponds to the definition of the linear transformation.
is the same as
Then, to perform our reflection, we need only replace the basis vector with .
Then, the reflected vector is given by
We can clearly see that this is exactly how the matrix multiplication
is defined! The column-by-coordinate rule for matrix-vector multiplication says that we multiply the entry of the vector by the corresponding column of the matrix and sum them all up (take their linear combination). This algorithm intuitively follows from our definition of matrices.
Matrix-matrix multiplication
As you may have noticed, a very similar natural definition arises for the matrix-matrix multiplication. Multiplying two matrices is essentially just taking each column of , and applying the linear transformation defined by the matrix !