Section 15 Class Examples
15.1 Day 5: Tuesday May 25
Give the parametric solution to \(A x = b\) if \[ A=\left[ \begin{array}{ccccc} 1 & 1 & 1 & -1 \\ 1 & 0 & 3 & -1 \\ -1 & 1 & -5 & 1 \\ 1 & 2 & -1 & 1 \\ \end{array} \right] \qquad \hbox{and}\qquad b = \begin{bmatrix} 2 \\ 4 \\ -6 \\ 4 \end{bmatrix}. \hskip.5in \]
= cbind(c(1,1,-1,1),c(1,0,1,2),c(1,3,-5,-1),c(-1,-1,1,1))
A = c(2,4,-6,4)
b = cbind(A,b)
Ab A
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 -1
## [2,] 1 0 3 -1
## [3,] -1 1 -5 1
## [4,] 1 2 -1 1
Ab
## b
## [1,] 1 1 1 -1 2
## [2,] 1 0 3 -1 4
## [3,] -1 1 -5 1 -6
## [4,] 1 2 -1 1 4
rref(Ab)
## b
## [1,] 1 0 3 0 6
## [2,] 0 1 -2 0 -2
## [3,] 0 0 0 1 2
## [4,] 0 0 0 0 0
- Give the solution this \(Ax=b\) problem in parametric form:
\[ \begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \end{bmatrix} = \begin{bmatrix} 6 \\ -2 \\ 0 \\ 2 \end{bmatrix} + s \begin{bmatrix} -3 \\ 2 \\ 1 \\ 0 \end{bmatrix} \]
- Let’s make two different solutions. One with s = 0 and one with s = 1. They are
= c(6,-2,0,2)
x1 = c(3,0,1,2) x2
And we check to see that they are solutions. Observe that we use the unfortunate notation %*%
to multply a matrix times a vector, but also that we get b in both cases:
%*% x1 A
## [,1]
## [1,] 2
## [2,] 4
## [3,] -6
## [4,] 4
%*% x2 A
## [,1]
## [1,] 2
## [2,] 4
## [3,] -6
## [4,] 4
Notice that we get b for both.
- Now we look at the difference. It is a solution to the homogeneous equations A x = 0 as we see here:
= x1 - x2
xh %*% xh A
## [,1]
## [1,] 0
## [2,] 0
## [3,] 0
## [4,] 0
- Are any of these vectors solutions to Ax=b?
%*% (x1 + x2) A
## [,1]
## [1,] 4
## [2,] 8
## [3,] -12
## [4,] 8
No! (this is 2b)
%*% (1/2*x1 + 1/2* x2) A
## [,1]
## [1,] 2
## [2,] 4
## [3,] -6
## [4,] 4
Yes! This is b
%*% (x1 + 2021 * xh) A
## [,1]
## [1,] 2
## [2,] 4
## [3,] -6
## [4,] 4
Yes! This is b.