Student Handbook 1. Matrices A matrix (plural: matrices, not matrixes) is a rectangular array of...

Preview:

DESCRIPTION

Matrix Entries In this section we show how to add and multiply matrices. We shall identify the numbers inside a matrix by their position. In matrix A = we may describe the number 1 as “the entry in the first row, first column”, or more precisely write a 11 = 1. 3

Citation preview

Student Handbook

1

Matrices• A matrix (plural: matrices, not matrixes) is a

rectangular array of numbers such as

• Matrices are useful when modelling a varietyof real-life problems, and are the abstractmathematical counterparts of array data structures in programming.

2

400021170002326000321

Matrix Entries• In this section we show how to add and multiply

matrices.• We shall identify the numbers inside a matrix by

their position. In matrix

A =

• we may describe the number 1 as “the entry inthe first row, first column”, or more precisely writea11 = 1.

3

3

042

31

Matrix Entries• Similarly a12 = 2 is the entry in the first row,

second column. • More generally we write aij for the entry in the

ith row, jth column.• Matrices come in different sizes. Since A has two

rows and three columns, we call A a 2×3 or “2 by3” matrix.

• The size of a matrix determines what other matrices it can be added to or multiplied with.

• Matrices are equal if they are the same size andtheir corresponding entries are equal.

4

AdditionTwo matrices A and B of the same size can be

added together and the sum A+B is obtained by adding the corresponding entries.

For example

5

021564

103563

122001

AdditionHowever, the sum

is not defined, since the first matrix is 3×2 but the second is 3 × 3.

6

613522431

122001

Scalar MultiplicationTo multiply a matrix A by a scalar c just

means that c is some real number and that we multiply every entry in A by c.

Let A =

and let c = , then

7

0261

01

321

21 A

21

Scalar MultiplicationThe difference A - B of two matrices of the

same size is just another way of writing A + (-1)B:

8

3220

3041

)1(0261

3041

0261

Matrix Multiplication• If A is a k × m matrix and B is an m × n matrix,

then the product C = AB is the k×n matrix whoseentries are found as follows:

• To calculate cij, take row i from matrix A and column j from matrix B, multiply the corresponding entries together, and add up the results.

• Note that AB is defined iff the number of columnsof A matches the number of rows of B.

9

Matrix MultiplicationFor example

is undefined, because the matrices to bemultiplied are 3 × 2 and 3 × 2.

So it is possible to have two matrices that can be added but not multiplied together.

10

042240

435261

Examples of Products

where the matrices to be multiplied are 1 × 2 and 2 × 1, so that multiplication is defined and the product is 1 × 1.

11

630

21

41)1(2210240)1(2200241)1(32103

4210

120213

Examples of Products

where the matrices to be multiplied are 3 × 2 and 2 × 2, so that multiplication is defined and the product is 3 × 2.

12

222012

Why?• Let’s show, by a real-life example, why matrix

multiplication is defined in such a strange way.• Suppose a superannuation fund has investments

in three countries. • The deposits in each country are divided among

government bonds, mortgages, and shares. • Let’s represent the amount currently invested in

each country, in millions of dollars, by the table

13

Why?

Bonds Mortgages SharesCountry A 5 10 20Country B 3 9 15Country C 2 6 10

• The table can be simplified to the matrix

X =

14

1062159320105

Why?Now suppose the average yields are 4%

for bonds, 7% for mortgages, and 10% forshares.

How would we work out the earningsthe superannuation fund can expect from itsinvestments in each country?

15

Why?The amount earned in Country A would be

(amount invested in bonds)·(yield of bonds)+ (amount in mortgages) ·(yield of mortgages)+ (amount in shares) ·(yield of shares)= (5)(.04) + (10)(.07) + (20)(.10).

This is like working out an entry in a matrixproduct.

16

Why?• Let the yield matrix be Y =

• Then the amount earned in Country A is just the first entry of the product

XY =

17

1.007.004.0

1.007.004.0

1062159320105

Why?• and the earnings for the other countries are

the second and third entries:

• The fund earns 2.9 million in Country A, 2.25million in Country B, and 1.5 million in Country C.

18

5.125.29.2

1.007.004.0

1062159320105

Representing Systems of EquationsHere is another use for products. The system

of linear equations2x - 3y = 54x + y = 0

can be represented compactly by the matrixequation:

19

05

1432

yx

Representing Systems of Equations

which is of the formAX = B

where

20

05

,,1432

Byx

XA

A Real Life Problem• You have a bacteria culture containing three

species of bacteria. Each species requires different amounts of three nutrients: nitrates, carbohydrates, and phosphates.

• The requirements are given in the table, in micrograms per day.Species Nitrates Carbohydrates PhosphatesA 1 2 1B 2 3 1C 3 2 2

21

A Real Life ProblemThe daily supply of nitrates is 6000 units, of

carbohydrates is 7000 units, and of phosphates is 4000 units.

How many bacteria of each species can the

culture grow?

22

Modelling the data• Let x be the number of bacteria of species A, y the number of B, and z the number of C. • We want to use our data to find the values

of x, y, and z. • But first we have to represent that data in a

way that connects the information with the unknowns x, y, and z. • This gives us a system of linear equations:

23

Modelling the dataIf the entire daily supply of 6000 units of

nitrates is used up, thenx + 2y + 3z = 6000.

Similarly, from the data about carbohydrates we get

2x + 3y + 2z = 7000and from the phosphate data we get

x + y + 2z = 4000.

24

Solving Linear EquationsIn this section we show how matrices arise

when solving systems of linear equations.

Key concepts in this section: system of linearequations, augmented matrix, coefficient matrix, elementary transformation, echelon form, rank of a matrix.

25

Echelon FormWe have the following system of equations to

solve:x + 2y + 3z = 60002x + 3y + 2z = 7000x + y + 2z = 4000

but it is unclear what values of x, y, and z would satisfy the equations.

26

Echelon Form• So we transform this system into a new system

which has the same solutions but is easier to solve.

• If the new system is in echelon form it is easy to solve:x + 2y + 3z = 6000y + 4z = 50003z = 3000

• Now z = 1000 and back-substituting gives y = 5000-4000 = 1000 and x = 6000-2000-3000 =1000.

27

Matrix RepresentationSuppose we are going to transform the system

of equations into a new system in echelon form.It will reduce the labour if we simplify the

representation. Instead of writing down the equations, we

write down just the coefficients of the unknowns on the left and the constants on the right, giving us the augmented matrix of the system.

28

Matrix RepresentationSo from the system

x + 2y + 3z = 60002x + 3y + 2z = 7000x + y + 2z = 4000

we get the augmented matrix

29

400021170002326000321

Elementary TransformationsWe can change a system of equations into anew system with the same solutions:

• by swapping equations or

• by multiplying through by a nonzero number or

• by adding one equation to another. • In terms of the augmented matrix, this means

we may:

30

Elementary Transformationsinterchange two rows: Rj ↔ Rk

multiply through by a nonzero number: Rj ⟶ c × Rj

add one row to another row: Rj ⟶ Rj + Rk.In fact, we often combine the last two

transformations so as to add a multiple of one row to another row:

Rj ⟶ Rj + c × Rk

31

ExampleThe system of linear equations gives

R2 ⟶ R2 - 2R1 and then R3 ⟶ R3 - R1 give

32

400021170002326000321

200011050004106000321

ExampleR2 ⟶ (-1) R2 and then R3 ⟶ R3 + R2 give

This matrix represents the system of equations

x + 2y + 3z = 6000 y + 4z = 5000

3z = 3000

33

300030050004106000321

Examplewith solutions x = 1000, y = 1000, and z = 1000.

By using elementary transformations to reducethe augmented matrix to echelon form.

We get a new system of equations with the same solutions as the original system.

The technique is called Gaussian elimination.

34

No Solutions?When the augmented matrix of a system of linear equations in n unknowns is reduced to echelon form, the last row may be of the form

[0 … 0 c] with c ≠ 0 so that the corresponding equation is

0 x1 + …+ 0 xn = cwhich has no solution, because no matter

what values we substitute for the unknownsx1, x2, …, xn

35

No Solutions?The lefthand side still adds up to zero,

whereas the righthand side is nonzero. But if the last row has at least one nonzero

coefficient[0 …an c] where an ≠ 0

Then the system has at least one solution, irrespective of the value of c, since the final equation is

0x1 + …+ anxn = c

36

Infinitely Many SolutionsSuppose our model was initially the system

x + 2y + 3z = 60002x + 3y + 2z = 7000

which we reduced to echelon form to getx + 2y + 3z = 6000 y + 4z = 5000

37

Infinitely Many Solutions• Instead of a unique value for z, we can let z be

any real number t, and then get values for y andx in terms of t, namely y = 5000 - 4t and x = 6000 - 2(5000 - 4t) - 3t = 5t - 4000.

• We can produce specific solutions by giving tspecific values such as t = 0 (so that x = -4000,y = 5000, and z = 0) and t = 1 (so that x =-3995, y = 4996, and z = 1).

38

Homogeneous SystemsIf the constants on the righthand side are all

zero, as in the systemx + 2y + 3z = 02x + 3y + 2z = 0x + y + 2z = 0

then the system always has at least one solution, because we may take x = y = z = 0.

Such systems of equations are called homogeneous.

39

Homogeneous SystemsWe need not use an augmented matrix to

represent a homogeneous system, since thelast column will consist entirely of zeros.

Instead we may use the coefficient matrix in which only the values of the coefficients of the unknowns are displayed:

40

211232321

RankThe rank of a matrix is the number of

nonzerorows left after the matrix has been reduced toechelon form.

A system of linear equations has a solution iff the rank of the augmented matrix is equal to the rank of the coefficient matrix.

Why?

41

RankBecause the only way for a system to

have no solutions is for the augmented matrix in echelon form to have as its last nonzero row

[0 … 0 c] with c ≠ 0. But now the rank of the augmented matrix is

greater than the rank of the coefficient matrix.

So if the ranks are equal, it means that this case cannot arise

42

Recommended