MATH 304, Fall 2017 Take Home QUIZ # 4 Due: 02/15/2018. In Class Print name (LAST, First): SECTION #: INSTRUCTOR: Dr. Marco A. Roque Sol THE AGGIE CODE OF HONOR "An Aggie does not lie, cheat, or steal, or tolerate those who do." By signing below, you indicate that all work is your own and that you have neither given nor received help from any external sources. Show all your work neatly and concisely. You will be graded not merely on the final answer, but also on the quality and correctness of the work leading up to it. SIGNATURE:... Science is organized knowledge. Wisdom is organized life... Immanuel Kant MATLAB has a help facility that explains all its operations and commands. For example, to obtain information on the MATLAB command rand, you need only type help rand. The commands used in the MATLAB problems shown below are inv,floor, rand, tic, toc, rref, abs, max, round, sum, eye, triu, ones, zeros, and magic. The operations introduced are +,,,, and \. The + and represent the usual addition and subtraction operations for both scalars and matrices. The corresponds to multiplication of either scalars or matrices. For matrices whose entries are all real numbers the operation corresponds to the transpose operation. If A is a nonsingular n n matrix and B is any n r matrix, the operation A \ B is equivalent to computing A 1 B. 1. Use MATLAB to generate random 4 4 matrices A and B. For each of the following, compute A1, A2, A3, and A4 as indicated and determine which of the matrices are equal (you can use MATLAB to test whether two matrices are equal by computing their difference). (a) A1 = A B, A2 = B A, A3 = (A B ), A4 = (B A ) (b) A1 = A B, A2 = (A B), A3 = B A, A4 = (B A) (c) A1 = inv(a B), A2 = inv(a) inv(b), A3 = inv(b A), A4 = inv(b) inv(a) (d) A1 = inv((a B) ), A2 = inv(a B, A3 = inv(a ) inv(b ), A4 = (inv(a) inv(b))
2. Set n = 200 and generate an n n matrix and two vectors in R n, both having integer entries, by setting A = floor(10 rand(n)); b = sum(a ) ; z = ones(n, 1); (Since the matrix and vectors are large, we use semicolons to suppress the printout.) (a) The exact solution of the system Ax = b should be the vector z. Why? Explain. One could compute the solution in MATLAB using the \ operation or by computing A 1 and then multiplying A 1 times b. Let us compare these two computational methods for both speed and accuracy. One can use MATLAB s tic and toc commands to measure the elapsed time for each computation. To do this, use the commands tic, x = A \ b; toc tic, y = inv(a) b; toc Which method is faster? To compare the accuracy of the two methods, we can measure how close the computed solutions x and y are to the exact solution z. Do this with the commands max(abs(x z)) Which method produces the most accurate solution? (b) Repeat part (a), using n = 500 and n = 1000 max(abs(y z)) 3. Set A = floor(10 rand(6)). By construction, the matrix A will have integer entries. Let us change the sixth column of A so as to make the matrix singular. Set B = A, A(:, 6) = sum(b(1 : 5, :)) (a) Set x = ones(6, 1) and use MATLAB to compute Ax. Why do we know that A must be singular? Explain. Check that A is singular by computing its reduced row echelon form. (b) Set B = x [1 : 6] The product AB should equal the zero matrix. Why? Explain. Verify that this is so by computing AB with the MATLAB operation. (c) Set and C = floor(10 rand(6)) D = B + C Although C = D, the products AC and AD should be equal. Why? Explain. Compute A C and A D, and verify that they are indeed equal.
4.. Construct a matrix as follows: Set Why do we know that B must be nonsingular? Set B = eye(10) triu(ones(10), 1) C = inv(b) and x = C(:, 10) Now change B slightly by setting B(10, 1) = 1/256. Use MATLAB to compute the product Bx. From the result of this computation, what can you conclude about the new matrix B? Is it still nonsingular? Explain. Use MATLAB to compute its reduced row echelon form. 5. Using MATLAB. Generate a matrix A by setting A = floor(10 rand(6)) and generate a vector b by setting b = floor(20 rand(6, 1)) - 10 (a) Since A was generated randomly, we would expect it to be nonsingular. The system Ax = b should have a unique solution. Find the solution using the \ operation. Use MATLAB to compute the reduced row echelon form U of [A b]. How does the last column of U compare with the solution x? In exact arithmetic, they should be the same. Why? Explain. To compare the two, compute the difference U(:, 7) x or examine both using format long. (b) Let us now change A so as to make it singular. Set Use MATLAB to compute rre f ([A (c) Set and y = floor(20 rand(6, 1)) - 10 and c = A y A(:, 3) = A(:, 1 : 2) [4 3] b]). How many solutions will the system Ax = b have? Explain. Why do we know that the system Ax = c must be consistent? Explain. Compute the reduced row echelon form U of [A c].how many solutions does the system Ax = c have? Explain. 6. Set A = magic(8) and then compute its reduced row echelon form. The leading 1 s should correspond to the first three variables x 1, x 2, and x 3, and the remaining five variables are all free. a) Set c = [1 : 8] and determine whether the system Ax = c is consistent by computing the reduced row echelon form of [A c]. Does the system turn out to be consistent? Explain. b) Set b = [8 8 8 8 8 8 8 8] ; and consider the system Ax = b. This sys- tem should be consistent. Verify that it is by computing U = rre f ([Ab]). We should be able to find a solution for any choice of the five free variables. Indeed, set x2 = f loor(10 rand(5, 1)). If x2 represents the last five coordinates of a solution of the system, then we should be able to determine x1 = (x 1, x 2, x 3 ) T in terms of x 2. To do this, set U = rre f ([Ab]). The nonzero rows of U correspond to a linear system with block form To solve the above equation, set ( I V ) ( x1 x2 ) = c V = U(1 : 3, 4 : 8), c = U(1 : 3, 9) and use MATLAB to compute x1 in terms of x2, c, and V. Set x = [x1; x2] and verify that x is a solution of the system.
7. In a certain town, 30 percent of the married women get divorced each year and 20 percent of the single women get married each year. There are 8000 married women and 2000 single women. Assuming that the total population of women remains constant, how many married women and how many single women will there be after 3? Guess a formula for the number of married and single women after n years. 8. A toy manufacturer makes toy airplanes, boats, and cars. Each toy is fabricated in a factory F 1 in Taiwan and then assembled in factory F 2 in the U.S. The total cost of each product consists of the manufacturing cost and the shipping cost. Then the costs at each factory (in $ US) can be described as and F 1 = Manuf. F 2 = Ship. 0.32 0.40 0.50 0.80 0.70 0.20 Manuf. Ship. 0.40 0.60 0.50 0.50 1.30 0.20 Airplanes Boats Cars Airplanes Boats Cars Find a matrix that gives the total manufacturing and shipping costs for each product. 9. Suppose that in a primitive society, the members of a tribe are engaged in three occupations: farming, manufacturing of tools and utensils, and the weaving and sewing of clothing. Assume that initially the tribe has no monetary system and that all goods and services are bartered. Let the three groups be denoted by F, M, and C, respectively. Suppose that this directed graph indicates how the bartering system works in practice: F M C 1 1 1 F 3 3 3 M 1 1 1 3 2 6 C 1 1 1 3 6 2 Determine the relative values of x 1, x 2, x 3 to the three types of goods that fairly represent the current bartering system. 10. An inheritance of $24, 000 is to be divided among three trusts, with the second trust receiving twice as much as the first trust. The three trusts pay interest at the rates of 9%, 10%, and 6% annually, respectively, and return a total in interest of $2210 at the end of the first year. How much was invested in each trust?
11. Consider the following chemical equation C 2 H 4 + O 2 CO 2 + H 2 O Balance this chemical reaction. 12. Consider the following chemical equation MnS + As 2 Cr 10 O 35 + H 2 SO 4 HMnO 4 + AsH 3 + CrS 3 O 12 + H 2 O Find the equations, to balance this chemical reaction ( but do not solve them!!!! ).