Lab 2 Solving Systems of Linear Equations in Matrix Form with rref

advertisement
Lab 2
Solving Systems of Linear Equations in Matrix Form with rref
Learning Goals
Determine the solution of a system of equations from the augmented matrix
Determine the reduced row echelon form of the augmented matrix, rref
Keywords: system of linear equations, matrix form or system of linear equations, augmented
matrix, rref
Example 1: Solve the system of linear equations in the two variables x and y
x
2x
y
4y
4
14
The matrix form of this equation, AX B , the matrix of coefficients times the vector of
variables set equal to the right hand side vector of constants, is written as
1
2
1
4
x
y
4
14
The matrix form, the vector form, and the augmented matrix form, respectively, for the system of
equations are
1 1 x
4
2 4 y
14
Matrix form
1
1
4
y
2
4
14
Vector form of equations
x
1 1 4
2 4 14
Augmented form
The augmented matrix will be entered into the MATLAB and the rref command will be used to
help find the solution. The rref command computes the reduced row echelon form of a matrix.
We will store our augmented matrix into the 2 3 (two rows and three columns) matrix A . The
MATLAB commands to complete the problem with the associated MATLAB results follow.
A=[1 -1 4;2 4 14]
A=
1 -1 4
2 4 14
rref(A)
ans =
1 0 5
0 1 1
The reduced row echelon form of the augmented matrix means that the original problem has
been transformed to a system of equations where the solution is easy to determine. The rref
11
Lab 2 Solving Systems with rref
version of the augmented matrix has 2 pivots and no free variables so the system of equations
will have a unique solution. The equation form of the rref result is:
5
1
x
y
Solution type: Unique solution; solution: x 5, y 1. The solution of the system of equations is
the ordered pair 5,1 . The equations will both be true at the same time if x 5 and y 1 .
Graphically, this means that the two equations represent straight lines that intersect at exactly
one point. The solution, in vector form, is
5
1
x
y
Example 2: Solve the system of linear equations in the two variables x and y
y
3y
2x
3x
12
To put the system of equations into matrix form and then the augmented matrix form we need to
rewrite the system so that the x ’s and the y ’s are lined up on one side of the equation and the
constant part is on the other side.
3x
2x
y
3y
0
12
The matrix, vector, and augmented matrix forms, respectively, of the equations are
3 1 x
0
2 3 y
12
Matrix form
3
1
0
y
2
3
12
Vector form of equations
x
3 1 0
2 3 12
Augmented form
Enter the augmented matrix into the MATLAB and use the rref command to help find the
solution of the system of equations. MATLAB displays
1
0
0
1
1.0909
3.2727
Again: 2 pivots and no free variables so the system of equations has a unique solution.
12
Lab 2 Solving Systems with rref
Solution type: Unique solution; solution: x 1.0909 , y 3.2727 .
12
36
The exact solutions are x
and y
. To display the answer in fraction form (as
11
11
rational numbers) enter format rat, then redo the rref work. The solution is the ordered pair,
12 36
,
. Graphically, the equations represent two straight lines that intersect at exactly one
11 11
point, a unique solution.
Example 3: Solve the system of linear equations in the two variables x and y
2x
6x
y
3y
4
6
The matrix and augmented matrix forms of the equations are
2
6
1 x
4
3 y
6
Matrix form
2 1 4
6 3 6
Augmented form
Enter the augmented matrix into the MATLAB and use the rref command to help find the
solution of the system of equations. MATLAB displays
1
0
-.5 0
0 1
The rref version of the augmented matrix has 1 pivot and 1 free variable so the system of
equations will not have a unique solution. From the reduced row echelon form of the augmented
matrix, our original problem has been transformed to one of the form
x
0.5 y
0
0
1
Solution type: Contradiction; solution: No Solution or inconsistent.
There are no pairs of x, y that satisfy both equations at the same time. Graphically, the
equations represent parallel lines with no points in common.
Example 4: Solve the system of linear equations in the two variables x and y
4x
2y
y
8x
2
4
The matrix and augmented matrix forms of the equations are
13
Lab 2 Solving Systems with rref
4 1 x
2
4 1 2
8 2 y
4
8 2 4
Enter the augmented matrix into the MATLAB and use the rref command to help find the
solution of the system of equations. MATLAB displays
1 -0.25
0
0
0.5
0
The transformed equations are:
0.25 y
0
x
0.5
0
The rref result indicates 1 pivot and 1 free variable so no unique solution. Solution type:
Consistent and dependent or Identity; solution: x 0.25 y 0.5, y
( y is any real number).
Alternately, one may write: x 0.25t 0.5, t
or
x, y | x
0.25t , t
. Some sample
solutions: x 1, y
2, x
2, y 10 .
Vector form of solution. The vector form of the solutions is determined from the
transformed equations that are written using the rref version of the augmented matrix. The
regular variables are solved in terms of the free variables from the transformed equations and the
free variables set equal to themselves. The vector form of the solution is:
0.25 y 0.5
y
x
y
Parametric form of solution. The general solution of AX B is X vh p , where vh
is the solution of the homogeneous problem, AX 0 , and p is the particular part of the solution
due to a nonzero right hand side vector, B . The parametric form of the solution to the linear
system of equations AX B with the parameter t is:
x
y
t
0.25
1
0.5
, t
0
; then : vh
t
0.25
,p
1
0.5
0
Example 5: Three equations with three unknowns. Solve the system of linear equations in
the three variables x , y , and z .
x
y
4z
4
2x
4x
4y
z
3z
14
8
The matrix and vector forms of the equations and the augmented matrix of the equations are
14
Lab 2 Solving Systems with rref
1
2
4
1 4 x
4
4
1 y
14
0 3 z
8
Matrix form
1
1
4
4
x 2 y 4
z 1
14
4
0
3
8
Vector form of equations
1 1 4 4
2 4
1 14
4 0 3 8
Augmented form
The augmented matrix is entered into MATLAB and the rref command applied to determine the
solution of the system of equations. Store the augmented matrix into the 3 4 (three rows and
four columns) matrix A using the EDIT option of the MATLAB MATRIX menus. MATLAB
commands and results are
A=[1 -1 4 4;2 4 -1 14;4 0 3 8]
A=
1 -1 4 4
2 4 -1 14
4 0 3 8
rref(A)
ans =
1.0000
0
0 0.7143
0 1.0000
0 3.5714
0
0 1.0000 1.7143
The rref version of the augmented matrix has 3 pivots with no free variables so the system of
equations will have a unique solution. Solution type: Unique solution.
Solution: x 0.714285 , y 3.57142 , z 1.71428 . Vector form of the solution:
x
y
z
.714285...
3.57142...
1.71428...
The solution of the system of equations is the ordered triple
0.714285 , 3.57142 ,1.71428 , that is, the equations will all be true at the same time if
x 0.714285
, y 3.57142
, and z 1.71428
.
Geometrically the three equations represent
three planes that intersect at exactly one point. The general solution of AX
so the parametric form of the solution to the linear system above is:
x
y
z
0
t 0
0
0.714285
3.57142
1.71428
0.714285
3.57142
1.71428
; with : vh
0
0 ,p
0
B is X
vh
p,
0.714285
3.57142
1.71428
Note: Here the homogeneous part of the solution is the zero vector since AX B has a unique
solution for any right hand side. This also means that AX 0 has only the zero solution X 0 .
Thus the particular solution is the unique solution of the problem for right hand side B .
15
Lab 2 Solving Systems with rref
Exercises
Solve the following systems of equations using augmented matrices and the rref command in
MATLAB. Determine the augmented matrix, the equivalent form as transformed by rref, write
down the new transformed system of equations from the rref result, and the solution, if any. Also
write out the vector form of the equations and the solution in parametric form. Identify the
particular, p, and homogeneous, vh , parts of the vector form. Indicate the number of pivots and
circle the pivot columns of the augmented matrix.
1. Determine: augmented matrix, rref equivalent form, and the solution, if any.
x y 3
Augmented matrix:
2x y 3
rref result:
new equation from rref result:
Number of pivots ____ Free variables ______
Solution: x
___________ y
Solution type: ________________
____________
Vector form of solution:
p=
, vh =
Parametric form of solution:
2. Determine: augmented matrix, rref equivalent form, and the solution, if any.
10 x 15 y 20
Augmented matrix:
2x
rref result:
3y
4
new equation from rref result:
Number of pivots ____ Free variables ______ Solution type: ________________
Solution: x ___________ y ____________
Vector form of solution:
Parametric form of solution:
16
p=
, vh =
Lab 2 Solving Systems with rref
3. Determine: augmented matrix, rref equivalent form, and the solution, if any.
4x 6 y 3
2x 3 y
Augmented matrix:
rref result:
Number of pivots ____ Free variables ______
Solution: x
___________ y
3
new equation from rref result:
Solution type: ________________
____________
Vector form of solution:
p=
, vh =
Parametric form of solution:
4. Determine: augmented matrix, rref equivalent form, and the solution, if any.
x y
z 4
2x 4 y 6z
6
x 3y 2z 2
Augmented matrix:
rref result:
new equation from rref result:
Number of pivots ____ Free variables ______
Solution: x
___________ y
Vector form of solution:
Solution type: ________________
____________ z
___________________
p=
, vh =
Parametric form of solution:
17
Lab 2 Solving Systems with rref
5. Determine: augmented matrix, rref equivalent form, and the solution, if any.
x y
z 4
2x 4z 5
2x 4z
5
Augmented matrix:
rref result:
new equation from rref result:
Number of pivots ____ Free variables ______
Solution: x
___________ y
Solution type: ________________
____________ z
Vector form of solution:
___________________
p=
, vh =
Parametric form of solution:
6. Determine: augmented matrix, rref equivalent form, and the solution, if any.
x1 x2 2 x3 5
2 x1 x2
x1 8 x2
Augmented matrix:
18
, vh =
x3
3
x1 5 x2 12 x3 41
rref result:
new equation from rref result:
Number of pivots ____ Free variables ______
Vector form of solution:
p=
1
Solution type: ________________
, Parametric form of solution:
Lab 2 Solving Systems with rref
7. Determine: augmented matrix, rref equivalent form, and the solution, if any.
3x1 x2
x3 2 x4
2
x1 2 x2
Augmented matrix:
x3
x4
1
x1 3x2 2 x3 4 x4
6
rref result:
new equation from rref result:
Number of pivots ____ Free variables ______
Solution type: ________________
Solution: _________________________________________
Vector form of solution:
p=
, vh =
Parametric form of solution:
Challenge Problem 1. Determine a value(s) of the right hand side number of equation 4 of
Problem 6 so the new system of equations has a unique solution, that is, replace 41 with a
number that results in a consistent system of equations. Write out the new system of equations,
the rref result and the solution. Provide a printout of your MATLAB work.
Challenge Problem 2. Determine new equations, to add a 4th equation to the system of equations
of problem 7, so that:
a. the 4th equation leads to a new system of equations with a unique solution.
b. the 4th equation leads to a new system of equations that is inconsistent.
In each case write out the new system of equations and the equations from the rref result that
illustrate the stated conditions. Print your MATLAB work to corroborate that your equations
satisfy the stated conditions.
19
Download