Ch3.1.2: Systems of Equations and Elementary Row Operations

Systems of Linear Equations

  • A system of linear equations has the following form, and can be expressed in matrix-vector form \( A\mathbf{x} = \mathbf{b} \):

\[ \matrix{ x_1 & + & 2x_2 & = & 5 \cr 3x_1 & - & 4 x_2 & = & 6 } ~~ \Leftrightarrow \begin{bmatrix} 1 & 2 \\ 3 & -4 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 5 \\ 6 \end{bmatrix} \]

  • Alternatively, we can express the system as an augmented matrix; this is common when solving by hand.

\[ \matrix{ x_1 & + & 2x_2 & = & 5 \cr 3x_1 & - & 4 x_2 & = & 6 } ~~ \Leftrightarrow \begin{bmatrix} 1 & 2 & 5 \\ 3 & -4 & 6 \end{bmatrix} \]

Application of Linear System of Equations

  • A system of linear equations can model network flow.
  • An example of this is traffic within a roundabout.

title

Horizon Drive Roundabout

  • Math 225 project

title

  • Traffic flow numbers

title

Eight Equations, Eight Unknowns

  • System of Equations

title

  • Traffic flow numbers

title

Reduced Echelon Form

  • Equations

title

titletitle

Overview of Solution Method

  • We seek to transform our given system of equations into a new system that has same solution set as the original system.
  • In figure below, the bottom right matrix is in row echelon form (upper triangular form).

title

Overview of Solution Method

  • Use elementary row operations to transform system of equations into a easier system with same solution.

title

Elementary Row Operations

  • Row swap
  • Row scale
  • Replace a row with the sum of that row and a scalar multiple of another row (rotate or “pivot” the line)

title

Pivot Operation

  • Graph two lines.

title

  • Add to get third line.

title

Equivalent Systems

  • To save space, third line often replaces one of the other lines.

title

  • The sum of two lines (green) preserves solution.

title

Pivot Operation

  • Pivoting applies to \( 3 \times 3 \) systems (planes) and higher dimension systems (hyperplanes).

title

Elementary Row Operations & R Code

swaprows <- function (m, row1 , row2 ) {
row.tmp <- m[row1 ,]
m[row1 ,] <- m[row2 ,]
m[row2 ,] <- row.tmp
return (m)  }
scalerow <- function (m, row , k) {
m[row ,] <- m[row ,] * k
return (m)  }
replacerow <- function (m, row1 , row2 , k) {
m[row2 ,] <- m[row2 ,] + m[row1 ,] * k
return (m)   }  

Example: Row Swap

(A <- matrix(c(2,1,-6,8,1,2,-4,5,4,-1,-12,13),3))
     [,1] [,2] [,3] [,4]
[1,]    2    8   -4   -1
[2,]    1    1    5  -12
[3,]   -6    2    4   13
swaprows(A,1,2)
     [,1] [,2] [,3] [,4]
[1,]    1    1    5  -12
[2,]    2    8   -4   -1
[3,]   -6    2    4   13

Example: Row Scale

(A <- matrix(c(2,1,-6,8,1,2,-4,5,4,-1,-12,13),3))
     [,1] [,2] [,3] [,4]
[1,]    2    8   -4   -1
[2,]    1    1    5  -12
[3,]   -6    2    4   13
scalerow(A,2,2)
     [,1] [,2] [,3] [,4]
[1,]    2    8   -4   -1
[2,]    2    2   10  -24
[3,]   -6    2    4   13

Example: Row Replace (Pivot Line)

(A <- matrix(c(2,1,-6,8,1,2,-4,5,4,-1,-12,13),3))
     [,1] [,2] [,3] [,4]
[1,]    2    8   -4   -1
[2,]    1    1    5  -12
[3,]   -6    2    4   13
replacerow(A,1,3,3)
     [,1] [,2] [,3] [,4]
[1,]    2    8   -4   -1
[2,]    1    1    5  -12
[3,]    0   26   -8   10

What's Ahead: Gauss Elimination Method

  • Use elementary row operates to swap, scale and pivot the rows to obtain upper triangular form (row echelon form).
  • After that, use back substitution to solve the system.

title