Problem 3.1: Define
A=
1 2 3 1 2 1
B=
−1 2 −3 1 −2 1
C= [ 2 −2 0 ]D=
2 −11
2
Compute all products of two of these (i.e.,AB,AC, etc.) that are defined.
Answer:
AB =
−13 7 −9 5
BA=
1 2 −1 −2 −4 −8 −1 −2 −5
AD=
−14 −18
CB= [ 4 2 ] CD= [ 26 ]
DC=
4 −4 0 −22 22 0 4 −4 0
AC,CA,DA,BC,BD andDB are not defined. Problem 3.2: ComputeA2
=AA andA3
=AAAfor
A=
0 a b 0 0 c 0 0 0
and
A=
1 0 a 0 1 0 0 0 1
Answer: If
A=
0 a b 0 0 c 0 0 0
then
A2=
0 0 ac 0 0 0 0 0 0
A3
=
0 0 0 0 0 0 0 0 0
If
A=
1 0 a 0 1 0 0 0 1
then
A2
=
1 0 2a 0 1 0 0 0 1
A3=
1 0 3a 0 1 0 0 0 1
Problem 3.3: Let
A=
1 1 0 1
a) FindA2
,A3
andA4
.
b) Find Ak for all positive integersk.
c) FindetA (part of the problem is to invent a reasonable definition!)
d) Find a square root ofA(i.e., a matrixB withB2
=A). e) Find all square roots of A.
Answer: a,b)Ak =
1 k 0 1
c) Use the power series formula
ex= 1 +x+x
2
2 + x3
3! +· · ·
and substitute in the matrixtAfor each occurence ofx. Substitute the identiy matrix for 1. This gives
etA =
1 0 0 1
+t
1 1 0 1
+t
2
2
1 2 0 1
+. . .
=
1 +t+t2
2 + t3
3! +· · · t+ 2 t2
2 + 3 t3
3! +· · ·
0 1 +t+t2
2 + t3
3! +· · ·
=
1 +t+t2 2 +
t3
3! +· · · t+t 2
+t3 2! +· · ·
0 1 +t+t2
2 + t3
3! +· · ·
=
et tet
0 et
d,e) We are looking for all matrices that satisfyB2
=A. LetB=
a b c d
. ThenB2
=
a2
+bc ab+bd ca+dc bc+d2
so we need to satisfy the equations
a2+bc= 1 ab+bd= 1 ca+dc= 0 bc+d2= 1
The third equation saysc(a+d) = 0 so eitherc= 0 ora+d= 0. Buta+d= 0 would contradict the second equations, so we must havec= 0. So
a2
= 1 b(a+d) = 1 d2= 1
Soa=±1 andd=±1. Ifa= 1 then to satisfy the second equation we must haved= 1 andb= 1/2. If If a=−1 then to satisfy the second equation we must haved=−1 andb=−1/2. Thus the two square roots are
1 1/2 0 1
and
−1 −1/2 0 −1
. In general, a matrix may have more than two square roots. Problem 3.4: ComputeAk fork= 2,3,4 when
A=
0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
Answer:
A=
0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
A2
=
0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
A3=
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
A4=A5=
· · ·= 0
Problem 3.5: Letabe a fixed vector. Show that the transformationT(x) =x+ais not a linear transformation.
Answer: T(x+y) =x+y+a whereasT(x) +T(y) =x+a+y+a =x+y+ 2a. Since these are not equal,T is not linear.
Problem 3.6: Leta be a fixed vector. Show that the transformationT(x) =a·x is a linear transformation (whose output values are numbers).
Answer: It follows from the properties of the dot product thata·(sx+ty) =sa·x+ta·y. Problem 3.7: Find the matrices which project on the lines
(a)x1=x2 (b) 3x1+ 4x2= 0.
Answer: One way to do these problems is to determine the angleθthat the lines make with thexaxis, and then substitute into the formula. So, for part (a), we haveθ=π/4 (45◦). Thus the projection matrix is
1 2
1 + cos(2θ) sin(2θ) sin(2θ) 1−cos(2θ)
= 1
2
1 + cos(π/2) sin(π/2) sin(π/2) 1−cos(π/2)
=1
2
1 1 1 1
Another way to do this problem is to go back to the derivation of the projection matrix, and redo the formula for the matrix for projection in the direction ofa whenais not neccesarily a unit vector. This gives
1 a2
1+a 2 2
a2
1 a1a2
a2a1 a22
.
For part (a) the vectora= [1,1] so this formula gives the same answer. For part (b) the vectora= [4,−3] so the projection matrix is
1 25
16 −12 −12 9
.
Problem 3.8: Find the matrices that reflect about the lines (a)x1=x2 (b) 3x1+ 4x2= 0.
Answer:
Problem 3.9: Since we have already computed the corresponding projection matrices, we can use the formula 2P−I to get the reflection matrices. This gives
(a)
0 1 1 0
(b)
7/25 −24/25 −24/25 −7/25
Problem 3.10: Find the matrices which rotate about the origin in two dimensions by (a)π/4, (b)π/2 (c)π
Answer: Here we can just substitute into the formula for the rotation matrix. This gives (a)
1/√2 −1/√2 1/√2 1/√2
(b)
0 −1 1 0
(c)
−1 0
0 −1
Problem 3.11: Find the matrix which first reflects about the line making an angle of φwith the x axis and then reflects about the line making an angle of θwith thex axis. Give another geometric interpretation of this matrix.
Answer: We need to compute the matrix product
cos(2θ) sin(2θ) sin(2θ) −cos(2θ)
cos(2φ) sin(2φ) sin(2φ) −cos(2φ)
This equals
cos(2θ) cos(2φ) + sin(2θ) sin(2φ) cos(2θ) sin(2φ)−sin(2θ) cos(2φ) sin(2θ) cos(2φ)−cos(2θ) sin(2φ) sin(2θ) sin(2φ) + cos(2θ) cos(2φ)
Using the addition formulas for cos and sin this can be rewritten
cos(2θ−2φ) −sin(2θ−2φ) sin(2θ−2φ) cos(2θ−2φ)
This is the matrix for rotation by 2θ−2φ.
Answer: Under this rotation, the vectore1= [1,0,0] gets transformed to [cos(θ),sin(θ),0],e2= [0,1,0] gets
transformed to [−sin(θ),cos(θ),0], and e3= [0,0,1] is transformed to itself (ie it doesn’t change). Putting
this in the columns of a matrix yields
cos(θ) −sin(θ) 0 sin(θ) cos(θ) 0
0 0 1
Problem 3.13: Consider a random walk with 3 states, where the probability of staying in the same location is zero. Suppose
the probability of moving from location 1 to location 2 is 1/2 the probability of moving from location 2 to location 1 is 1/3 the probability of moving from location 3 to location 1 is 1/4
Write down the matrixP. What is the probability that a walker starting in location 1 is in location 2 after two time steps?
Answer: We can determine the transition matrix, since we know eachpi,i= 0, and the sum over each column
is zero. We are given that p2,1 = 1/2. Then, since p1,1+p2,1+p3,1 = 1, we have 0 + 1/2 +p3,1 = 1, so
p3,1= 1/2. Similarlyp1,2= 1/3,p3,2= 2/3, andp1,3= 1/4,p2,3= 3/4. Thus
P =
0 1/3 1/4 1/2 0 3/4 1/2 2/3 0
If we start out with the probability vectorx0=
1 0 0
(i.e., the walker is in location 1) then after two time steps the probablity vector isP2x
0, i.e.,
x2=
7/24 1/6 1/4 3/8 2/3 1/8 1/3 1/6 5/8
1 0 0
=
7/24
3/8 1/3
So the probability that the walker is in position 2 after two time steps is 3/8.
Problem 3.14: Consider a random walk with 3 states, where all the probabilitiespi,jare all equal to 1/3. What
isP,Pn. Compute the probabilitiesPnx
0 when x0=
1 0 0
(ie the walker starts in location 1),x0=
0 1 0
(ie the walker starts in location 2), andx0=
0 0 1
(ie the walker starts in location 3)
Answer: In this situation the transition matrix is
P =1 3
1 1 1 1 1 1 1 1 1
so P =P2
=p3
=· · ·Pn. In this case, if we start out with any probability vectorx
0 = [x1 x2 x3cr]
withx1+x2+x3= 1, then
Px0=
1/3 1/3 1/3
=Pnx0
for eachn.
Problem 3.15: Verify formula () forx=
x1
x2
x3
y=
y1
y2
and A=
1 2 3 4 5 6
.
Answer: Ax=
x1+ 2x2+ 3x3
4x1+ 5x2+ 6x3
so y·Ax=y1x1+ 2y1x2+ 3y1x3+ 4y2x1+ 5y2x2+ 6y2x3. On the other
handATy=
y1+ 4y2
2y1+ 5y2
3y1+ 6y2
so (ATy)·x=y1x1+ 4y2x1+ 2y1x2+ 5y2x2+ 3y1x3+ 6y2x3. These expressions
are equal.
Problem 3.16: What is (AT)T?
Answer: (AT)T =A.
Problem 3.17: Verify () forA=
1 2 3 1
andB=
1 2 3 4 5 6
Answer: AB =
9 12 15 7 11 15
so (AB)T =
9 7 12 11 15 15
. On the other hand BTAT =
1 4 2 5 3 6
1 3 2 1
=
9 7 12 11 15 15
.
Problem 3.18: Show that ifAandB are bothm×nmatrices such thaty·(Ax) =y·(Bx) for everyy∈Rm
and everyx∈Rn, thenA=B.
Answer: Ify=ei andx =ej (vectors that are all zeros except in one spot) then y·(Ax) =ei·(Aej) is
the matrix entryaij. So we can conclude that all the matrix entries ofAare the same as those forB. This
means the matrices must be the same.
Problem 3.19: Show that if you think of (column) vectors inRn as n×1 matrices then
x·y=xTy
Now use this formula and () to derive ().
x·(Ay) =xTAy= (ATx)Ty= (ATx)
·y
Problem 3.20: Find the least squares solution to
x1 +x2 = 1
x1 = 1
x1 +x2 = 0
Answer: B =
1 1 1 0 1 1
andb=
1 1 0
soBTB=
3 2 2 2
andBTb=
2 1
The equationBTBx=BTbhas
solutionx=
1 −1/2
. For this vectorxwe haveBx=
1/2
1 1/2
Problem 3.21: Refer back to the least squares fit example, where we tried to find the best straight line going through a collection of points (xi, yi). Another way of formulating this problem is this. The liney=ax+b
passes through the point (xi, yi) if
axi+b=yi (1)
So, saying that the straight line passes through all n points is the same as saying that aand b solve the system ofnlinear equations given by (1) fori= 1, . . . , n. Of course, unless the points all actually lie on the same line, this system of equations has no solutions. Show that the least squares solution to this problem is the same as we obtained before. (You may simplify the problem by assuming there are only three points (x1, y1), (x2, y2) and (x3, y3).)
Answer: We obtain B =
x1 1
x2 1
x3 1
and b=
y1
y2
y3
so that BTB = P
x2 i
P xi
P
xi n
(where n = 3 in this
example) andBTb=
P xiyi
P yi
. Thus we end up with the same equations as before.
Problem 3.22: Which of the following matrices are invertible? (a)
1 2 3 4
(b)
1 2 3 0 3 4 0 1 1
(c)
1 2 3 0 3 4 0 1 2
Answer: To determine whether these matrices invertible we reduce them using gaussian elimination. This gives
(a)
1 2 0 −2
(b)
1 2 3 0 3 4 0 0 −1/3
(c)
1 2 3 0 3 4 0 0 2/3
Since these all have rank equal to their size, they are all invertible.
Problem 3.23: Find the inverse for
1 2 3 5
Answer: The inverse is
−5 2
3 −1
Problem 3.24: Determine which of these matrices are invertible, and find the inverse for the invertible ones.
(a)
2 3 −1
1 2 3
−1 −1 4
(b)
1 −1 1 −1 2 −1
2 −1 1
(c)
1 1 1 1 2 3 1 4 9
(d)
2 1 4 3 2 5 0 −1 1
(e)
1 0 a 0 1 0 0 0 1
(f)
1 a b 0 1 c 0 0 1
Answer: (a) This matrix reduces to
2 3 −1 0 1/2 7/2
0 0 0
and so is not invertible
(b) The inverse is
−1 0 1 1 1 0 3 1 −1
(c)
3 −5/2 1/2 −3 4 −1 1 −3/2 1/2
(d)
−7 5 3 3 −2 −2 3 −2 −1
(e)
1 0 −a 0 1 0 0 0 1
(f)
1 −a ac−b 0 1 −c
0 0 1
Problem 3.25: Each elementary matrix is invertible, and the inverse is also an elementary matrix. Find the inverses of the three examples of elementary matrices above. Notice that the inverse elementary matrix is the matrix for the row transformation that undoes the original row transformation.
Answer: The inverse operation to multiplying the first row by two is multiplying the first row by 1/2. Therefore the inverse elementary matrix to
2 0 0 0 1 0 0 0 1
is
1/2 0 0 0 1 0 0 0 1
.
The inverse operation to subtracting twice the first row from the second row is adding twice the first row to the second row. Therefore the inverse elementary matrix to
1 0 0 −2 1 0 0 0 1
is
1 0 0 2 1 0 0 0 1
.
The inverse operation to exchanging the last two rows is exchanging them again. Therefore the inverse elementary matrix to
1 0 0 0 0 1 0 1 0
is the same matrix
1 0 0 0 0 1 0 1 0
.
In each case one can check directly that the inverse matrices when multiplied by the original matrices give the identity matrix.
Problem 3.26: Write the matrix
2 3 −1
1 2 3
−1 −1 4
as a product of elementary matrices.
Answer: e can reduceAto the identity with the followin row operations: (R2)−(1/2)(R1), (R3)+(1/2)(R1), (R3)−(R2), (R1)−6(R2), (R2)−(5/4)(R3), (R1) + 7(R3), (1/2)(R1), 2(R2), (1/2)(R3). So
1 0 0 0 1 0 0 0 1/2
1 0 0 0 2 0 0 0 1
1/2 0 0 0 1 0 0 0 1
1 0 7 0 1 0 0 0 1
1 0 0 0 1 −5/4 0 0 1
1 −6 0 0 1 0 0 0 1
1 0 0 0 1 0 0 −1 1
1 0 0 0 1 0 1/2 0 1
1 0 0 −1/2 1 0 0 0 1
A=I
so
A=
1 0 0 1/2 1 0 0 0 1
1 0 0 0 1 0 −1/2 0 1
1 0 0 0 1 0 0 1 1
1 6 0 0 1 0 0 0 1
1 0 0 0 1 5/4 0 0 1
1 0 −7 0 1 0 0 0 1
2 0 0 0 1 0 0 0 1
1 0 0
0 1/22 0
0 0 1
1 0 0 0 1 0 0 0 2
Problem 3.27: Find the determinant of
1 1 1 1 1 2 4 8 1 3 9 27 1 4 16 64
Answer: We reduce the matrix as follows:
1 1 1 1 1 2 4 8 1 3 9 27 1 4 16 64
1 1 1 1 0 1 3 7 0 2 8 26 0 3 15 63
(R2)−(R1) (R3)−(R1) (R4)−(R1)
1 1 1 1 0 1 3 7 0 0 2 12 0 0 6 42
(R3)−2(R2) (R4)−3(R2)
1 1 1 1 0 1 3 7 0 0 2 12 0 0 0 6
(R4)−3(R3)
None of these operations affect the determinant. So the determinant of the original matrix is the same as the determinant of the reduced diagonal matrix. This determinant is the product of the diagonal elements which equals 12.
Problem 3.28: Find the determinant of
1 −1 1 −1
1 2 4 8
1 −2 4 −8
1 1 1 1
Answer: We reduce the matrix as follows:
1 −1 1 −1
1 2 4 8
1 −2 4 −8
1 1 1 1
1 −1 1 −1 0 3 3 9 0 −1 3 −7 0 2 0 2
(R2)−(R1) (R3)−(R1) (R4)−(R1)
1 −1 1 −1
0 1 1 3
0 −1 3 −7
0 2 0 2
(1/3)(R2)
1 −1 1 −1
0 1 1 3
0 0 4 −4 0 0 −2 −4
(R3) + (R2) (R4)−2(R2)
1 −1 1 −1
0 1 1 3
0 0 1 −1 0 0 −2 −4
(1/4)(R3)
1 −1 1 −1 0 1 1 3 0 0 1 −1 0 0 0 −6
The two operations that changed the determinant were multiplying the the second row by 1/3 and multiplying the third row by 1/4. Thus the determinant of the diagonal matrix is (1/3)(1/4)×the determinant of the original matrix. Hence the determinant of the original matrix is 3×4×(−6) =−72.
Problem 3.29: Compute
det
1 0 1 1 2 3 3 0 1
by expanding along the second row, and by expanding along the third column. Answer:
det
1 0 1 1 2 3 3 0 1
=−1 det
0 1 0 1
+ 2 det
1 1 3 1
−3 det
1 0 3 0
=−1×0 + 2×(1−3)−3×0 =−4
= 1 det
1 2 3 0
−3 det
1 0 3 0
+ 1 det
1 0 1 2
= 1×(0−6)−3×0 + 1×(2−0) =−4
Problem 3.30: Find the inverse of
1 0 1 1 2 3 3 0 1
using the impractical formula
Answer: The determinant is−4 by the previous problem, and M1,1=
2 3 0 1
M1,2=
1 3 3 1
M1,3=
1 2 3 0
M2,1=
0 1 0 1
M2,2=
1 1 3 1
M2,3=
1 0 3 0
M3,1=
0 1 2 3
M3,2=
1 1 1 3
M3,3=
1 0 1 2
Thus the inverse is
1 −4
2 −0 −2 −(−8) −2 −2 −6 −0 2
=
−12 0
1 2
−2 12 1 2 3
2 0 −
1 2
Problem 3.31: Solve the equation
1 0 1 1 2 3 3 0 1
x1 x2 x3 = 1 0 1
using Cramer’s rule.
Answer: According to Cramer’s rule x1=
1 −4det
1 0 1 0 2 3 1 0 1
= 0
x2=
1 −4det
1 1 1 1 0 3 3 1 1
=− 3 2
x3=
1 −4det
1 0 1 1 2 0 3 0 1