Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th...

39
Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    289
  • download

    25

Transcript of Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th...

Page 1: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

Chapter 2

Basic Linear Algebra

to accompany

Operations Research: Applications and Algorithms

4th edition

by Wayne L. Winston

Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.

Page 2: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

2

2.1 - Matrices and Vectors

A matrix is any rectangular array of numbers

If a matrix If a matrix AA has has mm rows and rows and nn columns it is columns it is referred to as an referred to as an mm x x nn matrix. matrix.

mm x x nn is the is the orderorder of the matrix. It is typically of the matrix. It is typically written aswritten as

1

3

2

4

1

4

2

5

3

6

1

2

2 1( )

A

a 11

a 21

....

a m1

a 12

a 22

....

a m2

....

....

....

....

a 1n

a 2n

....

a mn

Page 3: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

3

The number in the The number in the iith row and th row and jjth column of A th column of A is called the is called the ijijthth element element of of AA and is written and is written aaij..

Two matrices A = [aij] and B = [bij] are equal if and only if A and B are the same order and for all i and j, aij = bij.

If A1

3

2

4

and Bx

w

y

z

A = B if and only if x = 1, y = 2, w = 3, and z = 4A = B if and only if x = 1, y = 2, w = 3, and z = 4

Page 4: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

4

Any matrix with only one column is a column vector. The number of rows in a column vector is the dimension of the column vector.

RRmm will denote the set all m-dimensional column will denote the set all m-dimensional column vectorsvectors

Any matrix with only one row (a 1 x Any matrix with only one row (a 1 x nn matrix) is matrix) is a a row vectorrow vector. The dimension of a row vector . The dimension of a row vector is the number of columns.is the number of columns.

1

2

1 2 3( )

Page 5: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

5

Any m-dimensional vector (either row or column) in which all the elements equal zero is called a zero vector (written 0).

Any Any mm-dimensional vector corresponds to a -dimensional vector corresponds to a directed line segment in the directed line segment in the mm-dimensional -dimensional plane.plane. For example, the two-dimensional vector For example, the two-dimensional vector uu

corresponds to the line segment joining the point corresponds to the line segment joining the point (0,0) to the point (1,2)(0,0) to the point (1,2)

0 0 0( )0

0

Page 6: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

6

The directed line segments (vectors The directed line segments (vectors uu, , vv, , ww) ) are shown.are shown.

X1

X2(1, 2)

(1, -3)

(-1, -2)

u1

2

v1

3

w1

2

Page 7: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

7

The scalar product is the result of multiplying two vectors where one vector is a column vector and the other is a row vector. For the scalar product to be defined, the dimensions

of both vectors must be the same.

The scalar product of u and v is written:

u v u 1 v1 u 2 v2 .... u n vn

u 1 2 3( ) v

2

1

2

u v 1 2( ) 2 1( ) 3 2( ) 10

Page 8: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

8

The Scalar Multiple of a MatrixThe Scalar Multiple of a Matrix Given any matrix Given any matrix AA and any number and any number cc, the matrix , the matrix cAcA

is obtained from the matrix is obtained from the matrix AA by multiplying each by multiplying each element of element of AA by by cc..

Addition of Two MatricesAddition of Two Matrices Let A = [aij] and B =[bij] be two matrixes with the

same order. Then the matrix C = A + B is defined to be the m x n matrix whose ijth element is aij + bij.

Thus, to obtain the sum of two matrixes A and B, we add the corresponding elements of A and B.

A1

1

2

0

3 A

3

3

6

0

A1

0

2

1

3

1

B1

2

2

1

3

1

C1 1

0 2

2 2

1 1

3 3

1 1

0

2

0

0

0

0

Page 9: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

9

This rule for matrix addition may be used to add vectors of the same dimension.

Vectors may be added using the parallelogram law or by using matrix addition.

X1

X2

u

v

u+v

1 2 3

1

2

3

(1,2)

(2,1)

(3,3)

v 2 1( )

u 1 2( )

u v 3 3( )

Page 10: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

10

Line segments can be defined using scalar multiplication and the addition of vectors. If u=(1,2) and v=(2,1), the line segment joining u

and v (called uv) is the set of all points in the m-dimensional plane corresponding to the vectorscu +(1-c)v, where 0 ≤ c ≤ 1.

X1

X2

u

v

1 2

1

2c=1

c=1/2

c=0

Page 11: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

11

The Transpose of a Matrix Given any m x n matrix the transpose of A (written

AT) is the n x m matrix.

For any matrix A, (AT)T=A.

Page 12: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

12

Matrix Multiplication Given to matrices A and B, the matrix product of A

and B (written AB) is defined if and only if the number of columns in A = the number of rows in B.

The matrix product C = AB of A and B is the m x n matrix C whose ijth element is determined as follows: ijth element of C = scalar product of row i of A x

column j of B

Page 13: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

13

Example 1: Matrix Multiplication

Computer C = AB for

Solution

Because A is a 2x3 matrix and B is a 3x2 matrix, AB is defined, and C will be a 2x2 matrix.

A1

2

1

1

2

3

B

1

2

1

1

3

2

C5

7

8

11

C11

1 1 2( )

1

2

1

5 C12

1 1 2( )

1

3

2

8

C21

2 1 3( )

1

2

1

7 C22

2 1 3( )

1

3

2

11

Page 14: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

14

Many computations that commonly occur in operations research can be concisely expressed by using matrix multiplication.

Some important properties of matrix multiplications are: Row i of AB = (row i of A)B

Column j of AB = A(column j of B)

A1

2

1

1

2

3

B

1

2

1

1

3

2

Page 15: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

15

Use the EXCEL MMULT function to multiply the matrices: Enter matrix A into cells B1:D2 and matrix B into cells

B4:C6.

Select the output range (B8:C9) into which the product will be computed.

In the upper left-hand corner (B8) of this selected output range type the formula: = MMULT(B1:D2,B4:C6).

Press Control-Shift-Enter

A B C D1 Matrix A 1 -1 22 2 1 334 Matrix B 1 15 2 36 1 278 A B = 1 29 7 11

Page 16: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

16

2.2 Matrices and Systems of Linear Equations

Consider a system of linear equations.

The variables, or unknowns, are referred to as x1, x2, …, xn while the aij’s and bj’s are constants.

A set of such equations is called a linear system of m equations in n variables.

A A solutionsolution to a linear set of m equations in n to a linear set of m equations in n unknowns is a set of values for the unknowns unknowns is a set of values for the unknowns that satisfies each of the system’s that satisfies each of the system’s mm equations. equations.

a11 x1 a12 x2 .... a1n xn b1

a21 x1 a22 x2 .... a2n xn b1

.... .... .... ....

am1 x1 am2 x2 .... amn xn bm

Page 17: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

17

Example 5: Solution to Linear System

Show thatShow that

is a solution to the linear systemis a solution to the linear system

and thatand that

is not a solution to the linear system.is not a solution to the linear system.

x1

2

x1 2x2 5 2x1 x2 0

1

3x

Page 18: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

18

Example 5 Solution

To show that

is a solution, x1=1 and x2=2 must be substituted in both equations. The equations must be satisfied.

The vector

is not a solution, because x1=3 and x2=1 fail to satisfy 2x1-x2=0

x1

2

1

3x

Page 19: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

19

Matrices can simplify and compactly represent a system of linear equations.

This system of linear equations may be written This system of linear equations may be written as as AAxx==bb and is called it’s and is called it’s matrix matrix representationrepresentation..

This will sometimes be abbreviated A|b.

A

a 11

a 21

....

a m1

a12

a 22

....

a m2

....

....

....

....

a 1n

a 2n

....

a mn

x

x1

x2

....

xn

b

b 1

b 2

....

b m

Page 20: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

20

2.3 – The Gauss-Jordan Method

Using the Gauss-Jordan method, it can be shown that any system of linear equations must satisfy one of the following three cases: Case 1 The system has no solution.

Case 2 The system has a unique solution.

Case 3 The system has an infinite number of solutions.

The Gauss-Jordan method is important because many of the manipulations used in this method are used when solving linear programming problems by the simplex algorithm.

Page 21: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

21

Elementary row operations (ERO) transforms a given matrix A into a new matrix A’ via one of the following operations: Type 1 ERO –A’ is obtained by multiplying any row of

A by a nonzero scalar.

Type 2 ERO – Multiply any row of A (say, row i) by a nonzero scalar c. For some j ≠ i, let row j of A’ = c*(row i of A) + row j of A and the other rows of A’ be the same as the rows of A.

Type 3 ERO – Interchange any two rows of A.

Page 22: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

22

The Gauss-Jordan method solves a linear equation system by utilizing EROs in a systematic fashion.

The steps to using the Gauss-Jordan method The augmented matrix representation is

2

2

1

2

1

1

1

2

2

9

6

5

A|b =A|b =

Page 23: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

23

Step 1 Multiply row 1 by ½. This Type 1 ERO yields

Step 2 Replace row 2 of A1|b1 by -2(row 1 A1|b1) + row 2 of A1|b1. The result of this Type 2 ERO is

1

2

1

1

1

1

1

2

2

2

9

2

6

5

AA11|b|b11 = =

AA22|b|b22 = =

1

0

1

1

3

1

1

2

1

2

9

2

3

5

Page 24: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

24

Step 3 Replace row 3 of A2|b2 by -1(row 1 of A2|b2) + row 3 of A2|b2 The result of this Type 2 ERO is

The first column has now been transformed into

AA33|b|b33 = =

1

0

0

1

3

2

1

2

1

3

2

9

2

3

1

2

1

0

0

Page 25: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

25

Step 4 Multiply row 2 of A3|b3 by -1/3. The result of this Type 1 ERO is

Step 5 Replace row 1 of A4|b4 by -1(row 2 of A4|b4) + row 1 of A4|b4. The result of this Type 2 ERO is

1

0

0

1

1

2

1

2

13

3

2

9

2

1

1

2

AA44|b|b44 = =

AA55|b|b55 = =

1

0

0

0

1

2

5

6

13

3

2

7

2

1

1

2

Page 26: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

26

Step 6 Place row 3 of A5|b5 by 2(row 2 of A5|b5) + row 3 of A5|b5. The result of this Type 2 ERO is

Column 2 has now been transformed into

AA66|b|b66 = =

1

0

0

0

1

0

5

6

13

5

6

7

2

1

5

2

1

0

0

Page 27: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

27

Step 7 Multiply row 3 of A6|b6 by 6/5. The result of this Type 1 ERO is

Step 8 Replace row 1 of A7|b7 by -5/6(row 3 of A7|b7)+A7|b7. The result of this Type 2 ERO is

3300

13

100

2

7

6

501

A7|b7 =

3100

13

110

1001

A8|b8 =

Page 28: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

28

Step 9 Replace row 2 of A8|b8 by 1/3(row 3 of A8|b8)+ row 2 of A8|b8. The result of this Type 2 ERO is

A9|b9 represents the system of equations and thus the unique solution

1

0

0

0

1

0

0

0

1

1

2

3

AA99|b|b9 9 = =

Page 29: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

29

After the Gauss Jordan method has been applied to any linear system, a variable that appears with a coefficient of 1 in a single equation and a coefficient of 0 in all other equations is called a basic variable (BV).

Any variable that is not a basic variable is called a nonbasic variable (NBV).

Page 30: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

30

Summary of Gauss-Jordan Method

Does A' | b ' have a row [ 0, 0 , ..., 0 | c ] (c < > 0 ) ?

Ax = b has nosolution.

Find BV and NBV.

Is NBV empty?

Ax = b has a uniquesolution.

Ax = b has an infinitenumber of solutions.

Yes No

Yes

No

Class Problem

Page 31: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

31

2.4 Linear Independence and Linear Dependence

A linear combination of the vectors in V is any vector of the form c1v1 + c2v2 + … + ckvk where c1, c2, …, ck are arbitrary scalars.

A set of V of m-dimensional vectors is linearly independent if the only linear combination of vectors in V that equals 0 is the trivial linear combination.

A set of V of m-dimensional vectors is linearly dependent if there is a nontrivial linear combination of vectors in V that adds up to 0.

Page 32: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

32

Example 10: LD Set of Vectors

Show that V = {[ 1 , 2 ] , [ 2 , 4 ]} is a linearly dependent set of vectors.

Solution

Since 2([ 1 , 2 ]) – 1([ 2 , 4 ]) = (0 0), there is a nontrivial linear combination with c1 =2 and c2 = -1 that yields 0. Thus V is a linear dependent set of vectors.

Page 33: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

33

What does it mean for a set of vectors to linearly dependent?

A set of vectors is linearly dependent only if some vector in V can be written as a nontrivial linear combination of other vectors in V.

If a set of vectors in V are linearly dependent, the vectors in V are, in some way, NOT all “different” vectors. By “different we mean that the direction specified by

any vector in V cannot be expressed by adding together multiples of other vectors in V. For example, in two dimensions, two linearly dependent vectors lie on the same line.

Page 34: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

34

Let A be any m x n matrix, and denote the rows of A by r1, r2, …, rm. Define R = {r1, r2, …, rm}.

The rank of A is the number of vectors in the largest linearly independent subset of R.

To find the rank of matrix A, apply the Gauss-Jordan method to matrix A. Let A’ be the final result. It can be shown that the

rank of A’ = rank of A. The rank of A’ = the number of nonzero rows in A’. Therefore, the rank A = rank A’ = number of nonzero rows in A’.

Page 35: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

35

A method of determining whether a set of vectors V = {v1, v2, …, vm} is linearly dependent is to form a matrix A whose ith row is vi.

If the rank A = m, then V is a linearly independent set of vectors.

If the rank A < m, then V is a linearly dependent set of vectors.

Class Problem

Page 36: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

36

2.5 – The Inverse of a Matrix

A square matrix is any matrix that has an equal number of rows and columns.

The diagonal elements of a square matrix are those elements aij such that i=j.

A square matrix for which all diagonal elements are equal to 1 and all non-diagonal elements are equal to 0 is called an identity matrix. An identity matrix is written as Im.

Page 37: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

37

For any given m x m matrix A, the m x m matrix B is the inverse of A if BA=AB=Im.

Some square matrices do not have inverses. If there does exist an m x m matrix B that satisfies BA=AB=Im, then we write B=A-1.

The Gauss-Jordan Method for inverting an m x m Matrix A is Step 1 Write down the m x 2m matrix A|Im

Step 2 Use EROs to transform A|Im into Im|B. This will be possible only if rank A=m. If rank A<m, then A has no inverse.

Page 38: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

38

Matrix inverses can be used to solve linear systems.

The Excel command =MINVERSE makes it easy to invert a matrix. Enter the matrix into cells B1:D3 and select the

output range (B5:D7 was chosen) where you want A-1 computed.

In the upper left-hand corner of the output range (cell B5), enter the formula = MINVERSE(B1:D3)

Press Control-Shift-Enter and A-1 is computed in the output range

Class Problem

Page 39: Chapter 2 Basic Linear Algebra to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole,

39

2.6 – Determinants

Associated with any square matrix A is a number called the determinant of A (often abbreviated as det A or |A|).

If A is an m x m matrix, then for any values of i and j, the ijth minor of A (written Aij) is the (m - 1) x (m - 1) submatrix of A obtained by deleting row i and column j of A.

Determinants can be used to invert square matrices and to solve linear equation systems.