#install.packages('matlib')
library(matlib)
## Warning: package 'matlib' was built under R version 3.6.2
Pick one of the exercises in the readings this week. Solve the exercise as best as you can. If you have issues, explicate them, so that all of us can help.
A First Course in Linear Algebra page 42. For problems C10-C19, find and all solutions to the system of linear equations. Use your favorite computing device to row-reduce the augmented matrices for the systems, and write the solutions as a set, using correct set notation.
I will provide solutions to Problem C10 and C17 since all the others follow similar format.
\[2x_1 -3x_2 + x_3 + 7x_4 =14\] \[2x_1 + 8x_2 -4x3 + 5x_4 = -1\] \[x_1 + 3x_2 - 3x_3 = 4\] \[-5x_1 + 2x_2 + 3x_3 + 4x_4 = -19\]
A = matrix(c(2,-3,1,7,
2,8,-4,5,
1,3,-3,0,
-5,2,3,4), 4, 4, byrow=TRUE)
b = c(14,-1,4,-19)
echelon(A, b, reduced=TRUE, verbose=TRUE, fractions=TRUE)
##
## Initial matrix:
## [,1] [,2] [,3] [,4] [,5]
## [1,] 2 -3 1 7 14
## [2,] 2 8 -4 5 -1
## [3,] 1 3 -3 0 4
## [4,] -5 2 3 4 -19
##
## row: 1
##
## exchange rows 1 and 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] -5 2 3 4 -19
## [2,] 2 8 -4 5 -1
## [3,] 1 3 -3 0 4
## [4,] 2 -3 1 7 14
##
## multiply row 1 by -1/5
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 -2/5 -3/5 -4/5 19/5
## [2,] 2 8 -4 5 -1
## [3,] 1 3 -3 0 4
## [4,] 2 -3 1 7 14
##
## multiply row 1 by 2 and subtract from row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 -2/5 -3/5 -4/5 19/5
## [2,] 0 44/5 -14/5 33/5 -43/5
## [3,] 1 3 -3 0 4
## [4,] 2 -3 1 7 14
##
## subtract row 1 from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 -2/5 -3/5 -4/5 19/5
## [2,] 0 44/5 -14/5 33/5 -43/5
## [3,] 0 17/5 -12/5 4/5 1/5
## [4,] 2 -3 1 7 14
##
## multiply row 1 by 2 and subtract from row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 -2/5 -3/5 -4/5 19/5
## [2,] 0 44/5 -14/5 33/5 -43/5
## [3,] 0 17/5 -12/5 4/5 1/5
## [4,] 0 -11/5 11/5 43/5 32/5
##
## row: 2
##
## multiply row 2 by 5/44
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 -2/5 -3/5 -4/5 19/5
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 17/5 -12/5 4/5 1/5
## [4,] 0 -11/5 11/5 43/5 32/5
##
## multiply row 2 by 2/5 and add to row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -8/11 -1/2 75/22
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 17/5 -12/5 4/5 1/5
## [4,] 0 -11/5 11/5 43/5 32/5
##
## multiply row 2 by 17/5 and subtract from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -8/11 -1/2 75/22
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 0 -29/22 -7/4 155/44
## [4,] 0 -11/5 11/5 43/5 32/5
##
## multiply row 2 by 11/5 and add to row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -8/11 -1/2 75/22
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 0 -29/22 -7/4 155/44
## [4,] 0 0 3/2 41/4 17/4
##
## row: 3
##
## exchange rows 3 and 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -8/11 -1/2 75/22
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 0 3/2 41/4 17/4
## [4,] 0 0 -29/22 -7/4 155/44
##
## multiply row 3 by 2/3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -8/11 -1/2 75/22
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 -29/22 -7/4 155/44
##
## multiply row 3 by 8/11 and add to row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 295/66 361/66
## [2,] 0 1 -7/22 3/4 -43/44
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 -29/22 -7/4 155/44
##
## multiply row 3 by 7/22 and add to row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 295/66 361/66
## [2,] 0 1 0 193/66 -5/66
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 -29/22 -7/4 155/44
##
## multiply row 3 by 29/22 and add to row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 295/66 361/66
## [2,] 0 1 0 193/66 -5/66
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 0 479/66 479/66
##
## row: 4
##
## multiply row 4 by 66/479
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 295/66 361/66
## [2,] 0 1 0 193/66 -5/66
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 0 1 1
##
## multiply row 4 by 295/66 and subtract from row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 1
## [2,] 0 1 0 193/66 -5/66
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 0 1 1
##
## multiply row 4 by 193/66 and subtract from row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 1
## [2,] 0 1 0 0 -3
## [3,] 0 0 1 41/6 17/6
## [4,] 0 0 0 1 1
##
## multiply row 4 by 41/6 and subtract from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 1
## [2,] 0 1 0 0 -3
## [3,] 0 0 1 0 -4
## [4,] 0 0 0 1 1
\[-x_1 + 5x_2 = -8\] \[-2x_1 + 5x_2 + 5x_3 + 2x_4 = 9\] \[-3x_1 -x_2 + 3x_3 + x_4 = 3\] \[7x_1 + 6x_2 + 5x_3 + x_4 = 30\]
A = matrix(c(-1,5,0,0,
-2,5,5,2,
-3,-1,3,1,
7,6,5,1), 4, 4, byrow=TRUE)
b = c(-8,9,3,30)
echelon(A, b, reduced=TRUE, verbose=TRUE, fractions=TRUE)
##
## Initial matrix:
## [,1] [,2] [,3] [,4] [,5]
## [1,] -1 5 0 0 -8
## [2,] -2 5 5 2 9
## [3,] -3 -1 3 1 3
## [4,] 7 6 5 1 30
##
## row: 1
##
## exchange rows 1 and 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 7 6 5 1 30
## [2,] -2 5 5 2 9
## [3,] -3 -1 3 1 3
## [4,] -1 5 0 0 -8
##
## multiply row 1 by 1/7
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 6/7 5/7 1/7 30/7
## [2,] -2 5 5 2 9
## [3,] -3 -1 3 1 3
## [4,] -1 5 0 0 -8
##
## multiply row 1 by 2 and add to row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 6/7 5/7 1/7 30/7
## [2,] 0 47/7 45/7 16/7 123/7
## [3,] -3 -1 3 1 3
## [4,] -1 5 0 0 -8
##
## multiply row 1 by 3 and add to row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 6/7 5/7 1/7 30/7
## [2,] 0 47/7 45/7 16/7 123/7
## [3,] 0 11/7 36/7 10/7 111/7
## [4,] -1 5 0 0 -8
##
## multiply row 1 by 1 and add to row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 6/7 5/7 1/7 30/7
## [2,] 0 47/7 45/7 16/7 123/7
## [3,] 0 11/7 36/7 10/7 111/7
## [4,] 0 41/7 5/7 1/7 -26/7
##
## row: 2
##
## multiply row 2 by 7/47
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 6/7 5/7 1/7 30/7
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 11/7 36/7 10/7 111/7
## [4,] 0 41/7 5/7 1/7 -26/7
##
## multiply row 2 by 6/7 and subtract from row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -5/47 -7/47 96/47
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 11/7 36/7 10/7 111/7
## [4,] 0 41/7 5/7 1/7 -26/7
##
## multiply row 2 by 11/7 and subtract from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -5/47 -7/47 96/47
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 0 171/47 42/47 552/47
## [4,] 0 41/7 5/7 1/7 -26/7
##
## multiply row 2 by 41/7 and subtract from row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -5/47 -7/47 96/47
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 0 171/47 42/47 552/47
## [4,] 0 0 -230/47 -87/47 -895/47
##
## row: 3
##
## exchange rows 3 and 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -5/47 -7/47 96/47
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 0 -230/47 -87/47 -895/47
## [4,] 0 0 171/47 42/47 552/47
##
## multiply row 3 by -47/230
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 -5/47 -7/47 96/47
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 171/47 42/47 552/47
##
## multiply row 3 by 5/47 and add to row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 -5/46 113/46
## [2,] 0 1 45/47 16/47 123/47
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 171/47 42/47 552/47
##
## multiply row 3 by 45/47 and subtract from row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 -5/46 113/46
## [2,] 0 1 0 -1/46 -51/46
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 171/47 42/47 552/47
##
## multiply row 3 by 171/47 and subtract from row 4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 -5/46 113/46
## [2,] 0 1 0 -1/46 -51/46
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 0 -111/230 -111/46
##
## row: 4
##
## multiply row 4 by -230/111
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 -5/46 113/46
## [2,] 0 1 0 -1/46 -51/46
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 0 1 5
##
## multiply row 4 by 5/46 and add to row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 3
## [2,] 0 1 0 -1/46 -51/46
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 0 1 5
##
## multiply row 4 by 1/46 and add to row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 3
## [2,] 0 1 0 0 -1
## [3,] 0 0 1 87/230 179/46
## [4,] 0 0 0 1 5
##
## multiply row 4 by 87/230 and subtract from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 3
## [2,] 0 1 0 0 -1
## [3,] 0 0 1 0 2
## [4,] 0 0 0 1 5