a logo for the course

Matrix computations &
Numerical linear algebra

David Gleich

Purdue University

Fall 2012

Course number CS-51500

Tuesday and Thursday, 10:30-11:45am

Location Lawson 1106


Homework 4

Homework 4

Please answer the following questions in complete sentences in a clearly prepared manuscript and submit the solution by the end of class on Thursday, October 25th, 2012. You should submit your PDF file to Blackboard http://mycourses.purdue.edu as well as your Matlab files.

Version 3: Fixed the in problem 1, fixed the negative signs in Problem 4, clarified Problem 5.

Version 2: Fixed the problem numbers (5, 6), fixed the symbol in problem 3.

Problem 0: List your collaborators.

Please identify anyone, whether or not they are in the class, with whom you discussed your homework. This problem is worth 1 point, but on a multiplicative scale.

Problem 1: Tridiagonal systems

At this point in the class, you should be able to solve the following problems. These will return to haunt us when we study iterative methods. You’ll see!

Let be a symmetric, tridiagonal, positive definite matrix:

\mA = \bmat{\alpha_1 & \beta_1 \\ \beta_1 & \alpha_2 & \ddots \\ & \ddots & \ddots & \ddots \\ & & \beta_{n-2} & \alpha_{n-1} & \beta_{n-1} \\ & & & \beta_{n-1} & \alpha_n }
  1. Let is the leading prinicipal minor of . Suppose you are given the Choleksy factorization of . Determine the structure of (hint, must be tridiagonal!).

  2. Now, show how to compute the Cholesky factorization of from in a constant number of operations.

  3. Use the result of the first two parts to write down an algorithm that computes the Cholesky factorization of in a linear amount of work (starting from scratch!)

Problem 2: Tridiagonal least-squares problems

Let be a tridiagonal, , “almost-symmetric” matrix:

\mA = \bmat{\alpha_1 & \beta_1 \\ \beta_1 & \alpha_2 & \ddots \\ & \ddots & \ddots & \ddots \\ & & \beta_{n-2} & \alpha_{n-1} & \beta_{n-1} \\ & & & \beta_{n-1} & \alpha_n \\ & & & & \beta_n}.

(For those who don’t appreciate mathematically imprecise terms, “almost-symmetric” means that it’s symmetric, except for the fact that it’s a rectangular matrix!)

  1. Implement a Matlab algorithm to solve a least-squares problem with such a matrix using Given’s rotations.

  2. Compare the performance of Matlab’s backslash operator to your Givens function on matrices of size and . Repeat each timing measurement at least 5 times.

Problem 3: The Schur Complement

Suppose we wish to solve

\mM \vx = \vb

and further suppose that you KNOW some of the values of .

Let us permute and partition to be a block system:

\mM \vx = \bmat{ \mA & \mB \\ \mC & \mD } \bmat{\vx_1 \\ \vx_2} = \bmat{ \vb_1 \\ \vb_2 }

where is what you know.

  1. Show how to solve for given . Under what conditions is this possible?

  2. Now, suppose that you have a very kind, but very confused dog that happened to eat your flash memory stick holding the piece of that you knew. However, you had saved your computed on your Purdue account, and so you have a backup. (This means you can assume that computing from is possible for this problem if you determined it wasn’t always possible above.) Can you get back?

  3. Combine these two parts to derive a single linear system to compute without computing . The system you’ll derive is called the Schur complement.

Problem 4: Sparse matrices in Matlab

If you wish to use another language, please see me

In this problem, we’ll return to our favorite linear system, Poisson’s equation. (I told you that we’d see a lot of this system.)

We’ll assume that the boundary conditions are zero everywhere. Consequently, we’ll use the form of the system we derived on the exam (without all the extra rows!). Some of you did this already, so you may have an easier time on this question. That is, for the case, you’d have the linear system from the exam. For the case, we have:

\bmat{-4 & 1 & & 1 & & & & & \\ 1 & -4 & 1 & & 1 & & & & \\ & 1 & -4 & & & 1 & & & \\ 1 & & & -4 & 1 & & 1 & & \\ & 1 & & 1 & -4 & 1 & & 1 & \\ & & 1 & & 1 & -4 & & & 1 \\ & & & 1 & & & -4 & 1 & \\ & & & & 1 & & 1 & -4 & 1 \\ & & & & & 1 & & 1 & -4 \\ } \bmat{ U(1,1) \\ U(1,2) \\ U(1,3) \\ U(2,1) \\ U(2,2) \\ U(2,3) \\ U(3,1) \\ U(3,2) \\ U(3,3) } = \bmat{ F(1,1) \\ F(1,2) \\ F(1,3) \\ F(2,1) \\ F(2,2) \\ F(2,3) \\ F(3,1) \\ F(3,2) \\ F(3,3) \\ }

where and .

  1. You can change an entry of a sparse matrix in Matlab with . Write a Matlab routine to create the matrix above for a general by changing each element one at a time.

    A = sparse((N-1)*(N-1),N-1)*(N-1)); % this creates an all-zero sparse matrix
    <fill in the rest>
  2. As shown in class, another way to create a sparse matrix is to use the coordinate form. Create the arrays i,j,andv for the matrix above. Hint there are non-zeros. Use this information to initialize the arrays i,j, and v. Write a routine to create the matrix above for a general using the coordinate form

    nz = (N-1)^2 + 4*(N-1)*(N-2);
    i = zeros(nz,1);
    j = zeros(nz,1);
    v = zeros(nz,1);
    <fill in the rest>
    A = sparse(i,j,v,(N-1)*(N-1),(N-1)*(N-1));
  3. Which way is faster? Try creating matrices with .

  4. Is solving the linear system using backslash faster or slower with a sparse matrix? Does it depend on the value of ? Investigate and report.

  5. Implement the Jacobi method for this problem. How many iterations does it take to converge to a relative residual of ?

Problem 5: Prove or disprove

People seem to like these questions!

  1. The eigenvalues of an real-valued matrix are always real.

  2. The solution to is unique for any .

  3. Every matrix can be written as the sum of two non-singular matrices.

  4. An real-valued matrix has an orthogonal set of eigenvectors.

Problem 6: An experiment

As I’ve tried to emphasize in this class, matrix methods have broad applicability. In this problem, I’d like you to use what you’ve learned in this class to describe a problem in your own research in matrix terms.

If you don’t have one, spend 20 minutes searching on Google for others who have worked in your area with matrix methods and write about what they do.

If you cannot find anything, please document what you’ve done in an attempt to find something. But better yet, drop by office hours and ask for help finding something. Please try not to email us asking for help on this question as we’d like to discuss your area with you to help guide your search.

In any of these three cases, I’d expect somewhere between 2-3 paragraphs with equations describing what you’ve found (or failed to find … ) Some great things to mention are terms that you haven’t seen in class yet, or ideas that you’d like to learn more about, or anything (matrix related) you find interesting!