Solving Linear Functions
Solving Linear Functions
x + 3(2) – 4(3) = -7
x = -1
If just using the coefficients, the matrix is called the coefficient matrix.
3 4
4 −2
Row-Echelon Form
• A row-echelon form is when a matrix has 1’s down the main diagonal
from the upper left corner to the lower right corner, and zeros in
every position below the main diagonal.
• Example:
1 𝑎 𝑏
0 1 𝑑
0 0 1
Row-Echelon Form
• To obtain a row-echelon form:
• In any nonzero row, the first nonzero number is a 1. It is called a leading 1.
• Any all-zero rows are placed at the bottom on the matrix.
• Any leading 1 is below and to the right of a previous leading 1.
• Any column containing a leading 1 has zeros in all other positions in the
column.
• A strategy to get the row-echelon form of a matrix is called the
Gaussian elimination method.
Gauss Elimination Method
1. The first equation should have a leading coefficient of 1. Interchange
rows or multiply by a constant, if necessary.
2. Use row operations to obtain zeros down the first column below the first
entry of 1.
3. Use row operations to obtain a 1 in row 2, column 2.
4. Use row operations to obtain zeros down column 2, below the entry of 1.
5. Use row operations to obtain a 1 in row 3, column 3.
6. Continue this process for all rows until there is a 1 in every entry down
the main diagonal and there are only zeros below.
7. If any rows contain all zeros, place them at the bottom.
Gauss Elimination Method
• Row operations that can be done when transforming to row-echelon
form are:
• Interchange rows (switch rows with each other)
• Multiply a row by a constant
• Add the product of a row and a constant to another row (multiplying a row
first with a constant then adding it to another row)
Gauss Elimination Method
• Example:
Given the equations, solve using Gaussian elimination:
Equation 1: 2x + 3y = 6
Equation 2: x – y = ½
2 3 6 1
1 ; 𝑅1 𝑅2 = 1 −1
2
1 −1
2 2 3 6
Gauss Elimination Method
• Answer:
Step 2: Use row operations to obtain zeros down the first column below
the first entry of 1.
1 1
1 −1 ; −2𝑅1 + 𝑅2 = 𝑅2; 1 −1
2 2
2 3 6 0 5 5
Gauss Elimination Method
• Answer:
Step 3: Use row operations to obtain a 1 in row 2, column 2.
1 1 1
1 −1 ; 𝑅2 = 𝑅2; 1 −1
2 5 2
0 5 5 0 1 1
Gauss Elimination Method
• Answer:
The second row can be interpreted as y = 1. Use this to solve for x using
the first equation.
x+1=½
x = 3/2
Step 2:
1 1 1 1
1 ; −4𝑅1 + 𝑅2 = 𝑅2; 1
2 2 2 2
4 2 6 0 0 4
Gauss Elimination Method
• The second row can be interpreted as 0 = 4. Therefore, the system
has no solution.
1 1
1
2 2
0 0 4
Gauss-Jordan Reduction Method
• The Gauss-Jordan reduction method is an extension of the Gauss
elimination method.
• In this method, a reduced row-echelon form is made, wherein all the
variables above and below the leading one is converted to zero.
• The same method for the Gauss elimination is used, except we only
stop until the next row/s and column/s after the last leading one is
zero or non-existent.
Gauss-Jordan Reduction Method
• Example:
Find the solution to the set of equations using Gauss-Jordan reduction.
Equation 1: x + 2y – z=2
Equation 2: x + y – z = 0
Equation 3: 2x – y + z = 3
The augmented matrix is:
1 2 −1 2
1 1 −1 0
2 −1 1 3
Gauss-Jordan Reduction Method
• Answer:
Step 1:
R2 = R2 – R1
R3 = R3 – 2R1
1 2 −1 2
0 −1 0 −2
0 −5 3 −1
Gauss-Jordan Reduction Method
• Answer:
Step 2:
R2 = –R2
1 2 −1 2
0 1 0 2
0 −5 3 −1
Gauss-Jordan Reduction Method
• Answer:
Step 3:
R3 = R3 – 5R2
1 2 −1 2
0 1 0 2
0 0 3 9
Gauss-Jordan Reduction Method
• Answer:
Step 4:
R3 = (1/3)R3
1 2 −1 2
0 1 0 2
0 0 1 3
Gauss-Jordan Reduction Method
• Answer:
Step 5:
R1 = R1 – 2R2
1 0 −1 −2
0 1 0 2
0 0 1 3
Gauss-Jordan Reduction Method
• Answer:
Step 6:
R1 = R1 + R3
1 0 0 1
0 1 0 2
0 0 1 3
Gauss-Jordan Reduction Method
• Answer:
To interpret, row 1 is x = 1, row 2 is y = 2, and row 3 is z = 3.
1 0 0 1
0 1 0 2
0 0 1 3
Gauss-Jordan Reduction Method
• If during the method, a column cannot be reduced further and it does
not have a leading one, it is called a free variable.
Gauss-Jordan Reduction Method
• Example:
Find the solution to the set of equations using Gauss-Jordan reduction.
Equation 1: x + y – z – w = 2
Equation 2: x – y – z + w = 4
Equation 3: 2x + y – z + w = 1
The augmented matrix is:
1 1 −1 −1 2
1 −1 −1 1 4
2 1 −1 1 1
Gauss-Jordan Reduction Method
• Answer:
Step 1:
R2 = R2 – R1
R3 = R3 – 2R1
1 1 −1 −1 2
0 −2 0 2 2
0 −1 1 3 −3
Gauss-Jordan Reduction Method
• Answer:
Step 2:
R2 = (-½)R2
1 1 −1 −1 2
0 1 0 −1 −1
0 −1 1 3 −3
Gauss-Jordan Reduction Method
• Answer:
Step 3:
R1 = R1 – R2
R3 = R3 + R2
1 0 −1 0 3
0 1 0 −1 −1
0 0 1 2 −4
Gauss-Jordan Reduction Method
• Answer:
Step 4:
R1 = R1 + R3
1 0 0 2 −1
0 1 0 −1 −1
0 0 1 2 −4
Since there are no other rows after the leading one on the third row
and all values above and below all leading ones are zero, we stop.
Gauss-Jordan Reduction Method
• Answer:
Since the column on w has no leading one, w is a free variable. Free variables
can be assigned a variable value (example, “a”).
1 0 0 2 −1
0 1 0 −1 −1
0 0 1 2 −4
w becomes w = a
x becomes x = -1 – 2a
y becomes y = -1 + a
z becomes z = -4 – 2a
Inverse Application Method
• To solve a system of linear functions using the inverse of a matrix, the
system is divided into three parts: A, X, and B.
• A is the coefficient matrix
• X is the variable matrix
• B is the constant matrix
• The solution for this method utilizes the inverse of A, and multiplying
it with B.
𝑋 = 𝐴−1 𝐵
Inverse Application Method
• Example:
Find the solution to the set of equations using Inverse application.
Equation 1: 5x + 15y + 56z = 35
Equation 2: -4x – 11y – 41z = -26
Equation 3: -x – 3y – 11z = -7
Inverse Application Method
• Answer:
Write the equation as AX=B.
5 15 56 𝑥 35
−4 −11 −41 𝑦 = −26
−1 −3 −11 𝑧 −7
Inverse Application Method
• Answer:
Get the inverse of A by augmenting it with an identity matrix, and
reducing to reduced row-echelon form.
5 15 56 1 0 0
−4 −11 −41 0 1 0
−1 −3 −11 0 0 1
Inverse Application Method
• Answer:
Iteration 1 (multiply row 1 by 1/5):
1 3 56/5 1/5 0 0
−4 −11 −41 0 1 0
−1 −3 −11 0 0 1
Inverse Application Method
• Answer:
Iteration 2 (multiply row 1 by 4 then add to row 2; add row 1 to row 3):
1 3 56/5 1/5 0 0
0 1 19/5 4/5 1 0
0 0 1/5 1/5 0 1
Inverse Application Method
• Answer:
Iteration 3 (multiply row 2 by -3 then add to row 1; multiply row 3 by
5):
1 0 −1/5 −11/5 −3 0
0 1 19/5 4/5 1 0
0 0 1 1 0 5
Inverse Application Method
• Answer:
Iteration 4 (multiply row 3 by 1/5 then add to row 1; multiply row 3 by
-19/5 then add to row 2):
1 0 0 −2 −3 1
0 1 0 −3 1 −19
0 0 1 1 0 5
Inverse Application Method
• Answer:
Based on the last iteration:
−2 −3 1
𝐴−1 = −3 1 −19
1 0 5
Inverse Application Method
• Answer:
Multiply the inverse of A with B to get the answer.
−2 −3 1 35 1
𝐴−1 𝐵 = −3 1 −19 −26 = 2
1 0 5 −7 0
𝑑1 𝑏1 𝑐1 𝑎1 𝑑1 𝑐1 𝑎1 𝑏1 𝑑1
𝑑2 𝑏2 𝑐2 𝑎2 𝑑2 𝑐2 𝑎2 𝑏2 𝑑2
𝐷𝑥 𝑑3 𝑏3 𝑐3 𝐷𝑦 𝑎3 𝑑3 𝑐3 𝐷𝑧 𝑎3 𝑏3 𝑑3
𝑥= = ; 𝑦= = ;𝑧 = =
𝐷 𝑎1 𝑏1 𝑐1 𝐷 𝑎1 𝑏1 𝑐1 𝐷 𝑎1 𝑏1 𝑐1
𝑎2 𝑏2 𝑐2 𝑎2 𝑏2 𝑐2 𝑎2 𝑏2 𝑐2
𝑎3 𝑏3 𝑐3 𝑎3 𝑏3 𝑐3 𝑎3 𝑏3 𝑐3
L-U Decomposition Method
• The L-U Decomposition Method of a matrix is the factorization of a
given square matrix into two triangular matrices, one upper triangular
matrix and one lower triangular matrix, such that the product of
these two matrices gives the original matrix.
L-U Decomposition Method
• Steps:
1. Write the system as AX=B (same as the inverse application method)
2. Reduce matrix A to its lower-triangular matrix (defined as L) and its upper-
triangular matrix (defined as U):
1 0 0
𝐿 = 𝑙21 1 0
𝑙31 𝑙32 1
𝑢11 𝑢12 𝑢13
𝑈= 0 𝑢22 𝑢23
0 0 𝑢33
L-U Decomposition Method
• Steps:
3. Digits for L are taken from the values multiplied to the main diagonal digit
above them in order to convert them to 0.
4. Once the digits corresponding to L from matrix A are reduced to 0, the
remaining matrix is matrix U.
5. Once L and U are obtained, compute for matrix Z using the formula:
𝐿𝑍 = 𝐵
6. Once Z is obtained, solve for X using:
𝑈𝑋 = 𝑍
L-U Decomposition Method
• Example:
Solve for the following using L-U Decomposition method:
Equation 1: 5x + 15y + 56z = 35
Equation 2: -4x – 11y – 41z = -26
Equation 3: -x – 3y – 11z = -7
L-U Decomposition Method
• Answer:
Write the equation as AX=B.
5 15 56 𝑥 35
−4 −11 −41 𝑦 = −26
−1 −3 −11 𝑧 −7
L-U Decomposition Method
• Answer:
Find L and U.
5 15 56
−4 −11 −41
−1 −3 −11
L32 will be 0.
1 0 0
𝐿 = −4/5 1 0
−1/5 0 1
L-U Decomposition Method
• Answer:
Since all L values are obtained, the resulting matrix is matrix U.
5 15 56
𝑈 = 0 1 19/5
0 0 1/5
1 0 0
𝐿 = −4/5 1 0
−1/5 0 1
L-U Decomposition Method
• Answer:
Get Z using LZ=B.
1 0 0 𝑧1 35
−4/5 1 0 𝑧2 = −26
−1/5 0 1 𝑧3 −7
Z1 = 35
(-4/5)Z1 + Z2 = -26; Z2 = 2
(-1/5)Z1 + Z3 = -7; Z3 = 0
L-U Decomposition Method
• Answer:
Get X using UX=Z.
5 15 56 𝑥 35
0 1 19/5 𝑦 = 2
0 0 1/5 𝑧 0
5x + 15y + 56z = 35; x = 1
y + 19/5z = 2; y = 2
1/5z = 0; z = 0
Thank you!