ENGG2013 Unit 3 RREF and Applications of Linear Equations Jan, 2011.
A motivating example A TRAFFIC FLOW PROBLEM kshum ENGG2013
A Traffic flow problem A round-about connecting 5 roads http://www.beyond.ca/how-to-navigate-a-traffic-circle-roundabout/210.html 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
Modeling a round-about 100 200 150 400 x1 x2 x4 x3 x5 100 300 The unit is number of vehicles per hour. 50 50 150 100 Can we find x1, x2, x3, x4 and x5? kshum ENGG2013
In-flow = out-flow 100 200 150 400 x1 x2 x4 x3 x5 100 300 50 50 150 \begin{align*} x_1 - x_2 &= 150-100 = 50\\ x_2 - x_3 &= 50-150 = -100\\ x_3 - x_4 &= 100-50 = 50\\ x_4 - x_5 &= 300-400 = -100\\ x_5 - x_1 &= 200-100 = 100 \end{align*} 50 150 100 kshum ENGG2013
We need to solve … x1 x2 x3 x4 x5 Representation using augmented matrix kshum ENGG2013
Last time: Gaussian elimination Step 1: Try to transform the matrix into upper triangular form Step 2: Backward substitution kshum ENGG2013
Row operations (5) (5)+(1) (5) (5)+(2) (5) (5)+(3) (5) (5)+(4) Equation 5 is redundant kshum ENGG2013
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 get: 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. 0 x4 = x5 – 100 x3 = (x5 – 100) + 50 = x5 – 50 x2 = (x5 – 50) – 100 = x5 – 150 x1 = (x5 – 150) + 50 = x5 – 100 kshum ENGG2013
General solution System of linear equations: Solution: where f is a real number larger than or equal to 150 This is called the general solution because all possible solutions can be put in this form kshum ENGG2013
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
REDUCED ROW ECHELON FORM kshum ENGG2013
Pivot Example from last time pivot pivots (2) (2) – (1) (3) (3) + (2)/2 pivots kshum ENGG2013
Sometimes we cannot find pivot (2) (2) – 2(1) (3) (3) – 3(1) Cannot find a pivot in the second column kshum ENGG2013
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
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
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
Non-examples of RREF kshum ENGG2013
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
A row reduction algorithm Scan the columns from left to right. Start from the 1st column. If this column contains a pivot (a nonzero entry), move the pivot to the top by exchanging rows kshum ENGG2013
Algorithm (cont’d) Make all entries below and above the pivot equal to 0. Move to the next column and try to locate a nonzero entry which is not in any row already containing a pivot. Repeat step 5 until you can find such column. kshum ENGG2013
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 is kshum ENGG2013
SOLVING LINEAR EQUATIONS USING RREF kshum ENGG2013
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 x (2 – 2x) / 3 2/3 1 2 -2/3 3 -4/3 2x+3y=2 x x is a parameter whose value can be freely chosen. kshum ENGG2013
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 (1 – x2)^0.5 1 0.2 0.9798 0.4 0.9165 0.6 0.8 0.8 0.6 1 x x is a parameter whose value can be freely chosen. kshum ENGG2013
There are many choices for parameters 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
Parametric representations of a plane 2x + 3y – z = 5 If x and y are the parameters, the representation is x = free y = free z = 2x+3y–5 If y and z are the parameters, the representation is If x and z are the parameters, the representation is x = (5+z–3y)/2 y = free z = free x = free y = (5+z–2x)/3 z = free kshum ENGG2013
Parametric representation of the solutions to a linear system First row reduce the system of linear equations to a reduced row echelon form. Solve Transform to RREF kshum ENGG2013
Pick the free variable(s) 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
Solve for the non-free variables Express the “non-free” variables in terms of the “free” variables. kshum ENGG2013
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
The solutions in set notation stands for the set of all triples with real numbers as components means “belong to” kshum ENGG2013
How to plot the solutions? z is the parameter z x = 2+z y= – 1 – 2z -2 3 -1 1 2 –1 –3 4 –5 5 –7 We get (0,3,-2), (1,1,-1), (2,-1,0) etc, as solutions to kshum ENGG2013
Solution Set The solutions form a straight line in the 3-D space. kshum ENGG2013
A PRODUCTION MODEL IN ECONOMICS Application 1 A PRODUCTION MODEL IN ECONOMICS kshum ENGG2013
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 Coal mine 50 tons of coal 100 tons of steel 10 tons of steel 100 tons of coal kshum ENGG2013
Question We want to produce 400 tons of steel and 300 tons of coal. 200 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. Does not work! 30 300 kshum ENGG2013
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 Total output of the steel plant 0.1 xC goes to the coal mine 400 tons are exported 0.1 xC 300 0.5 xS Total output of the coal mine 0.5 xS goes to the steel plant 300 tons are exported kshum ENGG2013
Solve a system of two equations In augmented matrix form Solution: xS = 452.63 xC = 526.32 kshum ENGG2013
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
Leontief’s input-output model 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) http://en.wikipedia.org/wiki/Wassily_Leontief kshum ENGG2013
EQUILIBRIUM PRICE IN AN ECONOMY Application 2 EQUILIBRIUM PRICE IN AN ECONOMY kshum ENGG2013
An example of three industries 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. Steel 0.1 0.6 0.1 0.5 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.1 0.3 0.4 Electric Power 0.7 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 Coal kshum ENGG2013
Distribution of outputs Steel 0.1 0.1 0.6 Electric Power 0.5 0.1 0.3 0.4 Output From Purchased by Steel Coal Power 0.1 0.5 0.3 0.2 0.4 0.6 0.7 0.7 0.2 Coal kshum ENGG2013
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
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 Purchased by Steel Coal Power 0.1 0.5 0.3 0.2 0.4 0.6 0.7 kshum ENGG2013
Solve the system of equations Short-hand notation using augmented matrix kshum ENGG2013
Find the solutions from reduced row echelon form Choose Pe as the free variable Ps = 44/69 Pe Pc = 17/23 Pe Pe = any positive real number Transform to RREF Pivots free Ps Pc Pe kshum ENGG2013
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
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 under-determined. Linear algebra has applications in economics, for example in finding equilibrium. kshum ENGG2013