Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ExercIse5 (6 points) Difficulty: Hard Theory: In this exercise, you will analyze the solution set of a homogeneous linear system Ax -0, where xeR and
ExercIse5 (6 points) Difficulty: Hard Theory: In this exercise, you will analyze the solution set of a homogeneous linear system Ax -0, where xeR" and A is an mxn matrix. If the system has only the trivial solution (there are no free variables), the spanning set for the solution set consists of the zero vector only. If the system has non-trivial solutions (there is at least one free variable), the spanning set for the solutions obtained by solving the system by row reduction algorithm is also linearly independent and, therefore, forms a basis for the solution set. Later on, we will call the solution set of a homogeneous equation Ax 0 the Null space of the matrix A; thus, in this exercise, we are creating a basis for the Null space of a matrix A. Note: Before proceeding with programming, you are advised to solve a sample homogeneous system by hand using row reduction algorithm to see how the spanning set is formed and, then, program it in your file You will do the following **Create a function in MATLAB starting with these lines function C = homobasis (A) m-size (A,1); n-size (A,2) format rat red_echform-rref (A) 4 Note: The reduced echelon form of A has to be an output as well (do not place a semicolon at the end of the command red_ech_form-rref (A)). This form will allow you to verify by the inspection whether the results you obtain are correct First, your function has to check if the system has only the trivial solution x -0. It happens if and only if all columns of A are pivot columns (no free variables). In this case, the outputs have to be: (1) the zero vector, C-zeros (n,1), and the message: 'the homogeneous system has only the trivial solution' Otherwise, there are free variables and non-pivot columns in A. This has to be stated with a message: 'the homogeneous system has non-trivial solutions'. Your code has to output the ordered indexes of the non-pivot columns. The command [-,pivot c]=rref (A) ; gives the set of indexes of the pivot columns; the commands S-1:ni P-setdiff(s,pivot_c); output the set of indexes of all columns (S) and the set of indexes of non-pivot columns (P) The set of commands below will help you to output the messages that list all free variables q-length (P) fprintf("A free variable is x% ', P(i)); Second, after you have identified the free variables and non-pivot columns, you can proceed to constructing a spanning set of vectors for the solution set, which are to form the columns of an nxq matrix C. Hint: the matrix C has to be constructed using matrices rref(A) and eye(q) Specifically, if a matrix B is obtained from rref(A) by removing the pivot columns and non- pivot rows, then, the rows of C, whose indexes are pivot_c, match the rows of matrix (-B), and the rows of C whose indexes are from the set P (or non-pivot columns) match the rows of cye(). Make sure that you will check your output matrix C on correctness by using rref(A) Finally, you would need to check if you did find a basis for the solution set of a homogeneous system. All the following conditions must hold: (1) the number of rows of C is n (the number of entries in x), (2) the number of columns of C is q (the number of free variables in the system), (3) the columns of C are lincarly independent (equivalently, rank(C) is equals the number of columns of C), and (4) the columns of C are solutions of Ax 0 (equivalently A*C is an mxq zero matrix). Note: There may be a problem with verifying the last condition due to a round off error in calculating the matrix product, which may result in a very small by absolute value entries in places of zeros. Therefore, **you need to create another function in the file, named closetozeroroundoff, that will replace the entries, which are smaller than 10, with zeros. The code is given below: function B-closetozeroroundoff (A) m, n size (A) for i-1:m for j-1:n if abs (A(1,j))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started