PROJECT 2

MAS3114, Spring 1999


For this project you may work individually or in pairs (no groups larger than two). Two students working together need only turn in one printout with both names on it. You should not share answers with anybody other than your "teammate". Make sure you are familiar with the student honor code.

  • Handing in the project.

    Once again you should staple the pages of your output together, and put your name(s) at the top of the first page. Follow all instructions, answer all questions, and put boxes around your final answers. Edit your output, either on the computer or by hand, so that a reader can easily tell what question you are answering.

    Important reminder! As soon as you enter MATLAB, remember to start saving your session, either by using the diary command as in Project 1, or by whatever other means you found works for you.

  • Problem 1: A temperature distribution

    Read the discussion on p. 12 relating to exercises 35 and 36 of Section 1.1. Replace Figure 3 by a square four units on each side, so that there are nine interior points instead of six. Number the interior points 1 through 9, with 1 through 3 in the top row, 4 through 6 in the second row, and 7 through 9 in the third row. Use the following temperatures for the non-corner points on the edges of the square: 100o for each point on the top edge, 0o along the bottom edge, 50o along the left-hand edge, and 80o along the right-hand edge. Now do the analogs of exercises 35 and 36 (you will have a system of 9 equations in 9 unknowns). Use MATLAB to solve system of equations.

  • Problem 2: Finding linearly independent subsets of a set of vectors

    Use MATLAB to do Section 1.6 exercise 41 (p. 66). The wording in the book omits something important: what you are doing here is testing subsets of the columns of A for linear independence. (We saw in class the columns of a matrix B are linearly independent if and only if rref(B) has a pivot position in every column, or equivalently if and only if the matrix equation Bx=0 has only the trivial solution.)

    Some practical advice: (1) It is important to make sure that you enter the right matrix; making even a tiny mistake can drastically change the answer. If you find that you've mis-entered one of the entries of A, you do not need to re-type the whole matrix to make the correction. For example, if you made an error entered the entry in the second row, third column, you can correct it by typing "A(2,3)=5". (2) You also do not have to retype a lot if you want to delete columns from a matrix you've already entered. For example, if a matrix C has 6 solumns, and you're interested in the matrix obtained by deleting column 3, you could define

    C3=[C(:,1:2), C(:, 4:6)]

    and then do something similar to C3 if you want to delete more columns.

    Hint for doing problem 41 quickly: look at rref(A) first. Are the non-pivot columns of rref(A) linear combinations of the pivot columns to their left? What does that tell you about the columns of A? Can a set of columns of A that includes a non-pivot column and all the pivot columns to its left be linearly independent?

  • Problem 3

    Use MATLAB to do Section 1.7 exercise 38 (p. 75).

  • Problem 4: A "lemming matrix".

    Use MATLAB to do Section 2.1 exercise 37 (p. 109). To raise a square matrix A to the power n in MATLAB, type

    A^n

    For fun (not required), you can experiment with what happens if you replace the 1's by other numbers, or if you replace the 0's in the upper right-hand triangle by other numbers.

  • Problem 5: An application to economics

    Read "A Homogeneous System in Economics" beginning on page 53. Then do exercise 38 from section 1.5. Enter the exchange table as a matrix E; you will use it again in the next problem.

  • Problem 6

    Let E be the exchange table matrix from the previous problem. Compute E2, E3, ..., until En stops changing on the screen. (Note: most matrices do not have this property!) Although MATLAB may display only four decimal places, the entries of En may still be changing in the fifth or higher decimal place. See this by having MATLAB compute En-En-1, where n is the exponent at which En appears first to stabilize. By experimenting with larger n, find an n for which the difference between En and En-1 is so small that MATLAB considers it zero. Let E_infinity be En for that n. What do you notice about E_infinity? Let v be any of the columns of E_infinity. By computing E*v-v, decide whether v gives you a set of equilibrium prices for the economy represented by the exchange table.

  • Problem 7

    The matrix E in the previous problem had special property: all entries were between 0 and 1, and the sum of the entries in every column was 1. One could conjecture that all matrices with this property exhibit the phenomena that the powers of E did. To test this hypothesis, try the following.

    Erand=.5*rand(2,3)

    Erand(3,:)=1-Erand(1,:)-Erand(2,:)

    (Note that the second operation changed Erand to a 3x3 matrix.) Now test the powers of Erand and see what happens. Then try the same thing with a similarly constructed 4x4 matrix.

    Warnings: (1) Finding that a phenomenon occurs in every example you try may suggest that the phenomenon is general; it does not prove it unless there are only finitely many possible examples and you've tested them all. It's quite possible for something to be false in general, and yet true for every example you test (see Problem 8 below). However, when there are infinitely many possible examples, experimenting with examples may give you an idea what it might be possible to prove, and may keep you from wasting time trying to prove something that's false. (2) Noone has ever devised a truly random "random number generator". MATLAB's "random number generator", like all others on the market, repeats itself after a (very) long while. Furthermore, the construction of Erand above forces the first two columns and rows of Erand to be between 0 and 1/2 (for the 3x3 case).

    For fun (not required), see what happens if you take powers of a square matrix that has all entries between 0 and 1, with the entries in every column and row summing to 1. One such matrix is given on p. 109, exercise 38.

  • Problem 8: Do most matrices have maximal rank?

    The maximal rank of an m x n matrix is defined to be min( m,n ), i.e. whichever of m and n is smaller. The rank of a matrix is defined to be the number of pivot positions. Since each pivot position uses up one column and one row, the rank of a matrix is at most its maximal rank, justifying the terminology.

    In class it was stated that for "most" matrices, the rank equals the maximal rank. Test whether you believe this statement by using rand and rref. (For example, you could set A=rand(2,3), then find rref(A).) Test matrices of at least five different sizes. At least four of your test sizes should be non-square, and all should have at least two columns and at least two rows. Some of your test sizes should have more columns than rows, and some should have more rows than columns.

    Even though there are infinitely many matrices whose rank is less than maximal, if you just test "random" matrices, you could wrongly conclude that all matrices have maximal rank!


    This page was last modified by D. Groisser on Feb. 10, 1999.