Mid1 Sol

You might also like

You are on page 1of 8

Midterm 1: Solutions

Math 22A, fall 2016

Time: 50 minutes

1. Compute the following products and linear combinations. If the operation does not make
mathematical sense, write DNE (Does Not Exist).
[1 point each for parts (a)-(g), 2 points for (h)]
         
1 2 3 10 13
a) 3 +5 = + =
2 1 6 5 11
    
0 1 0 x y
b) 0 0 1
   y = z
 
1 0 0 z x
    
−1 2 a b −a + 2c −b + 2d
c) =
3 −1 c d 3a − c 3b − d
 
  a b
−1 2 
d) c d  = DNE
3 −1
e f
 
 5
e) 1 0 −1 10 = 0
5
   
5  5 0 −5
f) 10 1 0 −1 = 10 0 −10
5 5 0 −5
 
 5
g) 1 0 −1 + 10 = DNE

5
 
   2 −3 5 −7
33 −77 33 1 1     
−11 13 −17 19 
1 0 0 1 1 0 2 4 8 16
h) −77 42 −77 2 3  
0 0 1 0 0 0 81 27 9 3  23 −19 31 −37
33 −77 33 5 8 |

{z  } −41 43 −47 53

0 0
0 0
 
0 0 0 0  
0 0
= 0 0 0 0 [2 pts - partial credit for ]
0 0
0 0 0 0

1
2. Describe the span of the following vectors geometrically, as either a a point, a line, a
plane, or R3 .
[1 point each]
 
1
a) −2
 line
1
 
0
b) point
0
   
1 2
c) and plane
2 1
           
1 0 2 1 0 2
d) 0 and 1 and −1
      a plane, because 2 0 − 1 = −1
    
1 1 1 1 1 1
     
6 −8 9
e) −12 and  16  and −18 a line, because these are all proportional;
−18   24  −27
    
−8 6 9 6
4 3
namely  16  = − −12 and −18 = −12.
3 2
24 −18 −27 −18

3. Which MATLAB commands implement the following operations:


[1 pt each, no partial credit]
   
1 0 1
a) Define a column vector v = and a matrix A = .
2 2 3
x = [1; 2]; A = [0 1; 2 3] or x = [1 2]’ ; A = [0 1; 2 3] (etc)

b) Find the length of v.


norm(v) or norm(v’) or sqrt(v’*v)

c) Find the cosine of the angle between v and the vector A v.


v’*A*v/(norm(v)*norm(A*v)) or similar using sqrt

d) Solve the equation A x = v.


x = A\v or simply A\v

2
4. Write TRUE or FALSE for each of the following statements. [1 point each]

For any matrices A and B...

a) If A2 is defined, then A is necessarily square. TRUE

b) If AB and BA are defined, then A and B are square. FALSE

c) If AB and BA are defined, then AB and BA are square. TRUE

d) If AB = B then A = I. FALSE

e) If (A + B)2 = A2 + 2AB + B 2 then necessarily AB = BA. TRUE:


Expanding we have (A + B) = A + AB + BA + B . If this equals A2 + 2AB + B 2 then
2 2 2

AB = BA.

f) If A is a square matrix and the columns of A are linearly independent vectors, then the
rows of A are necessarily linearly independent vectors. TRUE

g) If A is 3×3 matrix and the span of the columns is a plane, then A is invertible. FALSE

h) If v and w are two nonzero vectors and v · w = 0,


then the angle between v and w is 180◦ . FALSE: they are perpendicular, angle= 90◦ .

5. Find the inverse of A for [2 pts each, no partial credit]


   −1 
x 0 −1 x 0
a) A = A =
0 y 0 y −1
   
1 0 0 0 1 0 0 0
a 1 0 0 −a 1 0 0
b) A = 
b
 A−1 =
 −b

0 1 0 0 1 0
c 0 0 1 −c 0 0 1
     
3 2 −1 1 3 −2 3 −2
c) A = A = = .
4 3 3·3−4·2 −4 3 −4 3

3
 
1 0 4
6. Find the inverse of A = 2 1 4.
1 2 0
You may use any algorithm you like.
Correct steps in Gauss-Jordan elimination will earn partial credit.
[7 points — one for each step, including writing the augmented matrix]
 
1 0 4 1 0 0
Begin by writing the augmented matrix  2 1 4 0 1 0 
1 2 0 0 0 1
 
1 0 4 1 0 0
Subtract 2(row 1) from (row 2)  0 1 −4 −2 1 0 
1 2 0 0 0 1
 
1 0 4 1 0 0
Subtract (row 1) from (row 3)  0 1 −4 −2 1 0 
0 2 −4 −1 0 1
 
1 0 4 1 0 0
Subtract 2(row 2) from (row 3)  0 1 −4 −2 1 0 
0 0 4 3 −2 1
 
1 0 4 1 0 0
Add (row 3) to (row 2)  0 1 0 1 −1 1 
0 0 4 3 −2 1
 
1 0 0 −2 2 −1
Subtract (row 3) from (row 1)  0 1 0 1 −1 1 
0 0 4 3 −2 1
 
1 0 0 −2 2 −1
Divide (row 3) by 4  0 1 0 1 −1 1 
0 0 1 3/4 −1/2 1/4
 
−2 2 −1
So A−1 =  1 −1 1 .
3/4 −1/2 1/4

4
7. Consider the system of equations

x + y − 2z = 1
x + ay − z = 0
3x + y − 4z = 2

a) Write the augmented matrix (A | b) corresponding to this system. [1 point]


 
1 1 −2 1
(A | b) =  1 a −1 0 
3 1 −4 2
b) Which elimination matrix E1 implements the first step of elimination, so that
 
   
E1 (A | b) =  0     ?
0   
 
1 0 0
E1 = −1 1 0 [1 pt]
−3 0 1
 
1 1 −2 1
E1 (A | b) =  0 a − 1 1 −1  [1 pt]
0 −2 2 −1

c) For which value of a does elimination now require a row exchange?

a=1 [1pt]

Continued...

5
d) Set a to the value from part (c). Which permutation matrix P implements the row
exchange, so that  
   
P E1 (A | b) =  0     ?
0 0  

 
1 0 0
P = 0 0 1 [1 pt]
0 1 0

 
1 1 −2 1
P E1 (A | b) =  0 −2 2 −1  [1 pt]
0 0 1 −1

e) Setting a to its value from part (c), solve the equations. [2 pts]

The last equation sets z = −1. The second equation sets −2y + 2z = −2y − 2 = −1, so
y = −1/2. The first equation sets x + y − 2z = x − 1/2 + 2 = 1, so x = −1/2.

Thus: x = −1/2, y = −1/2, z = −1.

6
8. Consider the same system of equations as in Problem 9:

x + y − 2z = 1
x + ay − z = 0
3x + y − 4z = 2

a) For which value of a is the system singular (in other words, for which a is the matrix A
singular)? [2 pts, no partial credit]

Start with the form of the augmented matrix from Part (b) of the previous problem:
 
1 1 −2 1
E1 (A | b) =  0 a − 1 1 −1 
0 −2 2 −1
2
Now carry out one more elimination step, adding (row 2) to (row 3) to find
a−1
 
1 1 −2 1
E1 (A | b) =  0 a − 1 1 −1 
2 2
0 0 2 + a−1 −1 − a−1
The last pivot equals zero when a = 0 .

b) Given this singular value of a, how many solutions does the system have?

[2 pts, partial credit only if arithmetic error gives 0z = 0, with answer ∞ solutions]

Substituting this value of a into the last equation we find 0z = 1.


Thus there are NO SOLUTIONS.

7
 
3 −2 0
9. Find the LU and LDU0 decompositions of A = −2 3 −2.
0 −2 3
In other words, find L and U such that

L  U 
1 0 0   
A=  1 0
   0   (4 pts)
  1 0 0 

and find L, D, and U 0 such that


0
L  D  U 
1 0 0  0 0 1  
A=  1 0
   0  0 0 1  (2 pts)
  1 0 0  0 0 1

First we run elimination:


   
1 0 0 3 −2 0
2/3 1 0 A = 0 5/3 −2
0 0 1 0 −2 3
    
1 0 0 1 0 0 3 −2 0
0 1 0 2/3 1 0 A = 0 5/3 −2  [2 pts, one per row of U ]
0 6/5 1 0 0 1 0 0 3/5
Then we invert the elimination matrices to find
 L  U 
1 0 0 3 −2 0
A = −2/3 1 00 5/3 −2  [2 pts, one per entry of L]
0 −6/5 1 0 0 3/5

Alternatively, we may write this as


 L  D  U0 
1 0 0 3 0 0 1 −2/3 0
A = −2/3 1 00 5/3 0 0 1 −6/5
0 −6/5 1 0 0 3/5 0 0 1
[2 pts, one each for D and U 0 ]

Notice that L = (U 0 )T . This must be the case, because A is symmetric.

You might also like