Ma1506chap5 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

CHAPTER 5

MATRICES AND THEIR USES

5.1

What is a Matrix?

A system of linear algebraic equations in two variables might look like this:
2x + 7y = 3
4x + 8y = 11
LINEAR because it just involves constant
multiples of x and y, no x2 , no sin(y), etc.
ALGEBRAIC because no dierentiation.
Its cool to write these systems using the following
notation:

][ ] [ ]
2 7
x
3
=
.
4 8
y
11
[ ]
[ ]
x
3
Here
and
are familiar - they are VECy
11
1

2 7
is something new, called a MA4 8
[
]
2 7
TRIX. We say that the PRODUCT of
with
4
8
[ ]
[ ]
x
3
gives you
.
y
11
TORS. But

Every matrix has ROWS and COLUMNS. In this


case,[ the
] rows
[ ] are [2 7] and [4 8] and the columns
2
7
are
,
. We call [2 7] a ROW VECTOR
4
8
[ ]
[
]
2
2 7
and
a column vector. We say that
4
4 8
is a 2 by 2 matrix since it has two rows and two
columns. You can regard [2 7] as having one row
and 2 columns,
etc. You
can also have 3 by 3 matri
1 7 9
ces like 7 8 2 or even 2 by 3 matrices like
]4 10 12
[
1 2 4
two rows, three columns.
6 8 9
2

A general 3 by 3 matrix can be written as

a11
a21
a31

a12
a22
a32

a13
a23
a33

so aij is the number in the i-th row and j-th column,


Note aij = aji usually!
Engineers and physicists like to talk about the matrix aij . Strictly speaking, they mean the matrix
with entries aij but we will talk in this sloppy way
too! In the
same
way, any column vector can be
u1
written as u2 .
u3
5.2

Matrix Arithmetic

[a] Addition and Subtraction.


Just add up or subtract the entries, as you would for
a vector.
3

1 2
7 3
8 5
+
=
4 8
6 9
10 17
[
] [
] [
]
7 3
6 1
1 2

=
4 8
6 9
2 1
In general, if aij and bij are matrices (both m by n,
that is, both have m rows and n columns) then the
sum is aij + bij and the dierence is aij bij .
[b] Multiplying By a Number.
Just
as you would for a vector.
]
] [every entry,
[ multiply
2 4
1 2
. The product of the number
=
2
8 16
4 8
c with the matrix aij is c aij .
[c] Transposition.
If you take a matrix and SWITCH THE FIRST
ROW INTO THE FIRST COLUMN, second row
into second column, and so on, the result is called
]T [
]
[
1 4
1 2
=
.
the TRANSPOSE. We write
2 8
4 8
4

1 7
9
1 6 4
6 8
2 = 7 8 10
4 10 12
9 2 12

[
]T
1 6
1 2 4
= 2 8
6 8 9
4 9
[
]T [
]
a11 a12
a11 a21
=
a21 a22
a12 a22
and by looking at this example you can see
aTij = aji the order of the indices is reversed.
Notice that
(
)T
T
T
(aij )
= (aji ) = aij
T

(aij + bij ) = aji + bji = aTij + bTij


T

(c aij ) = c aji = c (aij ) .


[d] Multiplying Matrices.
We started by declaring that it was cool to write
[
][ ] [ ]
2 7
x
3
2x + 7y = 3
as
=
. Clearly this
4 8
y
11
4x + 8y = 11
5

2x + 7y
is a way of saying that the vector
equals
4x
+
8y
[ ]
[
[
][ ]
]
3
2 7
x
2x + 7y
, so
=
. Notice that
11
4
8
y
4x
+
8y
[
]
[ ]
2 7
x
ROWS of
multiply the COLUMN
. We
4 8
y
adopt this as our GENERAL RULE:
ROWS MULTIPLY COLUMNS!
[

][ ] [
] [ ]
2 7
1
2+0
2
=
=
4 8
0
4+0
4
] [ ]
][ ] [
[
7
0+7
0
2 7
=
=
8
0+8
1
4 8
[
][
] [
]
2 7
1 3
16 1
=
4 8
2 1
20 4
[ ]
3
[1 2]
= 11, a 1 by 1 matrix! Also called a
4
NUMBER!
[
][
]
a11 a12
b11 b12
a21 a22
b21 b22
[
]
a11 b11 + a12 b21 a11 b12 + a12 b22
=
a21 b11 + a22 b21 a21 b12 + a22 b22
6

[
=

c11
c21

c12
c22

]
so we have

c11 = a11 b11 + a12 b21 =

a1j bj1

c12 = a11 b12 + a12 b22 =

a1j bj2

c21 = a21 b11 + a22 b21 =

a2j bj1

c22 = a21 b12 + a22 b22 =

a2j bj2

Can you see the pattern?


cmn =

amj bjn .

This is true for all matrices, not just 2 by 2 matrices.

NOTE that
[
][
] [
]
2 7
1 3
16 1
=
4 8
2 1
20 4
][
] [
]
[
2 7
14 31
1 3
=
completely dierent!
4 8
0 6
2 1
So the ORDER OF MATRIX MULTIPLICATION
7

is IMPORTANT. If A and B are matrices, USUALLY AB = BA.


[e] Transposition and Matrix Multiplication.
According to our rules,
[
]
2 1
[1 2]
= [8
3 1
[

But
[ ]
8
= [8
1
[

1]

][ ] [ ]
2 3
1
8
=
.
1 1
2
1

1] ,
[

2 3
2 1
=
1 1
3 1

]T

[ ]
1
and
= [1
2

2] .

In general, if A and B are matrices of any kind, the


rule is
T

(AB) = B T AT
8

DONT FORGET TO REVERSE THE ORDER!


A matrix is said to be SYMMETRIC if
AT = A.
[

] [
] [
]
1 3
0 16
1 0
,
,
are all symmetric. Any
3 2
16 109
0 1
matrix of the form B + B T , where B is ANY matrix,

is symmetric. [Proof: (B + B T )T = B T + (B T )T =
B T + B.] If A is symmetric, so is BAB T for any
B [Proof: (BAB T )T = (B T )T AT B T = BAT B T =
BAB T .] A matrix is said to be ANTISYMMETRIC
if
AT = A.
[

] [
] [
]
0
16
0 1
0 1
,
,
are all antisymmet1 0
16 0
1 0
ric. Any matrix of the form BB T is antisymmetric,
and BAB T is antisymmetric if A is antisymmetric.

[f] SCALAR AND VECTOR PRODUCTS IN TERMS


OF MATRICES.
You are familiar with the scalar or dot product,

u1
v1

u v = u2 v2 = u1 v1 + u2 v2 + u3 v3 .
u3
v3
This is actually a MATRIX PRODUCT, because you
can write it as

u v = [ u1

u2

v1
u3 ] v2
v3

= u1 v1 + u2 v2 + u3 v3 = u v .
Thus, in particular, the length of a vector can be
expressed as
T

u = u u = u u.
You are also familiar with the VECTOR or CROSS

product of two vectors, u v . This is also a ma10

trix product! To see this, notice that any threedimensional vector can be used to dene an antisymmetric three by three matrix as follows:

u1
0
u3 u2

u = u2 denes u3
0
u1 .
u3
u2 u1
0
Lets call this matrix A. Then you can check that,

for any vector v ,

u v = Av.

So the vector product is really just a special kind


of matrix multiplication. Notice that A is always
antisymmetric.

[g] ORTHOGONAL MATRICES.


A matrix B is said to be ORTHOGONAL if it satises
B T B = I,
11

1 0
where I is the IDENTITY MATRIX, I =
in
0
1

1 0 0
two dimensions, 0 1 0 in three, etc. Note that
0 0 1
IA
[ = A = AI for
] any matrix A. In two dimensions,
cos sin
is orthogonal for any . Since
sin
cos
[
][
]
cos sin
cos sin
sin cos
sin cos
]
[
2
2
cos + sin
0
=
0
sin2 + cos2
]
[
1 0
=
0 1
]
[
cos
sin
.
Another example is
sin cos

5.3 Application: Markov Chains.


Lets construct a simple MODEL of weather forecasting. We assume that each day is either RAINY
or SUNNY.
12

Rainy today probably rainy tomorrow (probability 60%).


Sunny today probably sunny tomorrow (probability 70%).
Since probabilities have to add up to 100%, you can
easily see that Rainy Sunny has probability 40%
and Sunny Rainy has probability 30%. We can
organise these data into a matrix by putting the
probabilities into the columns. That is, all of the
probabilities of the form Rainy (Rainy or Sunny)
go into the f irst column, and all of the probabilities
of the form Sunny (Rainy or Sunny) go into the
second column, and so on if there are more possible
weather states. So we get
[
]
Rainy Rainy Sunny Rainy
M=
Rainy Sunny Sunny Sunny
]
[
0.6 0.3
.
=
0.4 0.7
(So if there were three states, say Rainy, Sunny,
13

Hazy, then we would put the three numbers


Rainy Rainy, Rainy Sunny, Rainy
Hazy down the first column of a 3 3 matrix, and similarly for the second and third
columns. See question 1 in Tutorial 9.)
Question: Suppose today is sunny. What is
the probability that it will be rainy 4 days from now?
To see how to proceed, we make a tree like this:
[R = rain, S = sun] for the rst two days:

14

We have, similarly, that the probability of Rainy


Sunny over 2 days is
RS2 = 0.6 0.4 + 0.4 0.7
By constructing a tree starting with S, you will nd
that the probability of rain 2 days after a sunny day
is
SR2 = 0.6 0.3 + 0.3 0.7
and similarly
SS2 = 0.4 0.3 + 0.7 0.7
So now the matrix of probabilities is
[
]
RR2 SR2
RS2 SS2
[
]
0.6 0.6 + 0.3 0.4 0.6 0.3 + 0.3 0.7
.
=
0.6 0.4 + 0.4 0.7 0.4 0.3 + 0.7 0.7
[
But this is exactly

0.6 0.3
0.4 0.7
15

][

0.6 0.3
= M 2.
0.4 0.7

So matrix multiplication actually allows you to compute all of the probabilities in this Markov Chain.
To predict the weather 4 days from now, we need
]
]
[
[
0.43 0.43
RR4 SR4
= M 4 = M 2M 2 =
.
0.57 0.57
RS4 SS4
So if it is rainy today, the probability of rain in 4
days is 0.43=43%. If you want 20 days, just compute
M 20 . A very complicated problem without matrix
multiplication!

5.4 Application: Leontief Model in Economics


The Leontief model describes the interactions of different sectors of an economy.

For example, sup-

pose that the Republic of Macedonia has an economy with only two sectors, agriculture and manufacturing. Now the agricultural sector has to produce vegetables for export, and the government sets
16

a target for that: it wants to export 150 million


Macedonian denars worth of vegetables in a given
year. But the agricultural sector also has to feed the
agricultural workers and the manufacturing workers. The amount they eat depends on how many of
them there are. We can measure that by the amount
of money they generate that year, A and M, which
are numbers measured in millions of Macedonian
denars. [The idea is that if you generate twice as
much money, say, in manufacturing, then you must
have employed twice as many workers, who eat twice
as much food.] Lets suppose that
[a] In order to produce one denars worth of vegetables, the agricultural workers have to eat 0.3 denars
worth of vegetables;
[b] In order to produce one denars worth of manufactured goods, the manufacturing workers have to
eat 0.4 denars worth of vegetables.
17

Notice from point [a] that, multiplying everything by A, we can say that in order to produce A
denars worth of vegetables, the agricultural workers have to eat 0.3A denars worth of vegetables, so
the agricultural sector has to produce 0.3A denars
worth of vegetables to feed those workers. This 0.3A
is part of the total agricultural output, A.
Similarly, from point [b], multiplying everything
by M, we can say that in order to produce M denars
worth of manufactured goods, the manufacturing workers have to eat 0.4M denars worth of vegetables. So
the agricultural sector has to produce 0.4M denars
worth of vegetables to feed those workers. This 0.4M
is ALSO part of A.
So A breaks up into three parts, and we must
have
A = 0.3A + 0.4M + 150.
Now we turn to manufacturing. Note that mod18

ern agriculture needs manufactured goods [tractors],


and that factories need to buy things from other
factories [say, steel]. Suppose that the government
wants to export 100 million denars worth of manufactured goods that year, and that
[a] In order to produce one denars worth of vegetables, the farms have to buy 0.5 denars worth of
tractors.
[b] In order to produce one denars worth of manufactured goods, the factories need to buy 0.3 denars
worth of steel;
Using the same logic as before, we multiply the
rst statement by A and nd that, in order to produce A denars worth of vegetables, the agricultural
sector has to buy 0.5A denars worth of tractors, and
so on. So now we have

M = 0.5A + 0.3M + 100.


19

or

A
M

[
=

0.3 0.4
0.5 0.3

][

A
M

[
+

150
100

u =Tu + c

where u =

A
0.3 0.4
150
,T =
, c =
.
M
0.5 0.3
100

The matrix T contains all of the INTERNAL INFORMATION about the economy of Macedonia. It
is called the TECHNOLOGY MATRIX. An easy
way to construct the matrix is as follows: think of
the COLUMNS as the costs of making a unit of
something. For example, in this case the rst column refers to agriculture, so the costs of making one
denar of vegetables go down that column [0.3 to feed
the agricultural workers who MAKE one denar of
vegetables, and 0.5 to pay for the tractor needed to
MAKE one denar of vegetables.] Similarly the costs
of making one denars worth of manufactured goods
go down the second column. In a more complicated
20

problem the matrix may be much larger, but this


idea of using the columns to keep track of costs will
always work.

Write u = I u where I is the identity matrix. Then

(I T ) u = c .
Now if these were NUMBERS, I could easily solve

this for u just divide both sides by I T , or


multiply both sides by (I T )1 . But[can we do that
]
0.7 0.4
for matrices? In our case, I T =
.
0.5 0.7
CAN WE FIND A MATRIX S such
S(I T ) =
[ that ]
70 40
1
I?? Actually you can S = 29
Check it!
50 70
So multiplying both sides of our equation by S, we
get

][

150
70 40
1

S(I T ) u = S c u = 29
50
70
100
[ ] [
]

A
500
u =
=
A = M = 500, both sectors
M
500
should generate 500 million denars worth of their

products. This actually adds up: 500 vegetables =


21

150 consumed + 200 to factory + 150 export; 500


manufactures = 150 steel + 250 tractors + 100 export. So you see that the matrix method gives sensible answers.

In discussing the Leontief model, an important


mathematical problem came up: given a matrix M ,
how do you nd another matrix S such that SM =
I? We need a systematic way of doing that! Come
back to this later.

22

You might also like