Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SOLVING HOMOGENEOUS SYSTEMS EXERCISE 5 (5 points) Difficulty: Hard Theory: In this exercise, you will work with the solution set of a homogeneous linear system
SOLVING HOMOGENEOUS SYSTEMS EXERCISE 5 (5 points) Difficulty: Hard Theory: In this exercise, you will work with the solution set of a homogeneous linear system Ax=0, where A is an mxn matrix and xe R". If the system has only the trivial solution (there are no free variables), the spanning set for the solution set is the zero vector of R". If the system has non-trivial solutions (there is at least one free variable), we can obtain a spanning set for the solution set by solving the system using row reduction algorithm - this spanning set is also linearly independent and, therefore, forms a basis for the solution set. Later on, we will call the solution set of a homogeneous system 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 when the Null space contains non-zero vectors. Important: Before you proceed with the coding, you need to solve sample homogeneous systems by hand in order to develop an algorithm: work with the reduced echelon forms of some of the matrices (a)-(k) listed at the end of this exercise and present the solution sets that contain non-zero vectors in a parametric-vector form (as a span of a set of vectors) with the free variables as parameters. **Create a function in MATLAB that begins with the lines: function C homobasis (A) format [m,n]-size (A); red_ech_form-rats (rref (A)); C-IT; Note: We output here (but do not display) the reduced echelon form of A as a character array with rational approximations of the entries. If you wish to use this output for your hand computations, you will need to remove temporarily the semicolon at the end of the command and re-run the code. Please keep this output suppressed for the submission. **First, your function has to check if the system Ax=0 has only the trivial solution, x=0. It happens if and only if there are no free variables (or, equivalently, all columns of A are pivot columns). If this is the case, output the message: disp ('the homogeneous system has only the trivial solution') 7 and Display vector Chere and teminate the program Bite-MATLAB command in this p **If the system has nontrivial solutions, that is, there are variables in the ye equivalently, there are non-pivot columns in Al output a message solution set the Null space of Al Is onder to proceed with this task, we will need ordered sets of indexes of the post and non-pest columns of A The command that outputs the ordered set of indexes of the p The set of commands below outputs the ordered set of index of the The next set of consumages that livable Include into your code all the commands listed above **After you have identified the free variables and non-pivot column, you can begin to contact a basis for the solution set which will be formed by the columns of any C Hint: Pre-locate mais Ca and and then calculate in rows using matrices assignments to the set of rows of C whose indexes are from the set rows of C whose indexes are from the set You will and to the sof analy your hand cat a he **Finally, use a conditional statement to check whether the columes of Cindeed for the solution set of the homogeneous system. Since the number of orkums of C is quit the number of the variables in the system As-, we only need to verify that the conditions bold (1) the set of the column of C is linearly independent as the cond (2) the column of C are solutions of As-8, or, equivalently, AC is an (use here the function with p-5) both conditions (1) and (2), hold your output will be otherwise, an output mage could be something like case, the empty output for C will say Receiving the last message should prompt yo for errors in your code and co This is the end of the function homebas **Type the functions closetozero roundoff and homobasis in your Live Script. **Run the function C-homobasis (A); on the following matrices: (a) A [1-1 -1 2-2 54 41 (b) A-[1 2 3] (c) A-magic (3) (d) A [magic (3), ones (3,1)] (e) A magic (4) $(f) A-[0 1 2 3/0 24 6] (g) A-10 10 20 3; 0 20 40 6; 0408061 % (h) A [10 20 3;2050 61 (k) A [1 0 0 2 3; 2004 61 (1) A hilb (4) SOLVING HOMOGENEOUS SYSTEMS EXERCISE 5 (5 points) Difficulty: Hard Theory: In this exercise, you will work with the solution set of a homogeneous linear system Ax=0, where A is an mxn matrix and xe R". If the system has only the trivial solution (there are no free variables), the spanning set for the solution set is the zero vector of R". If the system has non-trivial solutions (there is at least one free variable), we can obtain a spanning set for the solution set by solving the system using row reduction algorithm - this spanning set is also linearly independent and, therefore, forms a basis for the solution set. Later on, we will call the solution set of a homogeneous system 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 when the Null space contains non-zero vectors. Important: Before you proceed with the coding, you need to solve sample homogeneous systems by hand in order to develop an algorithm: work with the reduced echelon forms of some of the matrices (a)-(k) listed at the end of this exercise and present the solution sets that contain non-zero vectors in a parametric-vector form (as a span of a set of vectors) with the free variables as parameters. **Create a function in MATLAB that begins with the lines: function C homobasis (A) format [m,n]-size (A); red_ech_form-rats (rref (A)); C-IT; Note: We output here (but do not display) the reduced echelon form of A as a character array with rational approximations of the entries. If you wish to use this output for your hand computations, you will need to remove temporarily the semicolon at the end of the command and re-run the code. Please keep this output suppressed for the submission. **First, your function has to check if the system Ax=0 has only the trivial solution, x=0. It happens if and only if there are no free variables (or, equivalently, all columns of A are pivot columns). If this is the case, output the message: disp ('the homogeneous system has only the trivial solution') 7 and assign C-zeros (n, 1) Display vector C here and terminate the program. Hint: use a built-in MATLAB command rank in this part. **If the system has nontrivial solutions, that is, there are free variables in the system (or equivalently, there are non-pivot columns in A), output a message the homogeneous system has non-trivial solutions', and your code will continue with constructing a basis for the solution set (the Null space of A). In order to proceed with this task, we will need to find the ordered sets of indexes of the pivot and non-pivot columns of A. The command that outputs the ordered set of indexes of the pivot columns is: 1.pivot_c)-rref (A); The set of commands below outputs the ordered set of indexes of the non-pivot columns: S-1:0 nonpivot cesetdiff (3,pivot_e); The next set of commands output messages that list free variables: g-numel (nonpivot_c); -1:9 printf('a free variable is xii ',nonpivot_{3}) Include into your code all the commands listed above. **After you have identified the free variables and non-pivot columns, you can begin to construct a basis for the solution set which will be formed by the columns of an nxq matrix C. Hint: Pre-locate matrix C as C-zeros (n,q): and, then, recalculate its rows using matrices rret (A) and eye (q). You will make different assignments to the set of rows of C whose indexes are from the set pivot_c and to the set of rows of C whose indexes are from the set nonpivot_e (analyze your hand calculations!). **Finally, use a conditional statement to check whether the columns of C indeed form a basis for the solution set of the homogeneous system. Since the number of columns of C is equal to the number of free variables in the system Ax-0, we only need to verify that the following two conditions hold: (1) the set of the columns of C is linearly independent (use the command rank here); (2) the columns of C are solutions of Ax 0, or, equivalently, A*C is an mxq zero matrix (use here the function closetozeroroundoff with p-5). **If both conditions, (1) and (2), hold, your output will be: disp('columns of C form a basis for solution set of homogeneous ayates') otherwise, an output message could be something like: "Not a basis? Impossible! In this case, the empty output for C will stay. Receiving the last message should prompt you to look for errors in your code and correct them! This is the end of the function homobasis. **Type the functions closetozero roundoff and homobasis in your Live Script. **Run the function C-homobasis (A); on the following matrices: (a) A [1-1 -1 2-2 54 41 (b) A-[1 2 3] (c) A-magic (3) (d) A [magic (3), ones (3,1)] (e) A magic (4) $(f) A-[0 1 2 3/0 24 6] (g) A-10 10 20 3; 0 20 40 6; 0408061 % (h) A [10 20 3;2050 61 (k) A [1 0 0 2 3; 2004 61 (1) A hilb (4)
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