16
Gaussian elimination Consider a system of 3 3 linear equations in matrix form, Ax = b: To make book-keeping simpler, we represent the system by an augmented matrix: a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 x 1 x 2 x 3 b 1 b 2 b 3 a 11 a 12 a 13 b 1 a 21 a 22 a 23 b 2 a 31 a 32 a 33 b 3

Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

  • Upload
    vodien

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Gaussian elimination

• Consider a system of 3 3 linear equations in matrix form, Ax = b:

• To make book-keeping simpler, we represent the system by an augmented matrix:

a11 a12 a13a21 a22 a23a31 a32 a33

x1x2x3

b1b2b3

a11 a12 a13 b1a21 a22 a23 b2a31 a32 a33 b3

Page 2: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Gaussian elimination

• We can zero the first column by subtracting a21/a11 times the first row from the second row, and subtracting a31/a11 times the first row from the third row (primes indicate changed values)

• Similarly, we can now zero the second column by subtracting a’32/a’22 times the first row from the third row (double primes indicate changed values), forming an upper triangular matrix:

a11 a12 a13 b10 a 22 a 23 b 20 a 32 a 33 b 3

a11 a12 a13 b10 a 22 a 23 b 20 0 a 33 b 3

Page 3: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Gaussian elimination

• The last row represents an equation in a single variable

a”33 x3 = b”3

which can be solved as x3 = b”3 / a”33

• The second row represents an equation in two variablesa’22 x2 + a’23 x3 = b’2

• Since the variable x3 has already been found in the previous step, x2 can be solved asx2 = (b’2 – a’23 x3) / a’22

a11 a12 a13 b10 a 22 a 23 b 20 0 a 33 b 3

Page 4: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Gaussian elimination

• The first row represents an equation in three variablesa11 x1 + a12 x2 + a13 x3 = b1

• Since the variables x2 and x3 have already been found in the previous steps, x1 can be solved asx1 = (b1 – a12 x2 – a13 x3) / a11

• This process of solving an upper triangular matrix equation is called back substitution.

Page 5: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Reduction of a Matrix toEchelon Form

Consider,

Apply the following elementary row operations on A

R2 → R2 – 2R1, R3 → R3 – 3R1

and obtain a new matrix:

Apply R2 → (− 1/3)R2 on B to get

Apply R3 → R3 + 5R2 on C to get

The matrix D is in echelon form (i.e. elements below the diagonal are zero).

We thus find elementary row operations reduce matrix A to echelon form.

4213

2312

4321

A

8750

6330

4321

B

8750

2110

4321

C

2200

2110

4321

D

Page 6: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Matrix reduced to echelon form by elementary row operations

The procedure is as follows: Step I. Reduce the element in (1, 1)th place to unity by some

suitable elementary row operation. Step II. Reduce all the elements in first column below first

row to zero with the help of unity obtained in first step. Step III. Reduce the element in (2, 2)th place to unity by

suitable elementary row operations. Step IV. Reduce all the elements in second column below

second row to zero with the help of unity obtained in Step III.

Proceeding in this way, any matrix can be reduced to echelon form.

Page 7: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Example

Reduce to echelon form.

Solution:

Step I. Apply R1 ↔ R3 to get

Step II. Apply R2→ R2 + R1 , R3 → R3 – 3 R1 to get

Step III. Apply R2 → (1/7)R2 to get

Step IV. Apply R3 → R3 – 5R2 to get

which is a matrix in echelon form.

251

2121

5103

A

5103

2121

251

150

070

251

150

010

251

100

010

251

Page 8: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

System of Linear Equations

Suppose that we have the following linear equation system with 2 equations

and 2 unknowns (x1, x2):

In order to solve for (x1, x2) we have to follow:

Step 1: Write the system in a compact form: Ax=b, where:

525

2132

21

21

xx

xx

5

21,,

25

32

2

1b

x

xxA

Page 9: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

System of Linear Equations

Step2: solve for x using matrix algebra:

If the determinant of A is non-zero, then the inverse A-1 exists, hence x=A-1b:

5

3

5

21

19/219/5

19/319/2

19/219/5

19/319/2

25

32

19

1

019)3(5)2(225

32

1

1

bAx

A

A

Page 10: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Inverse of a Matrix

Matrix inversion

- The inverse matrix can be calculated only for square matrices,

i.e. matrices whose number of rows is equal to the number of columns.

- If A is a nxn square matrix and A-1 is its inverse, then A.A-1=I

- If we want to divide matrix A by matrix B, we have to multiply A by the

inverse of B.

Page 11: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Inverse of a Matrix

Examples of inverting a 2x2 matrix:

Step1: Find the determinant of the matrix

For the determinant is given by

Step2: If , i.e. A is non-singular, its inverse exists and is calculated as

follows:

22xdc

baA

cbdaA ..

0A

ac

bd

AA

11

Page 12: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Rank of a MatrixDefinition: Let A be an m × n matrix. We say rank of A is r if (i) at least one minor of order r is non-zero and (ii) every minor of order (r + 1) is zero.

Rank of a matrix is the maximum number of linearly independent rows or columns. For an n X n matrix to be non-singular, the rank must be equal to n.

One way of finding the rank of a matrix is by transforming it into an echelon matrix with the use of elementary row operations:

- Interchange any two rows

- Multiply rows by a scalar

- Add k times any row to another row

- If any of the rows vanishes in the process, the rank is less than n and the matrix is singular.

Page 13: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Example

Find the rank of the following matrix:

Solution:We have,

Thus, the rank A ≤ 2. Again as

rank A ≥ 2 and hence rank A = 2.

0

0

0

ii

ii

ii

A

0

0

0

0

ii

ii

ii

A

010

0

i

i

Page 14: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Rank of a MatrixNotes:

(i) It is easy to see that if the given matrix A is m × n matrix, then rank A ≤ min

(m, n).

(ii) If in A, every r × r determinant is zero, then the rank is less than or equal to

r–1.

(iii) If ∃ a non-zero r × r determinant, then the rank is greater than or equal to

r.

(iv) Rank of null matrix is taken as zero.

(v) If every r-rowed minor is zero, then every higher order minor would

automatically be zero.

You can prove that the rank of a matrix remains unchanged by elementary

operations. In view of this result, the process of finding a rank can be

simplified. We first reduce the given matrix to a triangular form by elementary

row operations and then find the rank of the new matrix which is the rank of

the original matrix.

Page 15: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Example: Find the rank of the following matrix:

462

693

231

A

Solution: We have ~ using C2 → C2 + 3C1

C3 → C3 – 2C1

~ using R2 → R2 + 3R1

R3 → R3 – 2R1

So, rank of A is 1.

462

693

231

A

002

003

001

000

000

001

Page 16: Gaussian elimination - Welcome to University18 Lecture 9 SN 1.pdf ·  · 2011-09-21Gaussian elimination ... - The inverse matrix can be calculated only for square matrices, ... row

Business Applications of Matrices

Application of matrices to business can be understood with the help of following example:

Example: In an examination of mathematics, 20 students from college A, 30

students from college B and 40 students from college C appeared. Only 15 students

from each college could get through the examination. Out of them 10 students

from college A, 5 students from college B and 10 students from college C secured

full marks. Write down the data in matrix form.

Solution: Consider the following matrix:

The first row represents the number of students in college A, college B, college

C respectively. The second row represents the number of students who got through

the examination in three colleges respectively. The third row represents the number

of students who got full marks in the three colleges respectively. [END]

10510

151515

403020