4: Sets of linear equations 4.1 Introduction In this course we will usually be dealing with n equations in n unknowns If we have just two unknowns x and y, then each equation is of the form y = mx + c i.e. Each equation represents a straight line Question: What possibilities can occur if we have two equations?
4.1.1 Possibility A: Unique solution If the two lines have different slopes, they cross at exactly one point. y = -x + 5 y = x – 7 E.g. y = x-7 and y = -x+5 x - 7 = -x + 5 2x = 12 x = 6 and y = -1 Find the unique solution by algebra:
4.1.1 Possibility A: Unique solution If the two lines have different slopes, they cross at exactly one point. y = -x + 5 y = x – 7 E.g. y = x-7 and y = -x+5 The matrix-vector system for these equations is: 1 11 x y = x + y = -7 x + y = 5 The determinant of the matrix is: = (-1)(1) – (1)(1) = -2
4.1.1 Possibility B: Infinite Solutions Lines have same slope: then they may coincide. E.g. y = x-7 and 2y = 2x - 14 y = x – 7 Lines parallel, so any point on the line satisfies both equations Solution is: x = α and y = α -7 for any real number α. i.e. Infinite solutions
4.1.1 Possibility B: Infinite Solutions Determinant of matrix: = (-1)(2) – (1)(-2) = 0 y = x – 7 Lines have same slope: then they may coincide. E.g. y = x-7 and 2y = 2x x y = x + y = -7 -2x + 2y = -14 Matrix-vector system:
4.1.1 Possibility C: No Solutions Lines have same slope: but do not meet E.g. y = x-7 and y = x - 5 y = x – 7 No intersection, so no solutions. If there was a solution: x -5 = x – 7 5 = 7 Certainly not true!! y = x – 5
4.1.1 Possibility C: No Solutions Lines have same slope: but do not meet E.g. y = x-7 and y = x - 5 y = x – 7 y = x – 5 Determinant of matrix: 1 1 = (-1)(1) – (1)(-1) = x y = x + y = -7 -x + y = -5 Matrix-vector system:
4.2 General Sets of Equations For a general set of linear equations we have the same three possibilities: A.One unique solution; B.An infinite number of solutions; C.No solutions.
4.2.1 In 3 Dimensions In three dimensions an equation like 2x+4y-z =6 defines a plane. Three such equations give three planes The possibilities are: Unique Solution Infinite Solutions No solutions
4.3 Conditions for a unique solution We will write out set of linear equations in matrix-vector form: a 11 a 22 a nn a 12 a 21 a n1 a 1n a 2n a n2 x1x1 x2x2 xnxn b1b1 b2b2 bnbn = A x=bA x=b We know A and b, but want to find x
4.3 Conditions for a unique solution Whether A x = b has: a unique solution, infinite solutions, or no solutions depends on the determinant |A|. If |A|≠ 0, there is a unique solution to A x = b If |A| = 0, there may be no solutions, or there may be infinitely many solutions. What case are we interested in? It depends...
4.3.1 Homogeneous equations If b = 0, which means: b 1 = b 2 = b 3 = b 4 =... = b n = 0 Then the system A x = 0 is called homogeneous. There is a trivial solution to the problem: x = 0 This is not very interesting, so we look for an infinite set of solutions to A x = 0. Hence, we want |A| = 0.
4.3.2 Inhomogeneous equations If b ≠ 0 then the system A x = b is called inhomogeneous. In this case we want a unique solution i.e. want |A| = 0.
4.3.3 Example A system of simultaneous equations: x + y + z = 6[1] 2x + y – z = 1[2] x – y + 2z = 5[3] Inhomogeneous, so want to look for a unique solution. Write as a matrix-vector system: x y z =
4.3.3 Example x y z = Has a unique solution if determinant is non-zero: = 1x - 1x + 1 x = 1x1 - 1x5 + 1x(-3) = -7 Since determinant is non-zero there is a unique solution.
4.3.3 Example – how to solve the equations? x + y + z = 6[1] 2x + y – z = 1[2] x – y + 2z = 5[3] Add or subtract equations to eliminate variables [2] – 2 x [1]- y - 3z = -11[4] [3] – [1]-2y + z = -1[5] Now eliminate y to find z: [5] – 2 x [4] 7z = 21[6] z = 3 Substituting into [4] gives: -y -9 = -11 y = 2 Substituting into [1] gives: x = 6 x = 1 UNIQUE SOLUTION
4.3.3 Example – analyse the last approach: x + y + z = 6[1] 2x + y – z = 1[2] x – y + 2z = 5[3] Started with 3 equations, so at each stage 3 equations are enough to find the solution. After eliminating x: we got equations [1], [4] and [5]: x + y + z = 6[1] -y – 3z = -11[4] -2y + z = -1[5] After eliminating y: we got equations [1], [4] and [6]: x + y + z = 6[1] -y – 3z = -11[4] 7z = 21[6]
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [4] by [2] – 2 x [1]. In matrix language: “Replace ROW 2 with ( ROW 2 – 2 x ROW 1)” x y z = r 2 r 2 - 2r 1 ROW 2
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [4] by [2] – 2 x [1]. In matrix language: “Replace ROW 2 with ( ROW 2 – 2 x ROW 1)” x y z = r 2 r 2 - 2r 1 ROW 2
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [4] by [2] – 2 x [1]. In matrix language: “Replace ROW 2 with ( ROW 2 – 2 x ROW 1)” x y z = r 2 r 2 - 2r 1 ROW 2
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [4] by [2] – 2 x [1]. In matrix language: “Replace ROW 2 with ( ROW 2 – 2 x ROW 1)” x y z = r 2 r 2 - 2r 1 ROW 2
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [4] by [2] – 2 x [1]. In matrix language: “Replace ROW 2 with ( ROW 2 – 2 x ROW 1)” x y z = r 2 r 2 - 2r 1 ROW 2
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [5] by [3] – [1]. In matrix language: “Replace ROW 3 with ( ROW 3 – ROW 1)” x y z = r 3 r 3 - r 1 ROW 3
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [5] by [3] – [1]. In matrix language: “Replace ROW 3 with ( ROW 3 – ROW 1)” x y z = r 3 r 3 - r 1 ROW 3
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [5] by [3] – [1]. In matrix language: “Replace ROW 3 with ( ROW 3 – ROW 1)” x y z = r 3 r 3 - r 1 ROW 3
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [5] by [3] – [1]. In matrix language: “Replace ROW 3 with ( ROW 3 – ROW 1)” x y z = r 3 r 3 - r 1 ROW 3
4.3.3 Example – Matrix approach: x y z = Remember: wrote equations as Made equation [5] by [3] – [1]. In matrix language: “Replace ROW 3 with ( ROW 3 – ROW 1)” x y z = r 3 r 3 - r 1 ROW 3
4.3.3 Example – Matrix approach: After two row operations we got to Second and third rows represent equations [4] and [5] x y z = We made equation [6] by: [5] – 2 x [4]. In matrix language: “Replace ROW 3 with ( ROW 3 – 2 x ROW 2)” This is because ROW 3 represents [5] and ROW 2 represents [4].
x y z = r 3 r 3 - 2r 2 ROW 3 After two row operations we got to Second and third rows represent equations [4] and [5] x y z = We made equation [6] by: [5] – 2 x [4]. In matrix language: Example – Matrix approach:
x y z = r 3 r 3 - 2r 2 ROW 3 After two row operations we got to Second and third rows represent equations [4] and [5] x y z = We made equation [6] by: [5] – 2 x [4]. In matrix language: Example – Matrix approach:
x y z = r 3 r 3 - 2r 2 ROW 3 After two row operations we got to Second and third rows represent equations [4] and [5] x y z = We made equation [6] by: [5] – 2 x [4]. In matrix language: Example – Matrix approach:
x y z = r 3 r 3 - 2r 2 ROW 3 After two row operations we got to Second and third rows represent equations [4] and [5] x y z = We made equation [6] by: [5] – 2 x [4]. In matrix language: Example – Matrix approach:
x y z = So, we went from Example – Matrix approach: To x y z = r 2 r 2 - 2r 1
x y z = So, we went from Example – Matrix approach: To r 2 r 2 - 2r 1 r 3 r 3 - r x y z =
x y z = So, we went from Example – Matrix approach: To r 2 r 2 - 2r 1 r 3 r 3 - r 1 r 3 r 3 - 2r x y z = Now can solve from the bottom up as before.
4.4. Gaussian Elimination x y z = x y z = We just transformed: At each step we eliminated one variable from one equation i.e. created a zero in the matrix Repeated to get an upper triangular matrix Can make this a formal, automated process. It is called Gaussian Elimination
4.4. Standard Gaussian Elimination Permitted Row Operations: Swap two rows; Add a multiple of a row to another row; Subtract a multiple of a row from another row. r 2 r 2 - 2r 1 r 1 r 2 r 3 r 3 + 4r 1
Adding a constant to an equation: Dividing equations Reducing the number of equations: The following operations are not allowed: 4.4. Standard Gaussian Elimination r 1 r 1 +2 r 2 r 2 /r 1 r 2 r 2 – r 1 r 1 r 1 – r 2
After a number of row operations we get to a ‘final’ matrix. E.g Generalised Row Echelon Form However, other ‘final’ matrices may look like: This is called the generalised row echelon form of the matrix
However, other ‘final’ matrices may look like: The definition of the ‘final’ matrix is that it is in generalised row echelon form which is: 1.The first (furthest left) non-zero element of each row is to the right of the first non-zero element in the row above it. 2.Any all-zero rows are at the bottom Generalised Row Echelon Form
4.4.2 Augmented Matrix notation We perform row operations on the matrix and the row on the other side: x y z = Combine both of these into one matrix called the augmented matrix: