Docsity

Midterm 2 for Linear Algebra and Probability | MATH 202, Exams of Linear Algebra

Toggle sidebar
bg1
Linear Algebra and Probability Name
Midterm 2, Spring, 2009
Show Your Work! Point values are in square brackets. There are 40 points possible.
1. Recollect that if the following algorithms are applied to an n×nsystem Ax=b,they have
the following run times. (Here we’re assuming no row swaps are necessary.)
Algorithm FLOPs
Gaussian Elimination 1
6(4n3+ 3n2−7n)
LU Factorization 1
6(4n3−3n2−n)
Forward Substitution n2−n
Backward Substitution n2
Gauss. Elim + Back Sub 1
6(4n3+ 9n2−7n)
LU Fact. + Fwd Sub + Back Sub 1
6(4n3+ 9n2−7n)
“Gaussian Elimination” refers just to the elimination phase, and “LU Factorization” refers
just to the factorization phase. So in order to completely solve a linear system Gaussian
Elimination + Backward Substitution requires exactly the same number of FLOPs as LU
Factorization + Forward Substitution + Backward Substitution. Explain, in two sentences or
less, why LU Factorization + Forward Substitution + Backward Substitution is the preferred
method for solving linear systems. [4 points]
Applications frequently need to solve linear systems Ax=biin which the matrix Ais fixed,
but the RHS bichanges. If we use LU factorization, we only need to do the “expensive”
part, the factorization, once for all of these systems, while if we use Gaussian elimination,
we’ll need to do the expensive part all over again for each RHS. So if there are kRHS’s, LU
factorization will require
1
6(4n3−3n2−n) + k(2n2−n) FLOPs ,
while Gaussian elimination will require
k
6(4n3+ 3n2−7n) + kn2FLOPs .
2. Suppose that Ais an m×nmatrix, xis an (unknown) n-dimensional vector, and bis a
nonzero m-dimensional vector. Answer true or false. (You don’t need to give a reason for
your answer.) Be careful! [2]
(a) The set of all solutions to Ax=0is a subspace of Rm.
False. The set of all solutions to Ax=0is a subspace of Rn:nis the number columns!
(b) The set of all solutions to Ax=bis a subspace of Rn.
False. For example if x1and x2are solutions then A(x1+x2) = Ax1+Ax2=b+b=
2b6=b,since b6=0.
1
pf3
pf4
pf5

Partial preview of the text

Download Midterm 2 for Linear Algebra and Probability | MATH 202 and more Exams Linear Algebra in PDF only on Docsity!

Linear Algebra and Probability Name Midterm 2, Spring, 2009

Show Your Work! Point values are in square brackets. There are 40 points possible.

  1. Recollect that if the following algorithms are applied to an n × n system Ax = b, they have the following run times. (Here we’re assuming no row swaps are necessary.)

Algorithm FLOPs Gaussian Elimination 16 (4n^3 + 3n^2 − 7 n) LU Factorization 16 (4n^3 − 3 n^2 − n) Forward Substitution n^2 − n Backward Substitution n^2 Gauss. Elim + Back Sub 16 (4n^3 + 9n^2 − 7 n) LU Fact. + Fwd Sub + Back Sub 16 (4n^3 + 9n^2 − 7 n)

“Gaussian Elimination” refers just to the elimination phase, and “LU Factorization” refers just to the factorization phase. So in order to completely solve a linear system Gaussian Elimination + Backward Substitution requires exactly the same number of FLOPs as LU Factorization + Forward Substitution + Backward Substitution. Explain, in two sentences or less, why LU Factorization + Forward Substitution + Backward Substitution is the preferred method for solving linear systems. [4 points] Applications frequently need to solve linear systems Ax = bi in which the matrix A is fixed, but the RHS bi changes. If we use LU factorization, we only need to do the “expensive” part, the factorization, once for all of these systems, while if we use Gaussian elimination, we’ll need to do the expensive part all over again for each RHS. So if there are k RHS’s, LU factorization will require 1 6

(4n^3 − 3 n^2 − n) + k(2n^2 − n) FLOPs ,

while Gaussian elimination will require

k 6

(4n^3 + 3n^2 − 7 n) + kn^2 FLOPs.

  1. Suppose that A is an m × n matrix, x is an (unknown) n-dimensional vector, and b is a nonzero m-dimensional vector. Answer true or false. (You don’t need to give a reason for your answer.) Be careful! [2]

(a) The set of all solutions to Ax = 0 is a subspace of Rm. False. The set of all solutions to Ax = 0 is a subspace of Rn^ : n is the number columns! (b) The set of all solutions to Ax = b is a subspace of Rn. False. For example if x 1 and x 2 are solutions then A(x 1 + x 2 ) = Ax 1 + Ax 2 = b + b = 2 b 6 = b, since b 6 = 0.

  1. A tridiagonal matrix has nonzero entries only

i. On the main diagonal, ii. Directly above the main diagonal, and iii. Directly below the main diagonal.

As an example, the following matrix A is tridiagonal

A =

If no row swapping is needed the following algorithm can be used to convert the augmented matrix of an n × n tridiagonal system to triangular form.

1 for (piv_row = 0; piv_row <= n-2; piv_row++) { 2 pivot = A_aug[piv_row][piv_row]; 3 elim_row = piv_row+1; // Integer arithmetic 4 multiplier = A_aug[elim_row][piv_row]/pivot; 5 A_aug[elim_row][piv_row] = 0.0; 6 A_aug[elim_row][elim_row] -= multiplierA_aug[piv_row][elim_row]; 7 A_aug[elim_row][n] -= multiplierA_aug[piv_row][n]; 8 }

Find the number of FLOPs executed by the algorithm. [4] The body of the for loop executes five FLOPs: one in line 4 and two each in lines 6 and

  1. (Note that line 3 is integer arithmetic, so it doesn’t add to the count of floating point operations.) The body of the loop is executed

(n-2) - 0 + 1 = n - 1

times. Hence the total number of FLOPs is 5(n − 1) = 5n − 5.

  1. Find the inverse of the matrix

A =

[

]

[4]

We can use the formula for 2 × 2 matrix inverses:

A−^1 =

[

]

[

]

  1. Consider the matrix

A =

(a) Find a basis for the column space of A. A is already in reduced echelon form. So the column space is spanned by the pivot columns 1 and 3: (1, 0 , 0) and (0, 1 , 0). (b) Find a basis for the nullspace of A. The free variables are x 2 , x 4 , and x 5. Setting each of these to 1 and the others to 0, gives the following basis for the nullspace:

(0, 1 , 0 , 0 , 0), (− 1 , 0 , 0 , 1 , 0), (− 1 , 0 , − 1 , 0 , 1).

[4]

  1. Consider the system of linear equations

x + 2 y − z = b 1 y + z = b 2 2 z = b 3

(a) Is there a vector b = (b 1 , b 2 , b 3 ) for which the system has infinitely many solutions? No. (b) Is there a vector b = (b 1 , b 2 , b 3 ) for which the system has no solution? No.

Explain your your answer to each question in two sentences or less. [4] The system is invertible. Since it’s upper triangular with no zeroes on the diagonal, we can always solve for x, y, and z regardless of what b 1 , b 2 , and b 3 are. Furthermore, since the system is invertible, there’s always only one solution: A−^1 b.

  1. We know that a linear system can have one of the following three types of “solutions:”

(i) No solution, (ii) Exactly one solution, or (iii) Infinitely many solutions.

Suppose a linear system has m equations and n unknowns. We know that if m = n, then any one of the above three types of solution is possible. Which of the above three types of “solution” is possible if

(a) m > n. All three are possible. As examples, consider the following systems  

[

x y

]

[

x y

]

[

x y

]

The first system has no solution, the second has exactly one, and the third has infinitely many. (b) m < n. In this case we can only get no solution or infinitely many solutions. As examples, consider the two systems

[ 1 1 1 0 0 0

]

x y z

[

]

[

]

x y z

[

]

Then the first system has no solution and the second has infinitely many. To see that we can’t get exactly one solution, observe that there can’t be more than two pivot variables. Hence there’s at least one free variable. So the dimension of the kernel is at least 1, and if there is a solution, there must be infinitely many.

You don’t need to give reasons for your answers. [4]

  1. The matrix A has the following LU factorization:

A =

 = LU =

If

x =

x y z

 (^) , and b =

use the LU factorization to solve the system Ax = b by forward and backward substitution. (You must use forward and backward substitution in order to receive credit.) [4] Suppose c = (a, b, c). Then if we first solve Lc = b using forward substitution, we can then solve U x = c by backward substitution. If (^)  

a b c

then a = 1, b = − 2 , and c = 1. Solving  

x y z

gives x = 1, y = − 2 , and z = 1.