applications in ch2
DESCRIPTION
ansTRANSCRIPT
-
84 Chapter 2 Matrices
2.5 Applications of Matrix Operations
Write and use a stochastic matrix.
Use matrix multiplication to encode and decode messages.
Use matrix algebra to analyze an economic system (Leontief
input-output model).
Find the least squares regression line for a set of data.
STOCHASTIC MATRICES
Many types of applications involve a finite set of states of a givenpopulation. For instance, residents of a city may live downtown or in the suburbs. Voters may vote Democrat, Republican, or Independent. Soft drink consumers may buy Coca-Cola, Pepsi Cola, or another brand.
The probability that a member of a population will change from the th state to theth state is represented by a number where A probability of
means that the member is certain not to change from the th state to the th state,whereas a probability of means that the member is certain to change from the th state to the th state.
From
. . .
To
is called the matrix of transition probabilities because it gives the probabilities ofeach possible type of transition (or change) within the population.
At each transition, each member in a given state must either stay in that state orchange to another state. For probabilities, this means that the sum of the entries in anycolumn of is 1. For instance, in the first column,
Such a matrix is called stochastic (the term stochastic means regarding conjecture). That is, an matrix is a stochastic matrix when each entry is anumber between 0 and 1 inclusive, and the sum of the entries in each column of is 1.
Examples of Stochastic Matrices
and Nonstochastic Matrices
The matrices in parts (a) and (b) are stochastic, but the matrices in parts (c) and (d) are not.
a. b.
c. d. 3121314
14
034
1423
0430.10.20.3
0.20.30.4
0.30.40.54
3121414
13
023
1434
043100
010
0014
PPn 3 n
p11 1 p21 1 . . . 1 pn1 5 1.
P
P
S1S2.
.
.
Sn
P 5 3p11p21.
.
.
pn1
p12p22.
.
.
pn2
. . .
. . .
. . .
p1np2n.
.
.
pnn4
SnS2S1
ijpij 5 1
ijpij 5 00 # pij # 1.pij,i
j
HS1, S2, . . . , SnJ
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
-
Example 2 describes the use of a stochastic matrix to measure consumer preferences.
A Consumer Preference Model
Two competing companies offer satellite television service to a city with 100,000households. Figure 2.1 shows the changes in satellite subscriptions each year. Company A now has 15,000 subscribers and Company B has 20,000 subscribers. Howmany subscribers will each company have in one year?
Figure 2.1
SOLUTION
The matrix representing the given transition probabilities is
From
A B None
To
and the state matrix representing the current populations in the three states is
To find the state matrix representing the populations in the three states in one year,multiply by to obtain
In one year, Company A will have 23,250 subscribers and Company B will have 28,750 subscribers.
One appeal of the matrix solution in Example 2 is that once you have created the model, it becomes relatively easy to find the state matrices representing future years by repeatedly multiplying by the matrix Example 3 demonstrates this process.
P.
5 323,25028,75048,0004.
PX 5 30.700.200.10
0.150.800.05
0.150.150.704 3
15,00020,00065,0004
XP
ABNone
X 5 315,00020,00065,0004.
ABNone
P 5 30.700.200.10
0.150.800.05
0.150.150.704
SatelliteCompany A
No SatelliteTelevision
SatelliteCompany B
80%70%
70%
20%
15%
5%15%10%
15%
2.5 Applications of Matrix Operations 85
JYWang
JYWang
JYWang
JYWang
JYWang
-
A Consumer Preference Model
Assuming the matrix of transition probabilities from Example 2 remains the same yearafter year, find the number of subscribers each satellite television company will have after(a) 3 years, (b) 5 years, and (c) 10 years. Round each answer to the nearest whole number.SOLUTION
a. From Example 2, you know that the numbers of subscribers after 1 year are
After 1 year
Because the matrix of transition probabilities is the same from the first year to thethird year, the numbers of subscribers after 3 years are
After 3 years
After 3 years, Company A will have 30,283 subscribers and Company B will have39,042 subscribers.
b. The numbers of subscribers after 5 years are
After 5 years
After 5 years, Company A will have 32,411 subscribers and Company B will have43,812 subscribers.
c. The numbers of subscribers after 10 years are
After 10 years
After 10 years, Company A will have 33,287 subscribers and Company B will have 47,147 subscribers.
In Example 3, notice that there is little difference between the numbers of subscribers after 5 years and after 10 years. If you continue the process shown in thisexample, then the numbers of subscribers eventually reach a steady state. That is, aslong as the matrix does not change, the matrix product approaches a limit In Example 3, the limit is the steady state matrix
Steady state
Check to see that as follows.
< 333,33347,61919,0484 5 X
PX 5 30.700.200.10
0.150.800.05
0.150.150.704 3
33,33347,61919,0484
PX 5 X,
ABNone
X 5 333,33347,61919,0484.
X.P nXP
ABNone
P10X < 333,28747,14719,5664.
ABNone
P 5X < 332,41143,81223,7774.
ABNone
P 3X < 330,28339,04230,6754.
ABNone
PX 5 323,25028,75048,0004.
86 Chapter 2 Matrices
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
-
CRYPTOGRAPHY
A cryptogram is a message written according to a secret code (the Greek word kryptosmeans hidden). The following describes a method of using matrix multiplication toencode and decode messages.
To begin, assign a number to each letter in the alphabet (with 0 assigned to a blankspace), as follows.
Then convert the message to numbers and partition it into uncoded row matrices, eachhaving entries, as demonstrated in Example 4.
Forming Uncoded Row Matrices
Write the uncoded row matrices of size for the message MEET ME MONDAY.
SOLUTION
Partitioning the message (including blank spaces, but ignoring punctuation) into groupsof three produces the following uncoded row matrices.
Note the use of a blank space to fill out the last uncoded row matrix.
To encode a message, choose an invertible matrix and multiply the uncodedrow matrices (on the right) by to obtain coded row matrices. Example 5 demonstrates this process.
AAn 3 n
[1A
25Y
0]__
[15O
14N
4]D
[5E
0__
13]M
[20T
0__
13]M
[13M
5E
5]E
1 3 3
n
13 5 M26 5 Z12 5 L25 5 Y11 5 K24 5 X10 5 J23 5 W9 5 I22 5 V8 5 H21 5 U7 5 G20 5 T6 5 F19 5 S5 5 E18 5 R4 5 D17 5 Q3 5 C16 5 P2 5 B15 5 O1 5 A14 5 N0 5 __
2.5 Applications of Matrix Operations 87
LINEAR ALGEBRA APPLIED
Because of the heavy use of the Internet to conduct business,
Internet security is of the utmost importance. If a malicious
party should receive confidential information such as
passwords, personal identification numbers, credit card
numbers, social security numbers, bank account details, or
corporate secrets, the effects can be damaging. To protect the
confidentiality and integrity of such information, the most
popular forms of Internet security use data encryption, the
process of encoding information so that the only way to
decode it, apart from a brute force exhaustion attack, is
to use a key. Data encryption technology uses algorithms
based on the material presented here, but on a much more
sophisticated level, to prevent malicious parties from
discovering the key.
Andrea Danti/Shutterstock.com
-
Encoding a Message
Use the following invertible matrix
to encode the message MEET ME MONDAY.
SOLUTION
Obtain the coded row matrices by multiplying each of the uncoded row matrices foundin Example 4 by the matrix , as follows.
Uncoded Encoding Coded RowRow Matrix Matrix Matrix
The sequence of coded row matrices is
Finally, removing the matrix notation produces the following cryptogram.
13 21 33 18 5 56 23 77
For those who do not know the encoding matrix decoding the cryptogram found in Example 5 is difficult. But for an authorized receiver who knows the encoding matrix decoding is relatively simple. The receiver just needs to multiply the coded row matrices by to retrieve the uncoded row matrices. In other words, if
is an uncoded matrix, then is the corresponding encoded matrix. The receiver of the encoded matrix can decode by multiplying on the right by to obtain
Example 6 demonstrates this procedure.
YA21 5 sXAdA21 5 X.
A21YY 5 XA1 3 n
X 5 fx1 x2 . . . xng
A21A,
A,
224220242223212253226
f224 23 77g.f5 220 56gf13 226 21g f33 253 212g f18 223 242g
f1 25 0g 31
211
221
21
23
244 5 f224 23 77g f15 14 4g 3
121
1
221
21
23
244 5 f5 220 56g f5 0 13g 3
121
1
221
21
23
244 5 f18 223 242g f20 0 13g 3
121
1
221
21
23
244 5 f33 253 212g f13 5 5g 3
121
1
221
21
23
244 5 f13 226 21gA
A
A 5 31
211
221
21
23
244
88 Chapter 2 Matrices
-
Decoding a Message
Use the inverse of the matrix
to decode the cryptogram
SOLUTION
Begin by using Gauss-Jordan elimination to find
Now, to decode the message, partition the message into groups of three to form thecoded row matrices
.
To obtain the decoded row matrices, multiply each coded row matrix by (on the right).
Coded Row Decoding DecodedMatrix Matrix Row Matrix
The sequence of decoded row matrices is
and the message is
13M
5E
5E
20T
0__
13M
5E
0__
13M
15O
14N
4D
1A
25Y
0.__
f13 5 5g f20 0 13g f5 0 13g f15 14 4g f1 25 0g
f224 23 77g 32121
0
2102621
2825214 5 f1 25 0g
f5 220 56g 32121
0
2102621
2825214 5 f15 14 4g
f18 223 242g 32121
0
2102621
2825214 5 f5 0 13g
f33 253 212g 32121
0
2102621
2825214 5 f20 0 13g
f13 226 21g 32121
0
2102621
2825214 5 f13 5 5g
A21
A21f13 226 21g f33 253 212g f18 223 242g f5 220 56g f224 23 77g
3100
010
001
2121
0
2102621
28252143
1 21
1
221
21
23
24
100
010
0014
fI A21gfA I g
A21.
13 226 21 33 253 212 18 223 242 5 220 56 224 23 77.
A 5 31
211
221
21
23
244
2.5 Applications of Matrix Operations 89
SimulationExplore this concept further with an electronic simulation availableat www.cengagebrain.com.
-
LEONTIEF INPUT-OUTPUT MODELS
In 1936, American economist Wassily W. Leontief (19061999) published a model concerning the input and output of an economic system. In 1973, Leontief received aNobel prize for his work in economics. A brief discussion of Leontiefs model follows.
Suppose that an economic system has different industries . . . , each of which has input needs (raw materials, utilities, etc.) and an output (finished product). In producing each unit of output, an industry may use the outputs of otherindustries, including itself. For example, an electric utility uses outputs from otherindustries, such as coal and water, and also uses its own electricity.
Let be the amount of output the th industry needs from the th industry to produceone unit of output per year. The matrix of these coefficients is called the input-output matrix.
User (Output)
. . .
Supplier (Input)
To understand how to use this matrix, consider This means that for Industry 2 to produce one unit of its product, it must use 0.4 unit of Industry 1sproduct. If then Industry 3 needs 0.2 unit of its own product to produce oneunit. For this model to work, the values of must satisfy and the sum ofthe entries in any column must be less than or equal to 1.
Forming an Input-Output Matrix
Consider a simple economic system consisting of three industries: electricity, water,and coal. Production, or output, of one unit of electricity requires 0.5 unit of itself,0.25 unit of water, and 0.25 unit of coal. Production of one unit of water requires 0.1 unit of electricity, 0.6 unit of itself, and 0 units of coal. Production of one unit ofcoal requires 0.2 unit of electricity, 0.15 unit of water, and 0.5 unit of itself. Find theinput-output matrix for this system.
SOLUTION
The column entries show the amounts each industry requires from the others, and fromitself, to produce one unit of output.
User (Output)
E W C
Supplier (Input)
The row entries show the amounts each industry supplies to the others, and to itself,for that industry to produce one unit of output. For instance, the electricity industry supplies 0.5 unit to itself, 0.1 unit to water, and 0.2 unit to coal.
To develop the Leontief input-output model further, let the total output of the thindustry be denoted by If the economic system is closed (meaning that it sells itsproducts only to industries within the system, as in the example above), then the totaloutput of the th industry is given by the linear equation
Closed systemx i 5 di1x1 1 di2x2 1 . . . 1 dinxn.
i
x i.
i
EWC3
0.50.250.25
0.1 0.6 0
0.20.150.5 4
0 # dij # 1dijd33 5 0.2,
d12 5 0.4.
I1I2.
.
.
In
D 5 3d11d21.
.
.
dn1
d12d22.
.
.
dn2
. . .
. . .
. . .
d1nd2n.
.
.
dnn4
InI2I1
ijdij
In,I2,I1,n
90 Chapter 2 Matrices
-
On the other hand, if the industries within the system sell products to nonproducinggroups (such as governments or charitable organizations) outside the system, then thesystem is open and the total output of the th industry is given by
Open system
where represents the external demand for the th industrys product. The followingsystem of linear equations represents the collection of total outputs for an open system.
The matrix form of this system is where is the output matrix and isthe external demand matrix.
Solving for the Output Matrix
of an Open System
An economic system composed of three industries has the following input-outputmatrix.
User (Output)
A B C
Supplier (Input)
Find the output matrix when the external demands are
Round each matrix entry to the nearest whole number.
SOLUTION
Letting be the identity matrix, write the equation as which means that Using the matrix above produces
Finally, applying Gauss-Jordan elimination to the system of linear equations representedby produces
So, the output matrix is
To produce the given external demands, the outputs of the three industries must be46,616 units for industry A, 51,058 units for industry B, and 38,014 units for industry C.
ABC
X 5 346,61651,05838,0144.
3100
010
001
46,61651,05838,0144.3
0.9 20.1520.23
20.431
20.03
0 20.37
0.98
20,00030,00025,0004
sI 2 DdX 5 E
I 2 D 5 30.9
20.1520.23
20.431
20.03
0 20.37
0.984.DsI 2 DdX 5 E.
IX 2 DX 5 E,X 5 DX 1 EI
ABC
E 5 320,00030,00025,0004.
X
ABC
D 5 30.10.150.23
0.4300.03
00.370.02 4
EXX 5 DX 1 E,
x1
x2
xn
5
5.
.
.
5
d11x1d21x1
dn1x1
1
1
1
d12x 2d22x 2
dn2x 2
1 . . . 1
1 . . . 1
1 . . . 1
d1nxnd2nxn
dnnxn
1
1
1
e1
e2
en
n
iei
x i 5 di1x1 1 di2x2 1 . . . 1 dinxn 1 ei
i
2.5 Applications of Matrix Operations 91
REMARKThe economic systems
described in Examples 7 and 8
are, of course, simple ones.
In the real world, an economic
system would include many
industries or industrial groups.
A detailed analysis using
the Leontief input-output
model could easily require
an input-output matrix greater
than in size. Clearly,
this type of analysis would
require the aid of a computer.
100 3 100
-
LEAST SQUARES REGRESSION ANALYSIS
You will now look at a procedure used in statistics to develop linear models. The nextexample demonstrates a visual method for approximating a line of best fit for a givenset of data points.
A Visual Straight-Line Approximation
Determine a line that appears to best fit the points and
SOLUTION
Plot the points, as shown in Figure 2.2. It appears that a good choice would be the linewhose slope is 1 and whose -intercept is 0.5. The equation of this line is
An examination of the line in Figure 2.2 reveals that you can improve the fit by rotating the line counterclockwise slightly, as shown in Figure 2.3. It seems clear that this line, whose equation is fits the given points better than the original line.
Figure 2.2 Figure 2.3
One way of measuring how well a function fits a set of points
is to compute the differences between the values from the function and the actualvalues These values are shown in Figure 2.4. By squaring the differences and summing the results, you obtain a measure of error called the sum of squared error. The table shows the sums of squared errors for the two linear models.
yi.f sx id
sx1, y1d, sx2, y2d, . . . , sxn, ynd
y 5 f (x)
x1
1
2
3
4
5
6
2 3 4 5 6
(1, 1)(2, 2)
(3, 4) (4, 4)
(5, 6)y
y = 0.5 + x
y = 1.2x
y
x1
1
2
3
4
5
6
2 3 4 5 6
(1, 1)(2, 2)
(3, 4) (4, 4)
(5, 6)
y = 0.5 + x
y 5 1.2x,
y 5 0.5 1 x.
y
s5, 6d.s1, 1d, s2, 2d, s3, 4d, s4, 4d,
92 Chapter 2 Matrices
Model 1: f xxc 5 0.5 1 x Model 2: f xxc 5 1.2xxi yi f xxic [ yi 2 f xxic]2 xi yi f xxic [ yi 2 f xxic]21 1 1.5 s20.5d2 1 1 1.2 s20.2d2
2 2 2.5 s20.5d2 2 2 2.4 s20.4d2
3 4 3.5 s10.5d2 3 4 3.6 s10.4d2
4 4 4.5 s20.5d2 4 4 4.8 s20.8d2
5 6 5.5 s10.5d2 5 6 6.0 s0.0d2
Sum 1.25 Sum 1.00
x1
1
2
3
4
5
6
2 3 4 5 6
(1, 1)(2, 2)
(3, 4) (4, 4)
(5, 6)Model 1y
y = 0.5 + x
x1
1
2
3
4
5
6
2 3 4 5 6
(1, 1)(2, 2)
(3, 4) (4, 4)
(5, 6)Model 2y
y = 1.2x
Figure 2.4
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
-
The sums of squared errors confirm that the second model fits the given points betterthan the first model.
Of all possible linear models for a given set of points, the model that has the bestfit is defined to be the one that minimizes the sum of squared error. This model is calledthe least squares regression line, and the procedure for finding it is called the methodof least squares.
To find the least squares regression line for a set of points, begin by forming thesystem of linear equations
where the right-hand term,
of each equation is the error in the approximation of by Then write this error as
and write the system of equations in the form
Now, if you define and as
then the linear equations may be replaced by the matrix equation
Note that the matrix has a column of 1s (corresponding to ) and a column containing the s. This matrix equation can be used to determine the coefficients ofthe least squares regression line, as follows.
x i
a0X
Y 5 XA 1 E.
n
E 5 3e1e2.
.
.
en4A 5 3a0a14,X 5 3
11.
.
.
1
x1x2.
.
.
xn4,Y 5 3
y1y2.
.
.
yn4,
EY, X, A,
yn 5 sa0 1 a1xnd 1 en.
.
.
.
y2 5 sa0 1 a1x2d 1 e2
y1 5 sa0 1 a1x1d 1 e1
ei 5 yi 2 fsx id
fsx id.yifyi 2 f sx idg
yn 5 fsxnd 1 fyn 2 fsxndg.
.
.
y2 5 f sx2d 1 fy2 2 f sx2dgy1 5 f sx1d 1 fy1 2 f sx1dg
2.5 Applications of Matrix Operations 93
Definition of Least Squares Regression Line
For a set of points
the least squares regression line is given by the linear function
that minimizes the sum of squared error
fy1 2 f sx1dg2 1 fy2 2 f sx2dg2 1 . . . 1 fyn 2 f sxndg2.
f sxd 5 a0 1 a1x
sx1, y1d, sx2, y2d, . . . , sxn, ynd
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
JYWang
-
Example 10 demonstrates the use of this procedure to find the least squares regression line for the set of points from Example 9.
Finding the Least Squares Regression Line
Find the least squares regression line for the points and
SOLUTION
The matrices and are
and
This means that
and
Now, using to find the coefficient matrix you have
So, the least squares regression line is
as shown in Figure 2.5. The sum of squared error for this line is 0.8 (verify this), whichmeans that this line fits the data better than either of the two experimental linear models determined earlier.
y 5 20.2 1 1.2x
5 320.21.24. 5
1503 55
215215
54 317634
A 5 sXTXd21XTY
A,sXTXd21
XTY 5 31112
13
14
154 3
124464 5 317634.
X TX 5 31112
13
14
154 3
11111
123454 5 3 515 15554
Y 5 3124464.X 5 3
11111
123454YX
s5, 6d.s4, 4d,s3, 4d,s2, 2d,s1, 1d,
94 Chapter 2 Matrices
Matrix Form for Linear Regression
For the regression model the coefficients of the least squares regression line are given by the matrix equation
and the sum of squared error is
ETE.
A 5 sXTXd21XTY
Y 5 XA 1 E,
REMARKYou will learn more about this
procedure in Section 5.4.
x1
1
2
3
4
5
6
2 3 4 5 6
(1, 1)(2, 2)
(3, 4) (4, 4)
(5, 6)
Least Squares Regression Line
y
y = 0.2 + 1.2x
Figure 2.5
JYWang
JYWang