Linear Transformations (and linear functionals) are one of the fundamental concepts of linear algebra. Under the hood matrices are tools to represent linear transformations. We are going to see that matrix transformations and linear transformations are equivalent. At this point we can consider matrices as functions.
We already have the intuition on linear transformations since they are equivalent to the function a matrix represents. We will prove this fact but before that here is a formal definition from the lecture notes:
Definition
2.19
(Linear transformation, linear functional)
A function T:Rn↦Rm is called a lienar transformation and a function Rn↦R is called a linear functional, if the following two linearity axioms hold for all x1,x2∈Rn and all λ∈R.
(i)T(x1+x2)=T(x1)+T(x2)
(ii)T(λx1)=λT(x1)
As an immediate observation we can say:
Observation 2.20.Every matrix transformation is a linear transformation.
Because we defined a matrix transofrmation as TA(x)=Ax and we know that A(x1+x2)=Ax1+Ax2 and A(λx1)=λA(x1), we know that matrix transformations satisfy the linearity axioms.
Lemma
2.21
Let T:Rn→Rm / T:Rn→R be a linear transformation / linear functional. Then
T(0)=0/T(0)=0.
This is very important. So repeat once more:
0 is always mapped to 0 by a linear transformation/functional:
T(0)=0T(0)=0
An important lemma that formalizes the axiom of linearity for more than two vectors is the following which comes with a proof by induction that I recommend reading from the lecture notes.
Lemma
2.22
Let T:Rn→Rm / T:Rn→R be a linear transformation / linear functional, let x1,x2,…,xℓ∈Rn and λ1,λ2,…,λℓ∈R. Then
T(j=1∑ℓλjxj)=j=1∑ℓλjT(xj).
Examples of Linear Transformations
In this subsection we will list some examples and non-examples of linear transformations. As an exercise, you can prove that they are linear transformations. The recipe is always the same, nothing fancy: Prove that the two linearity axioms hold. We are going to provide an example proof and counterexamples.
Linear Transformations
Scalar product Let v∈Rm be a vector. Then T:Rm→R
T(x)=i=1∑mvixi=v⊤x
is a linear functional.
Identity The identity function id:Rn→Rn
id(x)=x
is a linear transformation.
Constant Zero Let 0∈Rn be the zero vector. Then T:Rm→Rn:
T(x)=0
is a linear transformation.
Differentiation(informal) Let R[x] be the vector space of polynomials in one variable as defined in Def 4.4 of the lecture notes. Further let P⊆R[x] define subspace of polynomials of degree at most 3. The differentiation function Td:P→P:
Td(p)=dxdp
that gives the derivative of the polynomial is a linear transformation.
Proof
Let p=a3x3+a2x2+a1x+a0 and q=b3x3+b2x2+b1x+b0 be two polynomials of degree at most 3. Then we have:
Since Td satisfies both linearity axioms, Td is a linear transformation. □ (Note that this is an informal example since we do not define the differentiation operation formally in the lecture notes.)
Non-linear Transformations
Nonzero Constant Let c∈Rn∖{0} be a nonzero vector. Then T:Rm→Rn:
We have seen that every matrix A defines a linear transformation TA above (Observation 2.20). This theorem states the other direction: Every linear transformation T:Rn↦Rm is of the form T=TA for a unique m×n matrix A.
Theorem
2.23
Let T:Rn↦Rm be a linear transformation. There is exactly one m×n matrix A such that T=TA (meaning that T(x)=TA(x) for all x∈Rn). This matrix is:
A=∣T(e1)∣∣T(e2)∣…∣T(en)∣
Proof
For a given vector we want to create the same effect as a linear transformation using a matrix. An important set of vectors to observe is the set of unit vectors. Because as mentioned earlier, we can generalize the effect of a linear transformation if we know what happens to the unit cube.
We want an A s.t. T(x)=TA(x)=Ax. In particular we want this to hold for the unit vectors: T(ei)=Aei for i∈[n]. And multiplying a matrix with the i-th unit vector means to choose the i-th column of that matrix. Since we want this matrix to have the same effect as the given linear transformation, we put the result of T(ei) to the i-th column of the matrix.
A=∣T(e1)∣∣T(e2)∣…∣T(en)∣
Now we definitely have T(ei)=Aei. How about other vectors that are not the standard unit vectors? We can deconstruct them as a linear combination of the unit vectors! An example from 3 dimensions is:
So in general we can write x=∑i=1nxiei. Using this fact and the linearity axiom for linear transformations we can write:
TA(x)=Ax=j=1∑nxjT(ej)=T(j=1∑nxjej)=T(x).
The second equality writes the matrix vector multiplication as the linear combination of the columns of the matrix A. Using that A is our candidate matrix from above, we can write T(ej) instead of vj as the j-th column of A. This brings us to the third equation which is just an implementation of the linearity axioms. Last but not least, the fourth equation is justified because ∑j=1nxjej is equivalent to multiplying the vector x with the identity matrix. □
We knew that all matrix transformations are linear. Now we have proven that every linear transformation is also a matrix transformation. This means that the two types of transformations are equivalent! This fundamental result applies to many fields. One example is algebra. Remember how we showed above that differentiation is a linear transformation for polynomials of degree at most 3? For a polynomial of degree at most 3, represented as the vector of its coefficients p=(a0a1a2a3)⊤ the matrix corresponding to differentiation is:
0000100002000030
Try it for a polynomial! Write its coefficients as a vector and multiply it with this matrix.
Matrix Multiplication
We can combine linear transformations and represent the composition as matrix multiplication. We should first define what a composition of functions formally is.
Definition
2.31
(Composition of linear transformations)
Let T:Rn→Rk and S:Rk→Rm be two linear transformations. The composition S∘T:Rn→Rm is defined by (S∘T)(x)=S(T(x))
Take a close look at the input and output domains. The transformation T gives outputs in the correct domain that S accepts as input. We can further establish that composition of two linear transformations is a linear transformation:
Lemma 2.32. Let T:Rn↦Rk and S:Rk↦Rm be two linear transformations. Then S∘T:Rn↦Rm is another linear transformation.
You can show the linearity axioms for S∘T using (S∘T)(x)=S(T(x)) and the fact that T and S are linear transformations. Since we showed that matrix transformations are equivalent to linear transformations, we can say that the composition of two matrix transformations TA:Rk→Rm, TB:Rn→Rk is another matrix transformation: TA∘TB:Rn→Rm. The matrix corresponding to the composition is the multiplication of matrices A and B.
Lemma
2.33
(Matrix of the composition)
Let A be an m×k matrix and
B=∣x1∣∣x2∣⋯∣xn∣
a k×n matrix. The m×n matrix
C=∣Ax1∣∣Ax2∣⋯∣Axn∣
is the unique matrix that satisfies TC=TA∘TB.
You can read the short proof of this from the lecture notes to better understand why this holds. This actually gives us the first insight in matrix multiplication which we are going to define formally as the following:
Definition
2.34
(Matrix multiplication in column notation)
Let A be an m×k matrix and
B=∣x1∣∣x2∣⋯∣xn∣
a k×n matrix. The m×n matrix
AB:=∣Ax1∣∣Ax2∣⋯∣Axn∣
is the product of A and B.
Now we can go on and define the matrix of the composition TA∘TB as the product of the matrix multiplication: TA∘TB=TAB (See Corollary 2.35 for a more formal version.)
How to multiply matrices?
There are many ways of thinking about the matrix multiplication. All ways of multiplying matrices yield the same result, but depending on the context one or the other might be more intuitive.
Collection of Linear Combinations(Similar to Def 2.34) This is the closest one to the definition. We already know that matrix vector multiplication is actually a compact representation of the linear combination of the columns of the matrix where the coefficients are the elements of the vector. When we multiply a matrix with another matrix, we do a matrix vector multiplication with each column of the matrix on the right side:
Let A be an m×k matrix and
B=∣x1∣∣x2∣⋯∣xn∣
a k×n matrix. The m×n matrix
AB:=∣Ax1∣∣Ax2∣⋯∣Axn∣
includes n different linear combinations of the columns of A.
AB
=
12−1032
2
0
1
−1
1
1
0
2
3
−2
1
0
=
Ax1Ax2Ax3Ax4
=
1
4
0
3
9
−1
2
6
Ax1
= A213
=
2 ·10
+
1 ·23
+
3 ·−12
=
19
Ax2
= A01−2
=
0 ·10
+
1 ·23
+
(−2) ·−12
=
4−1
Ax3
= A101
=
1 ·10
+
0 ·23
+
1 ·−12
=
02
Ax4
= A−120
=
(−1) ·10
+
2 ·23
+
0 ·−12
=
36
Collection of Scalar products(Similar to observation 2.36) We can extend the above way of multiplying matrices as a collection of scalar products. When you multiply the column vector xi with the matrix A, you are actually taking the scalar product of xi with A‘s rows. Hence the entry that sits at i-th row and j-th column of the product is the scalar product of the i-th row of matrix A and the j-th column of matrix B. For the matrix A
A=u1⊤u2⊤⋮um⊤
and the matrix B as above, we can write the product as:
Linear Combination of Rows You can shift the focus to the matrix B and write the matrix product as the linear combination of the rows of matrix B. Calling it a linear combination of the rows is a slight abuse of notation since we have covectors involved. However as everything is matrix multiplication (Section 2.3.4 of the lecture notes) this trick is legal.
AB=u1⊤Bu2⊤B⋮um⊤B
Here, each row is a linear combination of the rows of B. Let B written in row notation be
B=b1⊤b2⊤⋮bk⊤
Then for a vector v∈Rk, v⊤B is nothing else but the sum of the rows of B scaled by the coefficients as the elements of the vector v:
v1⋅v2⋅⋮vk⋅+[b1⊤][b2⊤][bk⊤]v⊤B
Note that this is a slightly different way of viewing the covector-matrix multiplication than it is defined in Definition 2.41
You can only multiply matrices if their dimensions match. The product AB is defined if and only if A has as many columns as B has rows.
(AB)⊤=B⊤A⊤ for two matrices A∈Rm×k and B∈Rk×n. (See formal version at Lemma 2.38)
Let I be the m×m identity matrix. Then IA=A for all m×n matrices, and AI=A for all n×m matrices. (See formal version at Corollary 2.39)
Last but not least matrix multiplication is distributive and associative. You can verify this by keeping track of each entry in the multiplication or thinking of matrices as linear transformations:
Lemma
2.40
Let A,B,C be three matrices. Whenever the respective sums and products in the following are defined, we have
A(B+C)=AB+AC and (A+B)C=AC+BC (distributivity)
(AB)C=A(BC). (associativity)
Image and Kernel
Here are the definitions for Image and Kernel of a matrix (from lecture notes). We are going to examine them closer in a couple of weeks but the keywords might already come up in external sources, assignments and sometimes in the lecture.
Definition
2.25
(Kernel and image)
Let T:Rn→Rm be a linear transformation. The set
Ker(T):={x∈Rn:T(x)=0}⊆Rn
is the kernel of T. The set
Im(T):={T(x):x∈Rn}⊆Rm
is the image of T.
Hints
In Class.
Bonus! No hints.
Try to find out what the matrix transformation does to the unit vectors. One of them is already given. Find T(e2).
This is an if and only if proof so you have to prove both directions. In one direction you prove if T is a linear transformation then vn+1=0 Think about what should hold if T is a linear transformation. In the other direction you should prove if vn+1=0 then T is a linear transformation. Remember how you prove if something is a linear transformation.