# COMP350 Numerical Computing Assignment #3: Solving linear systems Solved

30.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . ` zip` solution files instantly, after Payment

## Description

5/5 - (1 vote)
1. (a) (3 points) Solve the following system using GEPP (Gaussian elimination with partial pivoting):
 ï£®âˆ’31 A = ï£¯ï£¯ï£° 42 1 âˆ’3 4 âˆ’2 âˆ’3 âˆ’4 âˆ’4 âˆ’4 154 ï£¹ ï£®1716ï£¹ 88 ï£ºï£ºï£» = ï£¯ï£¯ï£°168 ï£ºï£ºï£»

Show intermediate matrices, vectors and multipliers at each step.

(b) (2 points) Compute the LU factorization of the matrix in the previous question with partial pivoting: PA = LU. You have to show intermediate results at each step. This question and the previous one can be answered together.

Note: Do the computations by your hands and donâ€™t consider any rounding errors.

1. (3 points) Suppose we have a complex linear system Ax = b, where A âˆˆCnÃ—n is nonsingular and b âˆˆCn. Can you solve it in real arithmetic operations? What is the cost?

Hint: Rewrite Ax = b as an equivalent 2n Ã— 2n real linear system.

1. Suppose A âˆˆRnÃ—n is nonsingular.
• (4 points) Given B âˆˆRnÃ—p, show how to use the LU factorization with partial pivoting to solve AX = B. What is the cost of your method?

Hint: AX = B is equivalent to AX(:,j) = B(:,j) for j = 1 : p.

• (5 points) Use m given in the lecture notes to solve AX = B, where 10 Ã— 10 Hilbert matrix A = (aij), aij = 1/(i + j âˆ’ 1);

10 Ã— 5 B = A âˆ—randn(10,5).

Here randn is a MATLAB built-in function to generate a random matrix. Denote this randn(10,5) by Xt and your computed solution by Xc.

• Compute kXc âˆ’ XtkF/kXtkF and Ç«kAkFkAâˆ’1kF, where Ç« is the machine epsilon. Check MTALAB built-in functions or constants norm, cond and eps, to see how to compute or get related quantities.
• Compute the relative residual kB âˆ’ AXcompkF/(kAkFkXcompkF).
1. Run your code 10 times (you may use a loop). Notice each time you have differentB, since Xtrue is random. Answer the following questions:
2. Do you see any rough relation between kXc âˆ’ XtkF/kXtkF and Ç«kAkFkAâˆ’1kF? iii. Do you see any rough relation between kB âˆ’ AXckF/(kAkFkXckF) and Ç« ?

Print out your MATLAB code and the results.

1

(c) Computing Aâˆ’1

1. (3 points) Show how to use the LU factorization with partial pivoting to computethe inverse of a general n Ã— n nonsingular matrix A. What is the cost of your method? (Hint: Think about what matrix equation AX = B you should solve to get Aâˆ’1).

Compute the inverse of a 5 Ã— 5 Hilbert matrix defined in 3(b). Print out your MATLAB code and the result.

1. (3 bonus points) For the sake of simplicity, suppose we use the LU factorizationwith no pivoting to compute Aâˆ’1. Briefly state an algorithm which costs 2n3 You need to explain why its cost is 2n3 flops.

2

• a3-3.zip