Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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 xeR". 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=[]; 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: [-,pivot_c]=rref (A); The set of commands below outputs the ordered set of indexes of the non-pivot columns: S=1:n; nonpivot_c=setdiff (S, pivot_c); j=1:9; The next set of commands output messages that list free variables: q=numel (nonpivot_c); fprintf('a free variable is x$i ', nonpivot_c(j)) 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-allocate matrix C as C-zeros in,q); and, then, recalculate its rows using matrices rref (A) and eye (9). 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_c (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 form a basis for solution set of homogeneous system') 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. 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 xeR". 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=[]; 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: [-,pivot_c]=rref (A); The set of commands below outputs the ordered set of indexes of the non-pivot columns: S=1:n; nonpivot_c=setdiff (S, pivot_c); j=1:9; The next set of commands output messages that list free variables: q=numel (nonpivot_c); fprintf('a free variable is x$i ', nonpivot_c(j)) 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-allocate matrix C as C-zeros in,q); and, then, recalculate its rows using matrices rref (A) and eye (9). 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_c (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 form a basis for solution set of homogeneous system') 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

Is conflict always unhealthy? Why or why not? (Objective 4)

Answered: 1 week ago