advertisement

ENGG2013 Unit 3 RREF and Applications of Linear Equations Jan, 2011. A motivating example A TRAFFIC FLOW PROBLEM kshum ENGG2013 2 http://www.beyond.ca/how-to-navigate-a-traffic-circle-roundabout/210.html A Traffic flow problem • A round-about connecting 5 roads • The traffic within the circle is counter-clockwise. • Question: model the traffic in each section of the round-about kshum ENGG2013 3 Modeling a round-about 100 200 150 400 x1 100 x5 300 x2 x4 50 The unit is number of vehicles per hour. x3 50 150 100 Can we find x1, x2, x3, x4 and x5? kshum ENGG2013 4 In-flow = out-flow 100 200 150 400 x1 100 x5 x2 300 x4 50 x3 50 150 kshum 100 ENGG2013 5 We need to solve … x1 x2 x3 x4 x5 Representation using augmented matrix kshum ENGG2013 6 Last time: Gaussian elimination • Step 1: Try to transform the matrix into upper triangular form • Step 2: Backward substitution kshum ENGG2013 7 Row operations (5) (5)+(1) (5) (5)+(2) (5) (5)+(3) (5) (5)+(4) kshum Equation 5 is redundant ENGG2013 8 Choose a free variable • In this example, we can pick any variable as the “free variable”. • Let’s pick x5 as the free variable for example. • Expressed in terms of x5, we x = x – 100 0 get: 4 5 x3 = (x5 – 100) + 50 = x5 – 50 0 But x1 to x5 are traffic flow in the round-about and cannot be negative. This restricts the value of x5 to be at least 150. x2 = (x5 – 50) – 100 = x5 – 150 0 x1 = (x5 – 150) + 50 = x5 – 100 0 kshum ENGG2013 9 General solution System of linear equations: Solution: This is called the general solution because all possible solutions can be put in this form kshum ENGG2013 where f is a real number larger than or equal to 150 10 Discussions • The system of linear equations is underdetermined. – A car endlessly going around the circle without exiting is undetectable in this model. – We cannot determine the traffic flow uniquely – There are infinitely many solutions. – How to remove redundant equalities in general? • The variables in this example are subject to non-negativity constraint. – In many applications, the variables cannot be negative. kshum ENGG2013 11 REDUCED ROW ECHELON FORM kshum ENGG2013 12 Pivot • Example from last time pivot (2) (2) – (1) (3) (3) + (2)/2 kshum pivots ENGG2013 13 Sometimes we cannot find pivot (2) (2) – 2(1) (3) (3) – 3(1) Cannot find a pivot in the second column kshum ENGG2013 14 Row Echelon Form (REF) • A leading entry in a row means the first nonzero entry from the left. • A rectangular matrix is in row echelon form if – All nonzero rows are above any all-zero row. – All entries below a leading entry are zeros. – In any pair of adjacent nonzero row, say row i and row i+1, the leading entry in row i is to the left of the leading entry of row i+1. • Examples (triangles indicate the leading entries) kshum ENGG2013 15 Non-examples of REF – All nonzero rows are above any all-zero row. – All entries below a leading entry are zeros. – In any pair of adjacent nonzero row, say row i and row i+1, the leading entry in row i is to the left of the leading entry of row i+1. kshum ENGG2013 16 Reduced Row Echelon Form (RREF) – All nonzero rows are above any all-zero row. – All entries above and below a leading entry are zeros. – In any pair of adjacent nonzero row, say row i and row i+1, the leading entry in row i is to the left of the leading entry of row i+1. – All leading entries are equal to 1. The concept of RREF applies to all matrices in general, not just augmented matrix. Examples kshum ENGG2013 17 Non-examples of RREF kshum ENGG2013 18 Theorem • By applying the three types of elementary row operations, we can reduce any rectangular matrix to a matrix in reduced row echelon form (RREF). (In other words, any matrix is row equivalent to a matrix in RREF) • Furthermore, the RREF of a matrix is unique. kshum ENGG2013 19 A row reduction algorithm 1. Scan the columns from left to right. 2. Start from the 1st column. 3. If this column contains a pivot (a nonzero entry), move the pivot to the top by exchanging rows kshum ENGG2013 20 Algorithm (cont’d) 4. Make all entries below and above the pivot equal to 0. 5. Move to the next column and try to locate a nonzero entry which is not in any row already containing a pivot. 6. Repeat step 5 until you can find such column. kshum ENGG2013 21 Algorithm (cont’d) • Repeat step 3 to step 6 until we reach the right-most column. • Finally, normalize all leading entries to 1. The RREF of kshum is ENGG2013 22 SOLVING LINEAR EQUATIONS USING RREF kshum ENGG2013 23 Parametric representation • How to represent a solution set? • Example: How to plot points on a straight line? We can solve for y in terms of x y = (2 – 2x) / 3 y 2x+3y=2 x x (2 – 2x) / 3 0 2/3 1 0 2 -2/3 3 -4/3 x is a parameter whose value can be freely chosen. kshum ENGG2013 24 Parametric representation of circle • How about a circle x2+y2=1? We can also solve for y in terms of x y = (1 – x2)^(1/2) y x x (1 – x2)^0.5 0 1 0.2 0.9798 0.4 0.9165 0.6 0.8 0.8 0.6 1 0 x is a parameter whose value can be freely chosen. kshum ENGG2013 25 There are many choices for parameters y y 2x+3y=2 x x We can pick y as the parameter We can pick as the parameter x = (2 –3y)/2 y = free x = cos y = sin between 0 and 2 kshum ENGG2013 26 Parametric representations of a plane • 2x + 3y – z = 5 5 If x and y are the parameters, the representation is z 0 -5 -10 x = free y = free z = 2x+3y–5 -15 2 1 2 1 0 0 -1 If y and z are the parameters, the representation is x = (5+z–3y)/2 y = free z = free kshum y -1 -2 -2 If x and z are the parameters, the representation is x = free y = (5+z–2x)/3 z = free ENGG2013 x 27 Parametric representation of the solutions to a linear system 1. First row reduce the system of linear equations to a reduced row echelon form. Solve Transform to RREF kshum ENGG2013 28 Pick the free variable(s) 2. Pick the variable(s) which is/are not associated with a column with pivot as “free variable”. x y z Pick z as a free variable kshum ENGG2013 29 Solve for the non-free variables • Express the “non-free” variables in terms of the “free” variables. kshum ENGG2013 30 General solution • The general solution to can be represented parametrically as General solution means 1) All solutions can be written in this form 2) Every (x,y,z) in this form is a solution. kshum ENGG2013 31 The solutions in set notation stands for the set of all triples with real numbers as components means “belong to” kshum ENGG2013 32 How to plot the solutions? z is the parameter z x = 2+z y= – 1 – 2z -2 0 3 -1 1 1 0 2 –1 1 3 –3 2 4 –5 3 5 –7 We get (0,3,-2), (1,1,-1), (2,-1,0) etc, as solutions to kshum ENGG2013 33 Solution Set The solutions form a straight line in the 3-D space. 10 z 5 0 -5 5 -10 -5 0 0 5 -5 y x kshum ENGG2013 34 Application 1 A PRODUCTION MODEL IN ECONOMICS kshum ENGG2013 35 A production model in economics • Consider a close economy – one steel plant – one coal mine • To produce 1 ton of steel, 0.5 ton of coal is consumed by the steel plant. • To produce 1 ton of coal, 0.1 ton of steel is used. Steel Plant 50 tons of coal kshum Coal mine 100 tons of steel 10 tons of steel ENGG2013 100 tons of coal 36 Question • We want to produce 400 tons of steel and 300 tons of coal. 400 200 Does not work! 30 To produce 1 ton of steel, we need 0.5 ton of coal. To produce 1 ton of coal, we need 0.1 ton of steel. 300 kshum ENGG2013 37 • Formulation as a linear system Suppose that the total output of steel plant is xS and the total output of coal mine is xC. 400 0.1 xC Total output of the steel plant 0.1 xC goes to the coal mine 400 tons are exported 0.5 xS Total output of the coal mine 0.5 xS goes to the steel plant 300 tons are exported 300 kshum ENGG2013 38 Solve a system of two equations In augmented matrix form kshum Solution: xS = 452.63 xC = 526.32 ENGG2013 39 Internal consumption xS = 452.63 Steel Plant 400 tons of steel 226.32 tons of coal 52.63 tons of steel Coal mine 300 tons of coal xC = 526.32 The red links indicate internal consumption kshum ENGG2013 40 • Proposed by Prof. Wassily Leontief (1905~1999) from Harvard. • He modeled the economy of USA using linear algebra. • From wikipedia: “Around 1949, Leontief used the primitive computer systems available at the time at Harvard to model data provided by the U.S. Bureau of Labor Statistics to divide the U.S. economy into 500 sectors. Leontief modeled each sector with a linear equation based on the data and used the computer, the Harvard Mark II, to solve the system, one of the first significant uses of computers for mathematical modeling”. • Nobel prize in economics (1973) kshum ENGG2013 41 http://en.wikipedia.org/wiki/Wassily_Leontief Leontief’s input-output model Application 2 EQUILIBRIUM PRICE IN AN ECONOMY kshum ENGG2013 42 An example of three industries Steel 0.1 0.6 0.1 0.1 of the total output from coal industry goes to the steel industry, and 0.7 of the total output goes to the electric power industry. 0.5 0.1 0.3 0.4 0.7 Coal kshum Electric Power 0.4 of the total output from the electric power industry goes to the coal mines, and 0.5 of the total output goes to the steel plants 0.6 of the total output from the steel industry goes to the electric power industry, 0.3 of the output goes to the coal industry. 0.2 ENGG2013 43 Distribution of outputs Steel 0.1 0.1 0.6 Electric Power 0.5 0.1 0.3 0.4 Output From Steel Coal Power Purchased by 0.1 0.1 0.5 Steel 0.3 0.2 0.4 Coal 0.6 0.7 0.1 Power 0.7 Coal kshum 0.2 ENGG2013 44 Question • Can we find the prices of steel, coal, power, such that the cost to each industry is balanced with the income – can we find an equilibrium price ? kshum ENGG2013 45 Balancing income and expenditure • Let the price, or value, of steel, coal and electric power be Ps, Pc and Pe respectively. • From “Expenditure = Income”, we get three equations Output From kshum Steel Coal Power Purchased by 0.1 0.1 0.5 Steel 0.3 0.2 0.4 Coal 0.6 0.7 0.1 Power ENGG2013 46 Solve the system of equations Short-hand notation using augmented matrix kshum ENGG2013 47 Find the solutions from reduced row echelon form Choose Pe as the free variable Ps = 44/69 Pe Pc = 17/23 Pe Transform to RREF Pe = any positive real number Pivots free Ps kshum Pc Pe ENGG2013 48 The equilibrium price • There are infinitely many solutions. – Any constant multiple of them is also a solution. • For example, if Pe =1, we have – Ps = 44/69 = 0.64 – Pc = 17/23 = 0.74 – Pe = 1 (electric power is the most valuable in this example) • If Pe =100, the equilibrium prices are – Ps = 44/69 = 64 – Pc = 17/23 = 74 – Pe = 100 • There is no unique solution. It depends on the currency, RMB, Yen, USD etc. kshum ENGG2013 49 Summary • In many problems, the solutions are not unique. • Reduced row echelon form is a useful in solving for the general solution, especially when the system of linear equations is underdetermined. • Linear algebra has applications in economics, for example in finding equilibrium. kshum ENGG2013 50