Vectors, matrices and norms
Learning Objectives
- Understanding matrix-vector multiplications
- Special matrix types
- How we can “measure” vectors
- How we can “measure” matrices
Vector Spaces
A vector space is a set of vectors and a field (elements of F are called scalars) with the following two operations:
- Vector addition: ,
- Scalar multiplication: ,
which satisfiy the following conditions:
- Associativity (vector): ,
- Zero vector: There exists a vector such that
- Additive inverse (negatives): For every , there exists , such that .
- Associativity (scalar): ,
- Distributivity: ,
- Unitarity: ,
If there exist a set of vectors such that any vector can be written as a linear combination
with uniquely determined scalars , the set is called a basis for . The size of the basis is called the dimension of .
The standard example of a vector space is with . Vectors in are written as an array of numbers:
The dimension of is . The standard basis vectors of are written as
A set of vectors is called linearly independent if the equation in the unknowns , has only the trivial solution . Otherwise the vectors are linearly dependent, and at least one of the vectors can be written as a linear combination of the other vectors in the set. A basis is always linearly independent.
Inner Product
Let be a real vector space. Then, an inner product is a function (i.e., it takes two vectors and returns a real number) which satisfies the following four properties, where and :
- Positivity:
- Definiteness: if and only if
- Symmetric:
- Linearity:
The inner product intuitively represents the similarity between two vectors. Two vectors are said to be orthogonal if .
The standard inner product on is the dot product :
To read more about Inner Product Definition
A function between two vector spaces and is called linear if
- , for any
- , for all and all scalars
is commonly called a linear transformation.
If and are the dimension of and , respectively, then can be represented as an rectangular array or matrix
The numbers in the matrix are determined by the basis vectors for the spaces and . To see how, we first review matrix vector multiplication.
Matrix-vector multiplication
Let be an matrix of real numbers. We can also write as shorthand. If is a vector in then the matrix-vector product is a vector in defined by:
We can interpret matrix-vector multiplications in two ways. Throughout this online textbook reference,
we will use the notation to refer to the column of the matrix
and to refer to the row of the matrix .
1) Writing a matrix-vector multiplication as inner products of the rows :
2) Writing a matrix-vector multiplication as linear combination of the columns of :
It is this representation that allows us to express any linear transformation between finite-dimensional vector spaces with matrices.
Let be the standard basis of . If we define the vector , then using the interpretation of matrix-vector products as linear combinations of the column of , we have that:
where we have written the standard basis of as .
In other words, if is written as a linear combination of the basis vectors of , the element is the coefficient corresponding to .
Example
Let’s try an example. Suppose that is a vector space with basis , and is a vector space with basis . Then and have dimension 3 and 2, respectively. Thus any linear transformation can be represented by a matrix. We can introduce column vector notation, so that vectors and can be written as
We have not specified what the vector spaces and , but it is fine if we treat them like elements of and .
Suppose that the following facts are known about the linear transformation :
This is enough information to completely determine the matrix representation of . The first equation tells us
So we know . The second equation tells us that
So we know . Finally, the third equation tells us
Thus, , and the linear transformation can be represented by the matrix:
It is important to note that the matrix representation not only depends on , but also our choice of basis. If we chose different bases for the vector spaces , the matrix representation of would change as well.
Special Matrices
Zero Matrices
The zero matrix is denoted by and has all entries equal to zero. For example, the zero matrix is
Identity Matrices
The identity matrix is denoted by and has all entries equal to zero except for the diagonal, which is all 1. For example, the identity matrix is
Diagonal Matrices
A diagonal matrix has all entries equal to zero except for the diagonal entries. We typically use for diagonal matrices. For ecample, diagonal matrices have the form:
Triangular Matrices
A lower-triangular matrix is a square matrix that is entirely zero above the diagonal. We typically use for lower-triangular matrices. For example, lower-triangular matrices have the form:
An upper triangular matrix is a square matrix that is entirely zero below the diagonal. We typically use for upper-triangular matrices. For example, upper-triangular matrices have the form:
Properties of triangular matrices:
- An triangular matrix has entries that must be zero, and entries that are allowed to be non-zero.
- Zero matrices, identity matrices, and diagonal matrices are all both lower triangular and upper triangular.
Permutation Matrices
A permuation matrix is a square matrix that is all zero, except for a single entry in each row and each column which is 1. We typically use for permutation matrices. An example of a permutation matrix is
The properties of a permutation matrix are:
- Exactly entries are non-zero.
- Multiplying a vector with a permutation matrix permutes (rearranges) the order of the entries in the vector. For example, using above and , the product is .
- If then .
- The inverse of a permutation matrix is its transpose, so .
A matrix in block form is a matrix partitioned into blocks. A block is simply a submatrix. For example, consider
where , , , and are submatrices.
There are special matrices in block form as well. For instance, a block diagonal matrix is a block matrix whose off-diagonal blocks are zero matrices.
Matrix Rank
The rank of a matrix is the number of linearly independent columns of the matrix. It can also be shown that the matrix has the same number of linearly indendent rows, as well. If matrix, then
- .
- If , then is full rank. Otherwise, is rank deficient.
A square matrix is invertible if there exists a square matrix such that , where is the identity matrix. The matrix is denoted by . A square matrix is invertible if and only if it has full rank. A square matrix that is not invertible is called a singular matrix.
Matrices as operators
Rotation operator
Scale operator
Reflection operator
Translation operator
Vector Norm
A vector norm is a function (i.e., it takes a vector and returns a nonnegative real number) that satisfies the following properties, where and :
- Positivity:
- Definiteness: if and only if
- Homogeneity:
- Triangle inequality:
A norm is a generalization of “absolute value” and measures the “magnitude” of the input vector.
The p-norm
The p-norm is defined as
.
The definition is a valid norm when . If then it is not a valid norm because it violates the triangle inequality.
When (2-norm), this is called the Euclidean norm and it corresponds to the length of the vector.
Vector Norm Examples
Consider the case of , in this part we will show how to calculate the 1, 2, and norm of .
For the 1-norm:
For the 2-norm:
For the -norm:
Norms and Errors
To calculate the error when computing a vector result, you can apply a norm.
Absolute error = ||true value - approximate value||
Relative error = Absolute error / ||true value||
Matrix Norm
A general matrix norm is a real valued function that satisfies the following properties:
- Positivity:
- Definiteness: if and only if
- Homogeneity: for all scalars
- Triangle inequality:
Induced (or operator) matrix norms are associated with a specific vector norm and are defined as:
An induced matrix norm is a particular type of a general matrix norm. Induced matrix norms tell us the maximum amplification of the norm of any vector when multiplied by the matrix. Note that the definition above is equivalent to
In addition to the properties above of general matrix norms, induced matrix norms also satisfy the submultiplicative conditions:
Frobenius norm
The Frobenius norm is simply the sum of every element of the matrix squared, which is equivalent to applying the vector -norm to the flattened matrix,
The Frobenius norm is an example of a general matrix norm that is not an induced norm.
The matrix p-norm
The matrix p-norm is induced by the p-norm of a vector. It is . There are three special cases:
For the 1-norm, this reduces to the maximum absolute column sum of the matrix, i.e.,
For the 2-norm, this reduces the maximum singular value of the matrix.
For the -norm this reduces to the maximum absolute row sum of the matrix.
Matrix Norm Examples
Now we will go through a few examples with a matrix , defined below.
For the 1-norm:
For the 2-norm:
The singular values are the square roots of the eigenvalues of the matrix . You can also find the maximum singular values by calculating the Singular Value Decomposition of the matrix.
For the -norm:
Review Questions
ChangeLog