ENGG2013 Unit 3 RREF and Applications of Linear Equations

50
ENGG2013 Unit 3 RREF and Applications of Linear Equations Jan, 2011.

description

ENGG2013 Unit 3 RREF and Applications of Linear Equations. Jan, 2011. A motivating example. A TRAFFIC FLOW PROBLEM. 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. - PowerPoint PPT Presentation

Transcript of ENGG2013 Unit 3 RREF and Applications of Linear Equations

Page 1: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

ENGG2013Unit 3 RREF and

Applications of Linear EquationsJan, 2011.

Page 2: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

A TRAFFIC FLOW PROBLEMA motivating example

kshum ENGG2013 2

Page 3: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

http

://w

ww

.bey

ond.

ca/h

ow-t

o-na

viga

te-a

-tra

ffic-

circ

le-r

ound

abou

t/210

.htm

l

Page 4: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Modeling a round-about

kshum ENGG2013 4

100

150

50

150 10050

300

400

200100

x1

x2

x4

x3

x5

Can we find x1, x2, x3, x4 and x5?

The unit is numberof vehicles perhour.

Page 5: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

In-flow = out-flow

kshum ENGG2013 5

100

150

50

150 10050

300

400

200100

x1

x2

x4

x3

x5

Page 6: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

We need to solve …

kshum ENGG2013 6

x1 x2 x3 x4 x5

Representationusing augmented matrix

Page 7: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Last time: Gaussian elimination

• Step 1: Try to transform the matrix into upper triangular form

• Step 2: Backward substitution

kshum ENGG2013 7

Page 8: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Row operations

kshum ENGG2013 8

(5) (5)+(1)

(5) (5)+(2)

(5) (5)+(3)

(5) (5)+(4) Equation 5 is redundant

Page 9: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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:

kshum ENGG2013 9

x4 = x5 – 100

x3 = (x5 – 100) + 50 = x5 – 50

x2 = (x5 – 50) – 100 = x5 – 150

x1 = (x5 – 150) + 50 = x5 – 100

But x1 to x5 are trafficflow in the round-aboutand cannot be negative.This restricts the value ofx5 to be at least 150. 0

0

0

0

Page 10: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

General solution

kshum ENGG2013 10

where f is a real numberlarger than or equal to 150

Solution:

System of linear equations:

This is called the general solutionbecause all possible solutionscan be put in this form

Page 11: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 12: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

REDUCED ROW ECHELON FORM

kshum ENGG2013 12

Page 13: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Pivot

• Example from last time

kshum ENGG2013 13

pivot

(2) (2) – (1)

(3) (3) + (2)/2pivots

Page 14: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Sometimes we cannot find pivot

kshum ENGG2013 14

(2) (2) – 2(1)

(3) (3) – 3(1)

Cannot find a pivotin the second column

Page 15: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 16: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Non-examples of REF

kshum ENGG2013 16

– 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.

Page 17: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Reduced Row Echelon Form (RREF)

kshum ENGG2013 17

– 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.

Examples

The concept of RREF appliesto all matrices in general, not just augmented matrix.

Page 18: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Non-examples of RREF

kshum ENGG2013 18

Page 19: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 20: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 21: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 22: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Algorithm (cont’d)

• Repeat step 3 to step 6 until we reach the right-most column.

• Finally, normalize all leading entries to 1.

kshum ENGG2013 22

The RREF of is

Page 23: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

SOLVING LINEAR EQUATIONS USING RREF

kshum ENGG2013 23

Page 24: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Parametric representation

• How to represent a solution set?• Example: How to plot points on a straight line?

kshum ENGG2013 24

y

x

2x+3y=2

We can solve for yin terms of xy = (2 – 2x) / 3

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.

Page 25: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Parametric representation of circle

• How about a circle x2+y2=1?

kshum ENGG2013 25

y

x

We can also solve for yin terms of xy = (1 – x2)^(1/2)

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.

Page 26: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

There are many choices for parameters

kshum ENGG2013 26

y

x

2x+3y=2

x = (2 –3y)/2y = free

We can pick y as the parameter

y

x

We can pick as the parameter

x = cos y = sin

between 0 and 2

Page 27: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Parametric representations of a plane

• 2x + 3y – z = 5

kshum ENGG2013 27

-2-1

01

2

-2

-1

0

1

2-15

-10

-5

0

5

xy

z

x = freey = freez = 2x+3y–5

If x and y are the parameters,the representation is

x = (5+z–3y)/2 y = freez = free

If y and z are the parameters,the representation is

x = freey = (5+z–2x)/3 z = free

If x and z are the parameters,the representation is

Page 28: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Parametric representation ofthe solutions to a linear system

1. First row reduce the system of linear equations to a reduced row echelon form.

kshum ENGG2013 28

Solve

Transform to RREF

Page 29: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Pick the free variable(s)

2. Pick the variable(s) which is/are not associated with a column with pivot as “free variable”.

kshum ENGG2013 29

Pick z as a free variable

x y z

Page 30: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Solve for the non-free variables

• Express the “non-free” variables in terms of the “free” variables.

kshum ENGG2013 30

Page 31: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

General solution

• The general solution to

can be represented parametrically as

kshum ENGG2013 31

General solution means1) All solutions can bewritten in this form2) Every (x,y,z) in thisform is a solution.

Page 32: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

The solutions in set notation

kshum ENGG2013 32

stands for the set of all triples with real numbers as components

means “belong to”

Page 33: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

How to plot the solutions?

kshum ENGG2013 33

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

z is the parameter

Page 34: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Solution Set

kshum ENGG2013 34

-5

0

5 -5

0

5

-10

-5

0

5

10

y

x

z

The solutions form a straightline in the 3-D space.

Page 35: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

A PRODUCTION MODEL IN ECONOMICS

Application 1

kshum ENGG2013 35

Page 36: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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.

kshum ENGG2013 36

Steel Plant

50 tons of coal

100 tons of steel

10 tons of steel

Coal mine

100 tons of coal

Page 37: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Question• We want to produce 400 tons of steel and 300 tons of coal.

kshum ENGG2013 37

30

300

400

200To 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!

Page 38: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Formulation as a linear system• Suppose that the total output of steel plant is xS and the total output of coal mine

is xC.

kshum ENGG2013 38

400

0.1 xCTotal output ofthe steel plant

0.1 xC goes tothe coal mine

400 tonsare exported

300

0.5 xS

Total output ofthe coal mine

0.5 xS goes tothe steel plant

300 tonsare exported

Page 39: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Solve a system of two equations

kshum ENGG2013 39

Solution:xS = 452.63 xC = 526.32

In augmented matrix form

Page 40: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Internal consumption

kshum ENGG2013 40

Steel Plant

300 tons of coal

Coal mine

400 tons of steel

226.32 tonsof coal

52.63 tonsof steel

xS = 452.63

xC = 526.32

The red links indicate internal consumption

Page 41: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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)kshum ENGG2013 41

http

://e

n.w

ikip

edia

.org

/wik

i/Was

sily

_Leo

nti

ef

Page 42: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

EQUILIBRIUM PRICE IN AN ECONOMY

Application 2

kshum ENGG2013 42

Page 43: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

An example of three industries

kshum ENGG2013 43

Steel

Coal

Electric Power

0.5

0.4

0.10.6

0.3

0.1

0.2

0.1

0.7

0.1 of the total output fromcoal industry goes to thesteel industry, and 0.7 ofthe total output goes to the electric power industry.

0.4 of the total output fromthe electric power industrygoes to the coal mines, and0.5 of the total output goesto the steel plants

0.6 of the total output from the steel industry goes to the electric powerindustry, 0.3 of the output goes to the coal industry.

Page 44: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Distribution of outputs

kshum ENGG2013 44

Steel

Coal

Electric Power

0.5

0.4

0.10.6

0.3

0.1

0.2

0.1

0.7

Output FromPurchased bySteel Coal Power

0.1 0.1 0.5 Steel

0.3 0.2 0.4 Coal

0.6 0.7 0.1 Power

Page 45: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 46: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

kshum ENGG2013 46

Output FromPurchased bySteel Coal Power

0.1 0.1 0.5 Steel

0.3 0.2 0.4 Coal

0.6 0.7 0.1 Power

Page 47: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Solve the system of equations

kshum ENGG2013 47

Short-hand notationusing augmented matrix

Page 48: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

Find the solutions from reduced row echelon form

kshum ENGG2013 48

Transform to RREF

Ps Pc Pe

Choose Pe as the free variable

Ps = 44/69 Pe

Pc = 17/23 Pe

Pe = any positive real number

Pivots

free

Page 49: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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

Page 50: ENGG2013 Unit 3 RREF and    Applications of Linear Equations

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 50