An Overdetermined Set

(a) Solve the following equations by hand and (b) solve them using MATLAB. Discuss the solution for two cases: c = 9 and c = 10.

x+y=1
x + 2)’ = 3
x +5y = c

• Solution
(a) To solve these equations by hand, subtract the first equation from the second to obtain )’ = 2. Substitute this value into the first equation to obtain x = -I. Substituting these values into the third equation gives -I + 10 = c, which is satisfied only if c = 9. Thus a solution exists if and only if c = 9. (b) The coefficient matrix and the augmented matrix for this problem are (a) To solve these equations by hand, subtract the first equation from the second to obtain )’ = 2. Substitute this value into the first equation to obtain x = -I. Substituting these values into the third equation gives -I + 10 = c, which is satisfied only if c = 9. Thus a solution exists if and only if c = 9. (b) The coefficient matrix and the augmented matrix for this problem are In MATLAB, enter the array A = [ 1 , 1; 1, 2 ; 1, 5) . For c = 9, type b = [ 1 ; 3 ; 9) ; the rank (A) and rank ( [A b)) commands give the result that rank(A) = rank([A b)) = 2.Thus the system has a solution and, because the number of unknowns (two) equals the rank of A, the solution is unique. The left-division method A\b gives this solution, which is x = -I and y = 2.

Force = 10,type b = [1; 3; 10); the rank (A) and rank ( [A\ b) ) commands give the result that rank(A) = 2, but rank([A b)) = 3. Because rank(A) :f: rank([A b)), no solution exists. However, the left-division method A\ b gives x = -1.3846 and y = 2.2692, which is not a solution! This conclusion can be verified by substituting these values into the original equation set. This answer is the solution to the equation set in a least squares sense. That is, these values are the values of x and y that minimize J, the sum of the squares of the differences between the equations’ left and right sides.

J = (x + y – 1)2 + (x + 2y – 3)2 + (x + 5y – 10)2

The MATLAB left-division operator sometimes gives the least squares solution when we use the operator to solve problems for which there is no exact solution. A solution exists when c = 9, but no solution exists when c = 10.The left-division method gives the exact solution when c = 9 but gives the least squares solution when c = 10.