Vectors, matrices and norms


Learning Objectives

Vector Spaces

A vector space is a set V of vectors and a field F (elements of F are called scalars) with the following two operations:

  1. Vector addition: v,wV, v+wV
  2. Scalar multiplication: αF,vV, αvV

which satisfiy the following conditions:

  1. Associativity (vector): u,v,wV, (u+v)+w=u+(v+w)
  2. Zero vector: There exists a vector 0V such that uV,0+u=u
  3. Additive inverse (negatives): For every uV, there exists uV, such that u+u=0.
  4. Associativity (scalar): α,βF,uV, (αβ)u=α(βu)
  5. Distributivity: α,βF,uV, (α+β)u=αu+βu
  6. Unitarity: uV, 1u=u

If there exist a set of vectors v1,v2,vn such that any vector xV can be written as a linear combination

x=c1v1+c2v2++cnvn

with uniquely determined scalars c1,,cn, the set v1,,vn is called a basis for V. The size of the basis n is called the dimension of V.

The standard example of a vector space is V=Rn with F=R. Vectors in Rn are written as an array of numbers:

x=[x1x2xn]=[x1x2xn]T

The dimension of Rn is n. The standard basis vectors of Rn are written as

e1=[100]e2=[010] en=[001].

A set of vectors v1,,vk is called linearly independent if the equation α1v1+α2v2++αkvk=0 in the unknowns α1,,αk, has only the trivial solution α1=α2==αk=0. 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 V be a real vector space. Then, an inner product is a function ,:V×VR (i.e., it takes two vectors and returns a real number) which satisfies the following four properties, where u,v,wV and α,βR:

  1. Positivity: u,u0
  2. Definiteness: u,u=0 if and only if u=0
  3. Symmetric: u,v=v,u
  4. Linearity: αu+βv,w=αu,w+βv,w

The inner product intuitively represents the similarity between two vectors. Two vectors u,vV are said to be orthogonal if u,v=0.

The standard inner product on Rn is the dot product :x,y=xTy=i=1nxiyi.

To read more about Inner Product Definition

Linear Transformations and Matrices

A function f:VW between two vector spaces V and W is called linear if

  1. f(u+v)=f(u)+f(v), for any u,vV
  2. f(cv)=cf(v), for all vV and all scalars c

f is commonly called a linear transformation.

If n and m are the dimension of V and W, respectively, then f can be represented as an m×n rectangular array or matrix

A=[a11a12a1na21a22a2nam1am2amn].

The numbers in the matrix A are determined by the basis vectors for the spaces V and W. To see how, we first review matrix vector multiplication.

Matrix-vector multiplication

Let A be an m×n matrix of real numbers. We can also write ARm×n as shorthand. If x is a vector in Rn then the matrix-vector product Ax=b is a vector in Rm defined by:

bi=j=1naijxjfor i=1,2,,m.

We can interpret matrix-vector multiplications in two ways. Throughout this online textbook reference, we will use the notation ai to refer to the ith column of the matrix A and aiT to refer to the ith row of the matrix A.

1) Writing a matrix-vector multiplication as inner products of the rows A:

Ax=[a1Txa2TxamTx]

2) Writing a matrix-vector multiplication as linear combination of the columns of A:

Ax=x1a1+x2a2+xnan=x1[a11a21am1]+x2[a12a22am2]++xn[a1na2namn]

It is this representation that allows us to express any linear transformation between finite-dimensional vector spaces with matrices.

Matrix Representation of Linear Transformations

Let e1,e2,,en be the standard basis of Rn. If we define the vector zj=Aej, then using the interpretation of matrix-vector products as linear combinations of the column of A, we have that:

zj=Aej=[a1ja2jamj]=a1j[100]+a2j[010]++amj[001]=i=1maije^i,

where we have written the standard basis of Rm as e^1,e^2,,e^m.

In other words, if zj=Aej is written as a linear combination of the basis vectors of Rm, the element aij is the coefficient corresponding to e^i.

Example

Let’s try an example. Suppose that V is a vector space with basis v1,v2,v3, and W is a vector space with basis w1,w2. Then V and W have dimension 3 and 2, respectively. Thus any linear transformation f:VW can be represented by a 2×3 matrix. We can introduce column vector notation, so that vectors v=α1v1+α2v2+α3v3 and w=β1w1+β2w2 can be written as

v=[α1α2α3],w=[β1β2].

We have not specified what the vector spaces V and W, but it is fine if we treat them like elements of R3 and R2.

Suppose that the following facts are known about the linear transformation f:

This is enough information to completely determine the matrix representation of f. The first equation tells us

w1=f(v1)[10]=[a11a12a13a21a22a23][100]=[a11a21].

So we know a11=1, a21=0. The second equation tells us that

5w1w2=f(v2)[51]=[1a12a130a22a23][010]=[a12a22].

So we know a12=5, a22=1. Finally, the third equation tells us

2w1+2w2=f(v2)[22]=[15a1301a23][001]=[a13a23].

Thus, a13=2, a23=2, and the linear transformation f can be represented by the matrix:

[152012].

It is important to note that the matrix representation not only depends on f, but also our choice of basis. If we chose different bases for the vector spaces V and W, the matrix representation of f would change as well.

Special Matrices

Zero Matrices

The m×n zero matrix is denoted by 0mn and has all entries equal to zero. For example, the 3×4 zero matrix is

034=[000000000000].

Identity Matrices

The n×n identity matrix is denoted by In and has all entries equal to zero except for the diagonal, which is all 1. For example, the 4×4 identity matrix is

I4=[1000010000100001].

Diagonal Matrices

A n×n diagonal matrix has all entries equal to zero except for the diagonal entries. We typically use D for diagonal matrices. For ecample, 4×4 diagonal matrices have the form:

[d110000d220000d330000d44].

Triangular Matrices

A lower-triangular matrix is a square matrix that is entirely zero above the diagonal. We typically use L for lower-triangular matrices. For example, 4×4 lower-triangular matrices have the form:

L=[11000212200313233041424344].

An upper triangular matrix is a square matrix that is entirely zero below the diagonal. We typically use U for upper-triangular matrices. For example, 4×4 upper-triangular matrices have the form:

U=[u11u12u13u140u22u23u2400u33u34000u44].

Properties of triangular matrices:

  1. An n×n triangular matrix has n(n1)/2 entries that must be zero, and n(n+1)/2 entries that are allowed to be non-zero.
  2. 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 P for permutation matrices. An example of a 4×4 permutation matrix is

P=[0100000110000010].

The properties of a permutation matrix are:

  1. Exactly n entries are non-zero.
  2. Multiplying a vector with a permutation matrix permutes (rearranges) the order of the entries in the vector. For example, using P above and x=[1,2,3,4]T, the product is Px=[2,4,1,3]T.
  3. If Pij=1 then (Px)i=xj.
  4. The inverse of a permutation matrix is its transpose, so PPT=PTP=I.

Matrices in Block Form

A matrix in block form is a matrix partitioned into blocks. A block is simply a submatrix. For example, consider

M=[ABCD]

where A, B, C, and D 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 A is an m×n matrix, then

  1. rank(A)min(m,n).
  2. If rank(A)=min(m,n), then A is full rank. Otherwise, A is rank deficient.

A square n×n matrix A is invertible if there exists a square matrix B such that AB=BA=I, where I is the n×n identity matrix. The matrix B is denoted by A1. 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

(y1y2)=[cos(θ)sin(θ)sin(θ)cos(θ)](x1x2)

Scale operator

(y1y2)=[a00b](x1x2)

Reflection operator

(y1y2)=[a00b](x1x2)

Translation operator

(y1y2)=[1001](x1x2)+(ab)

Vector Norm

A vector norm is a function u:VR0+ (i.e., it takes a vector and returns a nonnegative real number) that satisfies the following properties, where u,vV and αR:

  1. Positivity: u0
  2. Definiteness: u=0 if and only if u=0
  3. Homogeneity: αu=|α|u
  4. Triangle inequality: u+vu+v

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

wp=(i=1N|wi|p)1p.

The definition is a valid norm when p1. If 0p<1 then it is not a valid norm because it violates the triangle inequality.

When p=2 (2-norm), this is called the Euclidean norm and it corresponds to the length of the vector.

Vector Norm Examples

Consider the case of w=[3,5,0,1], in this part we will show how to calculate the 1, 2, and norm of w.

For the 1-norm:

w1=(i=1N|wi|1)11 w1=i=1N|wi| w1=|3|+|5|+|0|+|1| w1=3+5+0+1 w1=9

For the 2-norm:

w2=(i=1N|wi|2)12 w2=i=1Nwi2 w2=(3)2+(5)2+(0)2+(1)2 w2=9+25+0+1 w2=355.92

For the -norm:

w=limp(i=1N|wi|p)1p w=maxi=1,,N|wi| w=max(|3|,|5|,|0|,|1|) w=max(3,5,0,1) w=5

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 A that satisfies the following properties:

  1. Positivity: A0
  2. Definiteness: A=0 if and only if A=0
  3. Homogeneity: λA=|λ|A for all scalars λ
  4. Triangle inequality: A+BA+B

Induced (or operator) matrix norms are associated with a specific vector norm and are defined as:

A:=maxx=1Ax.

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

A=maxx0Axx.

In addition to the properties above of general matrix norms, induced matrix norms also satisfy the submultiplicative conditions:

AxAx ABAB

Frobenius norm

The Frobenius norm is simply the sum of every element of the matrix squared, which is equivalent to applying the vector 2-norm to the flattened matrix,

AF=i,jaij2.

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 Ap:=maxxp=1Axp. There are three special cases:

For the 1-norm, this reduces to the maximum absolute column sum of the matrix, i.e.,

A1=maxji=1n|aij|.

For the 2-norm, this reduces the maximum singular value of the matrix.

A2=maxkσk

For the -norm this reduces to the maximum absolute row sum of the matrix.

A=maxij=1n|aij|.

Matrix Norm Examples

Now we will go through a few examples with a matrix C, defined below.

C=[3213]

For the 1-norm:

C1=maxx1=1Cx1 C1=max1j3i=13|Cij| C1=max(|3|+|1|,|2|+|3|) C1=max(4,5) C1=5

For the 2-norm:

The singular values are the square roots of the eigenvalues of the matrix CTC. You can also find the maximum singular values by calculating the Singular Value Decomposition of the matrix.

C2=maxx2=1Cx2 det(CTCλI)=0 det([3123][3213]λI)=0 det([9+163364+9]λI)=0 det([10λ9913λ])=0 (10λ)(13λ)81=0 λ223λ+13081=0 λ223λ+49=0 (λ12(23+337))(λ12(23337))=0 C2=λmax=12(23+337)4.54

For the -norm:

C=maxx=1Cx C=max1i3j=13|Cij| C=max(|3|+|2|,|1|+|3|) C=max(5,4) C=5

Review Questions

ChangeLog