You are on page 1of 7

Technological Institute of the Philippines - Manila Course: MATH 022A

Math & Physics Department ONLINE LECTURE

Laboratory Activity No. 4

Laboratory Activity No. 4


Application of Matrix Operations
Name: Section:
Date Performed: Date Submitted:
1. Objective(s):

1.1 To identify matrix as the product of a lower triangular matrix L and an upper triangular matrix U.
1.2 To factor a matrix into a product of elementary matrices.
1.3 To find and use an LU – factorization of a matrix to solve a system of linear equations.
1.4 To use matrix multiplication to encode and decode messages.
1.5 To find the least squares regression line for a set of data.

2. Intended Learning Outcomes (ILOs):

The students shall be able to:


2.1 Demonstrate scientific thinking and the ability to approach scientific resources intelligently.
2.2 Utilize MATLAB software in solving linear algebra problems related to their fields of
specialization.
2.3 Infer appropriate conclusions based upon the results of the activity.
2.4 Reflect on personal transformation along the T.I.P. graduate attributes, specifically, professional
competence and critical thinking skills.

3. Discussion:

Another general approach to solve Ax = b is known as the method of LU – Factorization, which provides
new insights into matrix algebra and has many theoretical and practical uses. Efficient computer
algorithms for handling practical problems can be developed from it.

The symbols L and U denote lower triangular matrix and upper triangular matrices, respectively.

0 0
0 lower triangular matrix (L) 0 upper triangular matrix (U)
0 0

By writing AX = Lux and letting Ux = y, variable x can be solved in two stages. First, solve Ly = b for y;
then solve Ux = y for x. Each system is easy to solve because the coefficient matrices are triangular. In
particular, neither system requires any row operations. A cryptogram is a message written according to
a secret code (the Greek word kryptos means “hidden”). The following describes a method of using
matrix multiplication to encode and decode messages.
space – 0 D–4 H–8 L – 12 P – 16 T – 20 X – 24
A–1 E–5 I –9 M – 13 Q – 17 U – 21 Y – 25
B–2 F–6 J – 10 N – 14 R – 18 V – 22 Z – 26
C–3 G–7 K – 11 O – 15 S – 19 W – 23
Matrix form a linear regression model y = Ax + E the coefficient of the least square regression line is
given by the matrix equation A = (XTX) –1(XTY)
Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

4. Procedure:

Activity 1. Determine the sequence of elementary matrices and corresponding inverse of each
elementary

1 5 3 1 0 0
matrix of = 3 4 2 using the identity matrix = 0 1 0
2 1 5 0 0 1

Using the solution on solving lower triangular matrix of A, fill up all the elementary matrices and its
inverse by row operation on each step.
elementary matrix inverse of elementary matrix

1 5 3 _____ _____ _____ _____ _____ _____


3 4 2 −3 + = _____ _____ _____ _____ _____ _____
2 1 5 _____ _____ _____ _____ _____ _____

1 5 3 _____ _____ _____ _____ _____ _____


0 −11 −7 = _____ _____ _____ _____ _____ _____
2 1 5 −2 + _____ _____ _____ _____ _____ _____

1 5 3 _____ _____ _____ _____ _____ _____


1
0 −11 −7 − = _____ _____ _____ _____ _____ _____
0 −9 −1 11 _____ _____ _____ _____ _____ _____

1 5 3 _____ _____ _____ _____ _____ _____


0 1 7/11 = _____ _____ _____ _____ _____ _____
0 −9 −1 9 + _____ _____ _____ _____ _____ _____

1 5 3 _____ _____ _____ _____ _____ _____


0 1 7/11
11 = _____ _____ _____ _____ _____ _____
0 0 52/11 _____ _____ _____ _____ _____ _____
52

1 5 3
= 0 1 7/11
0 0 1

1. Find the product of “E5E4E3E2E1A” using MATLAB


_____ _____ _____
answer in fraction: _____ _____ _____
_____ _____ _____

2. Is the answer in number 1 the same as the upper triangular matrix? _______________________
Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

3. Determine the lower triangle matrix by multiplying all inverse of elementary


matrix “ E1–1 E2–1 E3–1 E4–1 E5–1 “ using MATLAB

answer in fraction
_____ _____ _____
_____ _____ _____
_____ _____ _____

4. Is the product of lower and upper triangular matrix equal to matrix A ( LU = A ) ?

L U A
_____ _____ _____ _____ _____ _____ _____ _____ _____
_____ _____ _____ _____ _____ _____ = _____ _____ _____
_____ _____ _____ _____ _____ _____ _____ _____ _____

Explain: __________________________________________________________

Solving a linear equation system Ax = b. First, we can express the coefficient matrix A in the form of the
LU – Factorization. Then we may solve the linear system by the following procedure:

Example 1

Solve the system, on MATLAB [ LU ] = lu(A)


Coefficient matrix
– x + 2x + x = 0 _____ _____ _____
8x + 6x = 10 A = _____ _____ _____
_____ _____ _____
– 2x + 5x = – 11

_____ _____ _____ _____ _____ _____


L = _____ _____ _____ U = _____ _____ _____
_____ _____ _____ _____ _____ _____

1. Solve the system Ly = b

L y = b
_____ _____ _____ 0
_____ _____ _____ = 10
_____ _____ _____ −11

Back substitution now yields:

= _____ =_________ = ______


Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

2. Solve Ux = y

U x = y
_____ _____ _____ _____
_____ _____ _____ = _____
_____ _____ _____ _____

Back substitution now yields:

= _____ =_________ = ______

Activity 2. Use the inverse of matrix B

1 1 1
= 4 5 3 to decode the cryptograph using MATLAB
5 6 3
example on MATLAB encode: [55 63 40] * [inv(B)] = answer ( decoded row matrix )

55 63 40 204 245 143 174 207 120 47 55 38 19 20 17 42 49 35 60 70 41 86


101 57 81 96 52 91 112 63 13 16 9 127 148 86 57 71 42 82 96 55 106 132
79 109 128 71 81 97 49 84 102 55 50 62 37 90 110 69 42 49 35 90 105 61
71 84 46 34 42 25 57 71 43 92 113 64 104 125 63 100 121 72 106 129 69 92
113 64 49 61 36 103 123 72 82 102 61 14 14 14
the message is : ___________________________________________________________________
____________________________________________________________________
____________________________________________________________________
.
Activity 3.Find the least squares regression line for the points( 1, 0 ), ( 2, 0 ), ( 3, 0 ), ( 3, 1 ),
( 4, 1 ), ( 4, 2 ), ( 5, 2 ), and ( 6, 2 ) using MATLAB

⎡ ⎤ ⎡ ⎤
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
= ⎢ ⎥ Y= ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎣ ⎦ ⎣ ⎦

then, type on command window: rats[( inv( X’ * X ) ) * ( X’ * Y )]

answer: _____________________________________________
Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

Exercises

1. Solve the system of linear equation using LU – Factorization of the matrix

2x1 + 6x2 + 4x3 = 5 Coefficient matrix


_____ _____ _____
6x1 + 19x2 + 12x3 = 6 _____ _____ _____
2x1 + 8x2 + 14x3 = 7 _____ _____ _____

_____ _____ _____ _____ _____ _____


L = _____ _____ _____ U = _____ _____ _____
_____ _____ _____ _____ _____ _____

= _____ =_________ = ______

1 0 2
2. Decode the following Filipino riddles and answer it, using matrix C = 2 −1 1
0 1 2

a.) 10 24 67 29 –14 16 16 –1 29 37 –9 47 13 10 45 1 2 6
43 –10 55 13 –1 23 28 –7 35 44 –10 47 23 –10 15

the message is: ___________________________________________________________________


____________________________________________________________________

b.) 23 4 43 2 24 51 26 –12 15 25 11 72 19 –7 15 23 –6 27
14 11 50 39 –18 23 15 –1 27 41 –15 37 13 7 39 49 –20 38
21 0 41 14 0 28

the message is: ___________________________________________________________________


____________________________________________________________________

c.) 53 –7 71 7 11 36 19 3 35 29 –14 16 43 –15 41 34 5 69


41 –19 24 25 19 88 23 –10 15 32 –15 18 16 13 50 15 1 31
1 1 4 28 –7 35 44 –13 41 51 –25 27

the message is: ___________________________________________________________________


____________________________________________________________________
Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

3. A notebook manufacturing company has experience the following costs ( in P1000 ) for the
first half of the year.

Month January February March April May June


Notebook (X) 3 3.4 2.8 3.3 3 3.5
Costs (Y) 219 221 216 225 218 223

⎡ ⎤ ⎡ ⎤
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
= ⎢ ⎥ Y= ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎣ ⎦ ⎣ ⎦

a.) Find the least squares regression line for the cost from January to June.

_______________________________________________________________________

b.) If the company produce a 3.8 notebook, predict the cost of the company.

_________________________________________________________________________

c.) If the company produce a 5.35 notebook, predict the cost of the company.

_________________________________________________________________________
Technological Institute of the Philippines - Manila Course: MATH 022A
Math & Physics Department ONLINE LECTURE

Conclusion

Proprietary Clause

Property of the Technological Institute of the Philippines (T.I.P.). No part of the materials made
and uploaded in this learning management system by T.I.P. may be copied, photographed, printed,
reproduced, shared, transmitted, translated or reduced to any electronic medium or medium-
readable form, in whole or in part, without prior consent of T.I.P.

You might also like