Tutorial 5. Linear dependence, bases in Fn, and matrix operations

Linear Algebra for Biomedical Engineering · Chen Gadi

Sections and exercises
  1. 5.1 Dependence and bases in Fᵐ
  2. 5.2 Linear dependence and independence
  3. 5.3 Matrix arithmetic
  4. 5.4 Diagonal matrices
  5. 5.5 Transpose
  6. 5.6 Symmetry and skew-symmetry
  7. 5.7 Further exercises on matrix multiplication

Exercises
5.1 · 5.2 · 5.3 · 5.4 · 5.5 · 5.6 · 5.7 · 5.8 · 5.9 · 5.10 · 5.11 · 5.12 · 5.13 · 5.14 · 5.15 · 5.16 · 5.17 · 5.18 · 5.19 · 5.20 · 5.21

5.1 Dependence and bases in Fm

Definition 5.1

The list v1,…,vk∈Fm is linearly independent if

α1v1+⋯+αkvk=0⟹α1=⋯=αk=0.

A list is dependent if some relation has coefficients not all zero. A basis of Fm is an independent spanning list. The column ej has entry 1 in position j and zero elsewhere. The list (e1,…,em) is the standard basis.

(x1,…,xm)T=∑j=1mxjej.

Each component determines its coefficient.

Proposition 5.1

A list is a basis if and only if every vector has a unique representation as a linear combination of its entries. Spanning gives existence. Subtracting any two representations and using independence gives uniqueness. Conversely, existence gives spanning, and uniqueness for the zero vector gives independence.

Notation and conventions

In a collection of columns or matrices closed under addition and scalar multiplication, a basis is an independent spanning list. Its dimension is the number of elements in a basis. In particular dimFm=m and dimMm×n(F)=mn. The abstract definition of a vector space appears in Tutorial 8.

For a field F, the set Mm×n(F) consists of matrices with m rows, n columns and entries in F. We write Mn(F) for square matrices of order n. Entry Aij is in row i, column j. The column ej∈Fn is the standard column defined above. The trace of a square matrix is trA=∑i=1nAii. The identity matrix In has diagonal entries 1 and zeros elsewhere. Every entry in the zero matrix is zero.

5.2 Linear dependence and independence

Example 5.1

Over F, the family with columns (1,0,−3)T,(1,0,0)T,(0,0,1)T is dependent.

1(1,0,−3)T−1(1,0,0)T+3(0,0,1)T=0.

Rearranging gives (1,0,−3)T=(1,0,0)T−3(0,0,1)T.

How do we test dependence?

Set a linear combination equal to zero. Its coefficients are the unknowns of a homogeneous system. Form the coefficient matrix and row-reduce. If the only solution is zero, the list is independent. A nonzero solution gives dependence and, over an infinite field, infinitely many solutions. The zero solution always exists, so an inconsistent row cannot appear.

Exercise 5.1

Work over ℝ. Let v1=(1,−1,0)T, v2=(0,1,1)T, v3=(2,−3,−1)T. Determine dependence, find all dependence relations, and express one vector using the others.

Worked solution

The equation av1+bv2+cv3=0 gives a+2c=0, −a+b−3c=0, b−c=0. Thus a=−2c, b=c; the remaining equation is 2c+c−3c=0.

(a,b,c)=t(−2,1,1),t∈ℝ.

In particular −2v1+v2+v3=0, so v3=2v1−v2 gives dependence. In av1+bv2=0 the first and third coordinates force a=b=0, so those two vectors are independent.

And we’re done. Victory!

5.2.1 Useful criteria for dependence

  1. Any list containing the zero vector is dependent.

  2. A singleton consisting of a nonzero vector is independent.

  3. Place the vectors in columns and solve the homogeneous system as above. Alternatively, place the vectors in rows and reduce to echelon form. The original rows are dependent exactly when the echelon form has a zero row.

5.2.2 Spanning sets

Figure 5.1. Geometric span. On the left, v1=(1,2)T, v2=(−2,2)T are independent: a−2b=0 and 2a+2b=0 imply a=b=0. The vectors span the plane. On the right, v1=(1,1)T, v2=(2,2)T=2v1 span only the line y=x through the origin.

Exercise 5.2 · Foundation

Let u=(1,2,0)T, v=(0,1,1)T over ℝ. Describe U=span{u,v} by an equation. Decide whether (2,7,3)T and (2,6,3)T belong to U, finding coefficients where possible. Are u,v independent?

Worked solution

For a,b∈ℝ, au+bv=(a,2a+b,b)T. Every such vector satisfies y=2x+z. Conversely, if that equation holds, (x,y,z)T=xu+zv. Hence

U={(x,y,z)T:y=2x+z}.

Since 7=2⋅2+3, the first vector is 2u+3v. Since 6≠2⋅2+3, the second is outside the span. If au+bv=0, the first and third coordinates give a=b=0. The vectors are independent and the coefficients are unique.

Give me a V! Give me an I! Give me a C! Victory!

Exercise 5.3

Determine whether the following vectors form a basis of ℂ3. If they do not, give a dependence relation.

v1=(1,0,i)T,v2=(1+i,1,0)T,v3=(2+i,1−i,−1)T.

Worked solution

In av1+bv2=0 the second coordinate gives b=0 and the first then gives a=0. The first two are independent.

iv1+(1−i)v2=(i+(1−i)(1+i),1−i,i2)T=(2+i,1−i,−1)T=v3.

Thus iv1+(1−i)v2−v3=0 is a nontrivial relation, the rank is 2, and the triple is not a basis.

Another one down. Victory!

Exercise 5.4

Do the following vectors form a basis of ℂ3? If not, give a dependence relation.

v1=(1,0,i)T,v2=(1−i,1,0)T,v3=(2+2i,i,−1+i)T.

Worked solution

In av1+bv2=0 the second and first coordinates give b=0 and a=0. But

(1+i)v1+iv2=(1+i+i(1−i),i,(1+i)i)T=(2+2i,i,−1+i)T=v3.

The first pair is independent and (1+i)v1+iv2−v3=0 is a nontrivial relation. The rank is 2 and these vectors are not a basis.

The trophy is ours. Victory!

Exercise 5.5

Let {u,v,w} be a basis of ℝ3. Determine which of the following are bases.

  1. {u,u+v,u−v}.

  2. {2u,−v,3w}.

  3. {u+v+w,u+2v,v−w}.

Worked solution

Each family has three vectors in dimension 3, so it suffices to check independence.

  1. No. −2u+(u+v)+(u−v)=0 is a nontrivial relation.

  2. Yes. If a(2u)+b(−v)+c(3w)=0, the original basis gives 2a=−b=3c=0, so a=b=c=0.

  3. No. (u+v+w)−(u+2v)+(v−w)=0 is a nontrivial relation.

That does it. Victory!

5.3 Matrix arithmetic

Throughout this section take

A=(1−165),B=(2223).

5.3.1 Scalar multiplication

Multiply every entry by the scalar: (λA)ij=λAij. This works for any matrix.

Example 5.2

−9A=((−9)1(−9)(−1)(−9)6(−9)5)=(−99−54−45).

5.3.2 Matrix addition and subtraction

The matrices must have identical shapes. Add or subtract matching entries: (A±B)ij=Aij±Bij.

Example 5.3

A+B=(1+2−1+26+25+3)=(3188).

5.3.3 Matrix multiplication

The number of columns in the left matrix must equal the number of rows in the right matrix. If A is k×m and B is m×n, then AB is k×n and

(AB)ij=∑r=1mairbrj=ai1b1j+ai2b2j+⋯+aimbmj.

Pair the m entries of row i of A with the corresponding entries of column j of B, multiply and add. Even when AB exists, BA exists only if n=k.

Exercise 5.6

Compute AB and BA for the matrices above.

Worked solution

AB=(1⋅2+(−1)⋅21⋅2+(−1)⋅36⋅2+5⋅26⋅2+5⋅3)=(0−12227).
BA=(2⋅1+2⋅62⋅(−1)+2⋅52⋅1+3⋅62⋅(−1)+3⋅5)=(1482013).

Each entry is the sum of matching row-column products. Reversing the order changes the answer: AB≠BA. Matrix multiplication need not commute, even if both products exist.

Linear algebra wins again!

Exercise 5.7

Let A be k×m with a zero row, and B be m×n. Prove that AB has a zero row.

Worked solution

Let i be the index of the zero row, 1≤i≤k. Then air=0 for every 1≤r≤m. For every 1≤j≤n,

(AB)ij=∑r=1mairbrj=∑r=1m0=0.

The entire row i of AB is zero. A zero matrix can have any specified shape.

All wrapped up. Victory!

5.4 Diagonal matrices

A diagonal matrix is square, with all off-diagonal entries zero: D=diag(d1,…,dn), where Dii=di and Dij=0 for i≠j. A scalar matrix has a common diagonal entry a, so it is aI. The identity In is a scalar matrix with diagonal entries 1. For every n×m matrix A, AIm=InA=A.

Example 5.4

I2A=(1001)(1−165)=(1−165).
AI2=(1−165)(1001)=(1−165).

Exercise 5.8

Let A,B be diagonal matrices of order n. Prove:

  1. A+B is diagonal.

  2. AB is diagonal and (AB)ii=aiibii for every 1≤i≤n.

  3. AB=BA.

Worked solution

  1. For i≠j, (A+B)ij=aij+bij=0+0=0. On the diagonal (A+B)ii=aii+bii.

  2. (AB)ij=∑k=1naikbkj=aiibij, because the only possibly nonzero entry in row i of A is aii. When i≠j, bij=0; when i=j, the product entry is aiibii.

  3. Likewise BA is diagonal with entries biiaii=aiibii because field multiplication commutes. All entries agree, so AB=BA.

The crowd goes wild. Victory!

Always check dimensions: Ak×mBm×n has k rows and n columns. Equal matrices must agree both in shape and in each corresponding entry.

Figure 5.2. A negative shear takes a straight grid to a straight grid and the unit square to a parallelogram. For S=(1−301), the columns are Se1=(1,0)T and Se2=(−3,1)T.

5.5 Transpose

Transposition interchanges rows and columns, and is defined for every matrix: (AT)ij=Aji. If A∈ℝm×n then AT∈ℝn×m.

Example 5.5

C=(12−203−1)∈ℝ3×2,CT=(1−2320−1)∈ℝ2×3.

The rows of C are the columns of CT.

5.6 Symmetry and skew-symmetry

A square matrix is symmetric if AT=A, and skew-symmetric if AT=−A. All diagonal matrices, including scalar matrices and the identity, are symmetric. The square condition is necessary: a matrix of shape m×n and its transpose of shape n×m have equal dimensions only if m=n. Symmetry reflects entries across the main diagonal; skew-symmetry also changes their signs.

Exercise 5.9

Over ℝ, classify each matrix as symmetric, skew-symmetric, or neither.

A=(7442),B=(0−330),C=(05−12).

Worked solution

AT=(7442)=A,BT=(03−30)=−B.
CT=(0−152)≠C,CT≠−C.

Thus A is symmetric, B is skew-symmetric, and C is neither.

Think. Prove. Win!

Exercise 5.10

Over ℝ, prove or disprove each statement.

  1. If A,B are symmetric, then AB is symmetric.

  2. If both A,B are nonsymmetric, then AB is nonsymmetric.

Worked solution

  1. False. (AB)T=BTAT=BA, which need not equal AB. Both factors below are symmetric and their product is not.
A=(4556),B=(7−6−65),AB=(−21−10).
  1. False. Take A=B=(21−7−2). Neither is symmetric, but their product is symmetric:
AB=(2⋅2+1⋅(−7)2⋅1+1⋅(−2)(−7)⋅2+(−2)⋅(−7)(−7)⋅1+(−2)⋅(−2))=−3I2.

Another one in the bag. Victory!

Exercise 5.11

Let A∈Mn(F) with char(F)≠2. Prove that A+AT is symmetric, that A−AT is skew-symmetric, and that A can be written as a sum of one matrix of each type.

Worked solution

  1. (A+AT)T=AT+(AT)T=AT+A=A+AT.

  2. (A−AT)T=AT−A=−(A−AT).

  3. Adding gives 2A=(A+AT)+(A−AT). Since 2 is invertible in F,

A=12(A+AT)+12(A−AT).

The first term is symmetric and the second is skew-symmetric.

V-I-C-T-O-R-Y!

Exercise 5.12

Over ℝ, take D=(3001), H=(1−201). Compute DH,HD entry by entry. Compare their action on e2 and find all v such that DHv=HDv.

Worked solution

DH=(3⋅1+0⋅03(−2)+0⋅10⋅1+1⋅00(−2)+1⋅1)=(3−601).
HD=(1⋅3+(−2)01⋅0+(−2)10⋅3+1⋅00⋅0+1⋅1)=(3−201).

Thus DHe2=(−6,1)T, whereas HDe2=(−2,1)T. For v=(x,y)T,

DHv−HDv=(3x−6y−(3x−2y),y−y)T=(−4y,0)T.

They agree exactly when y=0, on span{e1}.

Came to prove. Left with a win!

Figure 5.3. Order of operations. For DH, first He2=(−2,1)T, then DHe2=(−6,1)T. For HD, the ring marks the fixed point De2=e2; then HDe2=(−2,1)T. The difference on (x,y)T is (−4y,0)T.

5.7 Further exercises on matrix multiplication

Exercise 5.13

Let F be a field. For a row r=(r1,…,rn) and a column c=(c1,…,cn)T, define

F(r,c)=∑k=1nrkck∈F.
  1. Compute AB using F for the matrices below. For x=(2,−1)T, compute (AB)x and A(Bx).
A=(1−12021),B=(20−131−2).

For the remaining parts let A∈Mm×n(F) and B∈Mn×p(F). Denote row i of A by ri and column j of B by cj.

  1. Prove (AB)ij=F(ri,cj).

  2. Prove (AB)x=A(Bx) for all x∈Fp by expanding the finite sums.

  3. Prove that column j of AB equals a linear combination of the columns of A, with the entries of column j of B as coefficients.

  4. Write a(1),…,a(n) for the columns of A and b(1),…,b(n) for the rows of B. Prove AB=∑k=1na(k)b(k). A column u times a row v has (i,j) entry uivj.

Worked solution

  1. The four row-column sums are
F(r1,c1)=1⋅2+(−1)(−1)+2⋅1=5,
F(r1,c2)=1⋅0+(−1)3+2(−2)=−7,
F(r2,c1)=0⋅2+2(−1)+1⋅1=−1,
F(r2,c2)=0⋅0+2⋅3+1(−2)=4.
AB=(5−7−14),(AB)x=(17,−6)T.
Bx=(4,−5,4)T,A(Bx)=(4+5+8,−10+4)T=(17,−6)T.
  1. By definition (AB)ij=∑k=1naikbkj=ai1b1j+⋯+ainbnj. The entries of ri are ai1,…,ain and the entries of cj are b1j,…,bnj, so this is F(ri,cj). The row times the column is a 1×1 matrix whose only entry is that scalar.

  2. Fix i. Distributivity and rearranging two finite sums give

((AB)x)i=∑j=1p(AB)ijxj=∑j=1p∑k=1naikbkjxj.
∑k=1naik(∑j=1pbkjxj)=∑k=1naik(Bx)k=(A(Bx))i.

The two columns have m entries and agree in each one.

  1. The ith entry of column j of AB is ∑kaikbkj. It is also entry i of b1ja(1)+⋯+bnja(n). Hence the columns agree.

  2. Each a(k)b(k) has shape m×p and entry (i,j) equal to aikbkj. Thus

(∑k=1na(k)b(k))ij=∑k=1naikbkj=(AB)ij.

This gives the product by entries, by linear combinations of columns, and by a sum of column-row products. The factor order also determines the dimensions.

Give yourselves a hand. Victory!

Exercise 5.14

Let A,B∈Mn(ℝ) have nonnegative entries and each row of each matrix sum to 1. Prove that AB has the same properties. If n≥2 and every entry of A is positive, prove that AB=In is impossible.

Worked solution

  1. Each (AB)ij=∑kaikbkj is a sum of nonnegative terms. Interchange the finite sums and use the row sums first of B, then of A:
∑j=1n(AB)ij=∑j=1n∑k=1naikbkj=∑k=1naik(∑j=1nbkj)=∑k=1naik=1.
  1. Suppose AB=In. For each column j, pick i≠j (possible since n≥2). Then 0=(AB)ij=∑k=1naikbkj. All terms are nonnegative, so each vanishes. Each aik>0, hence bkj=0 for all k. This holds in every column, forcing B=0, contrary to its row sums being 1.

Yesss! Victory!

Associativity

For any matrix D of compatible dimensions, write dj for its columns. Exercise 5.13 gives (AB)dj=A(Bdj). These are the corresponding columns, so (AB)D=A(BD).

Exercise 5.15

Let A∈Mm×n(F), B∈Mn×m(F) satisfy AB=Im. Put C=In−BA. Prove C2=C, AC=0, CB=0. For m=1,n=2, find an example where BA≠I2 and compute C.

Worked solution

  1. All dimensions agree. Associativity gives (BA)2=B(AB)A=BImA=BA. Therefore
C2=(In−BA)2=In−BA−BA+(BA)2=In−BA=C.
AC=A−ABA=A−ImA=0,CB=B−BAB=B−BIm=0.
  1. Take A=(1,1) and B=(1,0)T. Then
AB=(1⋅1+1⋅0)=(1)=I1,BA=(1⋅11⋅10⋅10⋅1)=(1100)≠I2.
C=(1001)−(1100)=(0−101).

Direct multiplication gives C2=C, AC=(0,0) and CB=(0,0)T.

Victory!

Additional practice

Exercise 5.16 · Foundation

A=(02−1−110),B=(1−13130).

Determine the dimensions of AB,BA and compute both. Verify (AB)e1=A(Be1) for e1∈ℝ2. Can AB=BA?

Worked solution

The shapes are 2×2 and 3×3, respectively.

AB=(0⋅1+2⋅3+(−1)30(−1)+2⋅1+(−1)0(−1)1+1⋅3+0⋅3(−1)(−1)+1⋅1+0⋅0)=(3222).
BA=(1⋅0+(−1)(−1)1⋅2+(−1)11(−1)+(−1)03⋅0+1(−1)3⋅2+1⋅13(−1)+1⋅03⋅0+0(−1)3⋅2+0⋅13(−1)+0⋅0).
BA=(11−1−17−306−3).

We have Be1=(1,3,3)T and A(Be1)=(3,2)T, the first column of AB, hence also (AB)e1. The two products cannot be equal since their dimensions differ.

We came, we saw, we conquered!

Exercise 5.17 · Challenge

Let n≥2, A∈Mn(F) over any field. Prove the following equivalences. You may use Eij, the matrix with 1 at (i,j) and 0 elsewhere.

  1. A commutes with every diagonal matrix if and only if A is diagonal.

  2. A commutes with every matrix in Mn(F) if and only if A=λIn for some λ∈F.

Worked solution

  1. Take AEkk=EkkA. At entry (i,k) with i≠k, the left side is aik and the right side is zero. Thus all off-diagonal entries of A vanish. Conversely, any two diagonal matrices commute because each diagonal entry of their product is a product of commuting scalars.

  2. By part 1, A=diag(λ1,…,λn). For i≠j, AEij=λiEij and EijA=λjEij. Comparing entry (i,j) gives λi=λj, so A=λIn. Conversely, (λIn)B=λB=B(λIn) for every B. The proof uses 0, 1 and field multiplication and applies to finite fields too.

And we’re done. Victory!

Matrix units

For 1≤i≤m, 1≤j≤n, the matrix unit Eij∈Mm×n(F) has 1 at (i,j) and zeros elsewhere. A matrix A=(aij) has the unique representation

A=∑i=1m∑j=1naijEij.

Addition and scalar multiplication act entry by entry, as for columns in Fmn.

Exercise 5.18

Over ℝ, is A in the span of B1,B2?

A=(1324),B1=(1200),B2=(0012).

Worked solution

aB1+bB2=(a2ab2b),a,b∈ℝ.

Equality with A would require both a=1 and 2a=3, giving a=3/2. This contradiction excludes membership in the span. Choosing b=2 matches only the second row.

Give me a V! Give me an I! Give me a C! Victory!

Exercise 5.19

Over ℝ, let A=(1100). Characterize all matrices B with AB=BA and prove they are exactly the linear combinations of A and I2−A.

Worked solution

B=(abcd),AB=(a+cb+d00),BA=(aacc).

The entries agree exactly when c=0 and b=a−d. Thus

B=(aa−d0d)=aA+d(I2−A).

Conversely, substitution in both products verifies that each such B commutes with A.

Another one down. Victory!

Exercise 5.20

Work in M3(ℝ). The matrix unit Eij has a single 1 at (i,j). Define

Di=Eii(1≤i≤3),Sij=Eij+Eji,Kij=Eij−Eji(1≤i<j≤3).
Bs={D1,D2,D3,S12,S13,S23},Ba={K12,K13,K23}.

Prove that Bs is a basis of the symmetric matrices, Ba is a basis of the skew-symmetric matrices, and their union is a basis of M3(ℝ). Find the three dimensions.

Worked solution

We have DiT=Di, SijT=Sij and KijT=−Kij. Every symmetric A=(aij) has the representation

A=∑i=13aiiDi+∑1≤i<j≤3aijSij.

The diagonal and upper-diagonal entries uniquely determine the coefficients. Thus the family spans and is independent, and contains 3+3=6 matrices. For skew-symmetric A the diagonal is zero and aji=−aij, giving

A=∑1≤i<j≤3aijKij.

The entries above the diagonal uniquely determine these coefficients, so Ba is a basis of size 3. Any A∈M3(ℝ) can be written as

A=A+AT2+A−AT2.

The summands are symmetric and skew-symmetric, respectively. Thus the union spans the full space. Its two subspaces meet only at zero: AT=A=−A implies 2A=0, hence A=0. A zero combination of the union splits into a zero combination in each basis, so every coefficient vanishes. The union is therefore a basis, and

dimSym3(ℝ)=6,dimASym3(ℝ)=3,dimM3(ℝ)=9=6+3.

The trophy is ours. Victory!

Exercise 5.21 · Challenge

For n≥1 take a1,…,an+2∈ℝn. For a nonempty index set I, define its associated convex hull by

conv{ai:i∈I}={∑i∈Iλiai:λi≥0,∑i∈Iλi=1}.

Prove that the indices can be partitioned into two nonempty sets I,J whose convex hulls intersect.

Worked solution

Consider real coefficients α1,…,αn+2 satisfying

∑i=1n+2αiai=0,∑i=1n+2αi=0.

This homogeneous system has n+1 equations in n+2 unknowns, so there is a nonzero solution. The coefficients sum to zero; at least one must be positive and one negative. Define

I={i:αi≥0},J={j:αj<0},s=∑i∈Iαi=−∑j∈Jαj>0.

The sets are nonempty and partition all indices. The vector equation gives

∑i∈Iαisai=∑j∈J−αjsaj.

On each side the coefficients are nonnegative and sum to 1, so the common point lies in both convex hulls.

That does it. Victory!