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 \]

A = cbind(c(1,1,-1,1),c(1,0,1,2),c(1,3,-5,-1),c(-1,-1,1,1))
b = c(2,4,-6,4)
Ab = cbind(A,b)
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
  1. 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} \]

  1. Let’s make two different solutions. One with s = 0 and one with s = 1. They are
x1 = c(6,-2,0,2)
x2 = c(3,0,1,2)

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:

A %*% x1
##      [,1]
## [1,]    2
## [2,]    4
## [3,]   -6
## [4,]    4
A %*% x2
##      [,1]
## [1,]    2
## [2,]    4
## [3,]   -6
## [4,]    4

Notice that we get b for both.

  1. Now we look at the difference. It is a solution to the homogeneous equations A x = 0 as we see here:
xh = x1 - x2
A %*% xh
##      [,1]
## [1,]    0
## [2,]    0
## [3,]    0
## [4,]    0
  1. Are any of these vectors solutions to Ax=b?
A %*% (x1 + x2)
##      [,1]
## [1,]    4
## [2,]    8
## [3,]  -12
## [4,]    8

No! (this is 2b)

A %*% (1/2*x1 + 1/2* x2)
##      [,1]
## [1,]    2
## [2,]    4
## [3,]   -6
## [4,]    4

Yes! This is b

A %*% (x1 + 2021 * xh)
##      [,1]
## [1,]    2
## [2,]    4
## [3,]   -6
## [4,]    4

Yes! This is b.