Question: Exercise 2 -- solving Ax = b (30 points; 10 points per part) In this exercise, you use RREF and Rouch-Capelli Theorem to determine if
Exercise 2 -- solving Ax = b (30 points; 10 points per part)
In this exercise, you use RREF and Rouch-Capelli Theorem to determine if Ax = b is consistent. You may need the following commands for this exercise.
The command rref(A) returns the reduced row echelon form of a matrix A
The command [B,pivot] = rref(A) returns the matrix B = rref(A) and pivot indicates pivot columns
The command rank(A) returns the rank of a matrix A
You also need two m-file functions rank_comp (given) and LS_solution (template only). In these functions, you need to know
if-else statement: If expression is true, it executes the statements1 block. Otherwise, it executes the statements2 block.
if expression statements1 else statements2 end
if-elseif statement: If expression1 is true, it executes the statements1 block. If not, check expression2. If expression2 is true, it executes the statements2 block. If not, executes the statements3 block.
if expression1 statements1 elseif expression2 statements2 else statements3 end
(a) Use the reduced row echelon form (RREF) to solve Ax = b, where A and b are indicated in Exercise 1, and type your answer for the following in the Live Editor.
Display the reduced row echelon form and the pivot columns of the augmented matrix [A b].
Write a report in Live Editor to explain if there is a solution of Ax = b.
(b) Verify Rouch-Capelli Theorem (see Lecture 2) by checking the rank(A) and rank([A b]).
Call the function rank_comp and determine if Ax = b is consistent.
Compare the result with part (a)
Note: rank_comp gives you a new command to compare if rank(A) = rank([A b]). When you need to use the command, read the comments in the m-file function first and call the function by typing the name of the function, rank_comp(A,B), in the Live Editor where A and B are the two input matrices.
(c) Open the template LS_solution, and write the code using if-elseif statement (by modifying rank_comp.m). Call LS_solution and display the result for Ax = b as one of the following.
The system Ax = b is inconsistent and it has no solution, or
The system Ax = b is consistent and it has a unique solution, or
The system Ax = b is consistent and it has infinitely many solutions
Note: You should include three inputs (n, A, Ab) for LS_solution, where n is the number of variables in the system of equation. You need to also submit LS_solution.m as a pdf file (click Print, and select Print to PDF). If you print the m-file function correctly, it should show the time stamp (see the image below) on your pdf file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
