MTK 7 Operasi Vektor

You might also like

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

Operasi Matriks

Heri Sutanta

Department of Geodesy & Geomatics Engineering


Matrix Operations

• Addition and Subtraction


• Multiplication
• Transposition
• Inversion
Addition and Subtraction

• Two matrices may be added if they are the same


order.
• Simply add the corresponding elements

a11 a12   b11 b12  c11 c12 


a a   b b   c c 
 21 22   21 22   21 22 
a31 a32  b31 b32  c31 c32 
Addition and Subtraction (cont.)

• Where
a11  b11  c11
a12  b12  c12
a21  b21  c 21
a22  b22  c 22
a31  b31  c31
a32  b32  c32
• Hence

1 2 4 6 5 8 
3 4  4 6  7 10
     
5 6 4 6 9 12
Matrix Multiplication

• To multiply a scalar times a matrix, simply


multiply each element of the matrix by the scalar
quantity

a11 a12   2a11 2a12 


2   
 21 22   21
a a 2a 2a22 
Matrix Multiplication (cont.)

• To multiply a matrix times a matrix, we write


• A times B as AB
• This is pre-multiplying B by A, or post-multiplying
A by B.
Matrix Multiplication (cont.)

• In order to multiply matrices, they must be


conformable (the number of columns in A must
equal the number of rows in B.)
– an (mxn) x (nxp) = (mxp)
– an (mxn) x (pxn) = cannot be done
– a (1xn) x (nx1) = a scalar (1x1)
Matrix Multiplication (cont.)

• Thus a11 a12 a13   b11 b12  c11 c12 


a a a  x b b   c c 
 21 22 23   21 22   21 22 
a31 a32 a33  b31 b32  c31 c32 

c11  a11b11  a12b21  a13b31


• where c12  a11b12  a12b22  a13b32
c 21  a21b11  a22b21  a23b31
c 22  a21b12  a22b22  a23b32
c31  a31b11  a32b21  a33b31
c32  a31b12  a32b22  a33b32
Matrix Multiplication- an example

• Thus 1 4 7 1 4 c11 c12  30 66


2 5 8 x 2 5  c c   36 81
     21 22   
3 6 9 3 6 c31 c32  42 96

• where
c11  1 * 1  4 * 2  7 * 3  30
c12  1 * 4  4 * 5  7 * 6  66
c 21  2 * 1  5 * 2  8 * 3  36
c 22  2 * 4  5 * 5  8 * 6  81
c31  3 * 1  6 * 2  9 * 3  42
c32  3 * 4  6 * 5  9 * 6  96
Matrix multiplication is not Commutative

• AB does not necessarily equal BA


• (BA may even be an impossible operation)
Yet matrix multiplication is Associative

• A(BC) = (AB)C
Special matrices

• There are a number of special matrices


– Diagonal
– Null
– Identity
Diagonal Matrices
– A diagonal matrix is a square matrix that has values
on the diagonal with all off-diagonal entities being
zero.

a11 0 0 0
0 a 0 0 
 22 
0 0 a33 0 
 
0 0 0 a44 
Identity Matrix

• An identity matrix is a diagonal matrix where the


diagonal elements all equal one. It is used in a
fashion analogous to multiplying through by "1"
in scalar math.

1 0 0 0
0 1 0 0

0 0 1 0
 
0 0 0 1
Null Matrix
• A square matrix where all elements equal zero.
0 0 0 0
0 0 0 0

0 0 0 0
 
0 0 0 0

• Not usually ‘used’ so much as sometimes the


result of a calculation.
The Transpose of a Matrix A'

• Taking the transpose is an operation that


creates a new matrix based on an existing one.
• The rows of A = the columns of A'
• Hold upper left and lower right corners and
rotate 180 degrees.
Example of a transpose

1 4 
  1 2 3
A  2 5, A'   
3 6  4 5 6 
The Transpose of a Matrix A'

• If A = A', then A is symmetric (i.e. correlation


matrix)
• If AA’ = A then A' is idempotent (and A' = A)
• The transpose of a sum = sum of transposes
( A  B  C )'  A'B'C'
• The transpose of a product = the product of the
transposes in reverse order

( ABC )'  C' B' A'


Matrix Determinants
 A Determinant is a real number associated with a
matrix. Only SQUARE matrices have a
determinant.
 Determinants exist only for square matrices.
 They are a matrix characteristic, and they are
also difficult to compute
 The symbol for a determinant can be the phrase
“det” in front of a matrix variable, det(A); or
vertical bars around
3 1
a matrix, |A| or .
2 4
Matrix Determinants

To find the determinant of a 2 x 2 matrix,


multiply diagonal #1 and subtract the product
of diagonal #2.
Diagonal 2 = -2

3 1
 12  (2)  14
2 4
Diagonal 1 = 12
The Determinant for a 2x2 matrix

• If A = a11 a12 
a 
 21 22 
a

• Then
A  a11a22  a12a21

• That one is easy


Matrix Determinants

To find the determinant of a 3 x 3 matrix, first


recopy the first two columns. Then do 6
diagonal products.
18 60 16

5 2 6 5 2
2 1 4 2 1
3 3 4 3 3
-20 -24 36
Matrix Determinants

The determinant of the matrix is the sum of


the downwards products minus the sum of the
upwards products.
18 60 16

5 2 6 5 2
2 1 4 2 1 = (-8) - (94) = -102
3 3 4 3 3
-20 -24 36
The Determinant for a 3x3 matrix
• If A = a11 a12 a13 
a a a 
 21 22 23 

a31 a32 a33 

• Then
A  a11a22a33  a11a23a32  a12a23a31  a12a21a33  a13a21a32  a13a22a31
Properties of Determinates
• Determinants have several mathematical
properties which are useful in matrix
manipulations.
– 1 |A|=|A'|.
– 2. If a row of A = 0, then |A|= 0.
– 3. If every value in a row is multiplied by k, then |A|
= k|A|.
– 4. If two rows (or columns) are interchanged the
sign, but not value, of |A| changes.
– 5. If two rows are identical, |A| = 0.
Properties of Determinates
– 6. |A| remains unchanged if each element of a
row or each element multiplied by a constant, is
added to any other row.
– 7. Det of product = product of Det's |A| = |A| |B|
– 8. Det of a diagonal matrix = product of the
diagonal elements
Matrix Products

• The method of • Matrix multiplication was


multiplication of introduced by an English
matrices is not as mathematician named
intuitive and may seem Arthur Cayley (1821-
strange, although this 1895). We will see shortly
method is extremely how matrix multiplication
useful in many can be used to solve
mathematical systems of linear
applications. equations.

Barnett/Ziegler/Byleen Finite Mathematics 11e 27


Arthur Cayley
1821-1895
• Introduced matrix multiplication

28
Barnett/Ziegler/Byleen Finite Mathematics 11e
Matrix Equations

Example: Find a, b, c, and d so that

 a b   2 1  4 3
 c d    5 6    2 4
     

Barnett/Ziegler/Byleen Finite Mathematics 11e 29


Matrix Equations

Example: Find a, b, c, and d so that

 a b   2 1  4 3
 c d    5 6    2 4
     
Solution: Subtract the matrices on the left side:
 a  2 b  1   4 3
 c  5 d  6   2 4
   
Use the definition of equality to change this matrix equation into 4 real
number equations:
a - 2 = 4 b + 1 = 3 c + 5 = -2 d-6=4 a=6 b=
2 c = -7 d = 10

Barnett/Ziegler/Byleen Finite Mathematics 11e 30


Example:
Revenue of a Car Dealer
• A car dealer sells four model types: A, B, C, D.
In a given week, this dealer sold 10 cars of
model A, 5 of model B, 8 of model C and 3 of
model D. The selling prices of each automobile
are respectively $12,500, $11,800, $15,900 and
$25,300. Represent the data using matrices and
use matrix multiplication to find the total
revenue.

31
Barnett/Ziegler/Byleen Finite Mathematics 11e
Solution using Matrix Multiplication

• We represent the number of each model sold


using a row matrix (4x1), and we use a 1x4
column matrix to represent the sales price of
each model. When a 4x1 matrix is multiplied by a
1x4 matrix, the result is a 1x1 matrix containing a
single number.
12,500 
11,800 
10 5 8 3    10(12,500)  5(11,800)  8(15,900)  3(25,300)  387,100
15,900 
 
 25,300 
32
Barnett/Ziegler/Byleen Finite Mathematics 11e
Matrix Product

• If A is an m x p matrix and B is a p x n matrix,


the matrix product of A and B, denoted by AB, is
an m x n matrix whose element in the i th row
and j th column is the real number obtained from
the product of the i th row of A and the j th
column of B. If the number of columns of A does
not equal the number of rows of B, the matrix
product AB is not defined.

33
Barnett/Ziegler/Byleen Finite Mathematics 11e
Undefined Matrix Multiplication

Why is the matrix multiplication below not defined?

34
Barnett/Ziegler/Byleen Finite Mathematics 11e
Undefined Matrix Multiplication
Solution
Why is the matrix multiplication below not defined?
The answer is that the left matrix has three
columns but the matrix on the right has only two
rows. To multiply the second row [4 5 6] by the
third column, 3 , there is no number to pair with 6
to multiply. 7

35
Barnett/Ziegler/Byleen Finite Mathematics 11e
Practical Application

• Suppose you a business owner and sell


clothing. The following represents the number of
items sold and the cost for each item. Use matrix
operations to determine the total revenue over
the two days:
Monday: 3 T-shirts at $10 each, 4 hats at $15
each, and 1 pair of shorts at $20.
Tuesday: 4 T-shirts at $10 each, 2 hats at $15
each, and 3 pairs of shorts at $20.

36
Barnett/Ziegler/Byleen Finite Mathematics 11e
Solution of Practical Application

• Represent the information using two matrices:


The product of the two matrices gives the total
revenue: Qty sold
Unit price of of each
each item: item on
 3 4 Monday
10 15 20 4 2
1 3  Qty sold of
each item on
Tuesday

• Then your total revenue for the two days is =


[110 130] Price times Quantity = Revenue
37
Barnett/Ziegler/Byleen Finite Mathematics 11e
Inverse Matrices

 When you multiply a matrix and its


inverse, you get the identity matrix.

 3 1  2 1   1 0 
 5 2   5 3   0 1 
    
Inverse Matrices

 Not all matrices have an inverse!


 To find the inverse of a 2 x 2 matrix,
first find the determinant.
a) If the determinant = 0, the inverse does
not exist!
 The inverse of a 2 x 2 matrix is the
reciprocal of the determinant times the
matrix with the main diagonal swapped
and the other terms multiplied by -1.
Inverse Matrices

 3 1
Example 1: A   
 5 2 

det(A)  6  (5)  1

11 2 1 2 1
A   
1  5 3  5 3

Inverse Matrices

 2 2 
Example 2: B 
 5 4 

det(B)  (8)  (10)  2

11 4 2   2 1
B    5

2  5 2    2 1
The Inverse of a Matrix (A-1)

• For an nxn matrix A, there may be a B such that


AB = I = BA.
• The inverse is analogous to a reciprocal)
• A matrix which has an inverse is nonsingular.
• A matrix which does not have an inverse is
singular.
• An inverse exists only if
A 0
Inverse by Row or column operations

• Set up a tableau matrix


• A tableau for inversions consists of the matrix to
be inverted post multiplied by a conformable
identity matrix.
Matrix Inversion by Tableau Method
• Rules:
– You may interchange rows.
– You may multiply a row by a scalar.
– You may replace a row with the sum of that row and
another row multiplied by a scalar.
• Every operation performed on A must be
performed on I
• When you are done; A = I & I = A-1
The Tableau Method of Matrix
Inversion: An Example
• Step 1: Set up Tableau

1 4 3  1 0 0
2 5 4  0 1 0 
  
1  3  2 0 0 1
Matrix Inversion – cont.

• Step 2: Add –2(Row 1) to Row 2


1 4 3   1 0 0
0  3  2    2 1 0 
  
1  3  2  0 0 1

• Step 3: Add –1(Row 1) to Row 3


1 4 3   1 0 0
0  3  2    2 1 0 
  
0  7  5   1 0 1
Matrix Inversion – cont.

• Step 4: Multiply Row 2 by –1/3


1 4 3  1 0 0
0 1 2 / 3 2 / 3  1 / 3 0
  
0  7  5    1 0 1
• Step 5: Add –4 (Row 2) to Row 1

1 0 1 / 3   5 / 3 4 / 3 0
0 1 2 / 3  2 / 3  1 / 3 0
  
0  7  5    1 0 1
Matrix Inversion – cont.

• Step 6: Add 7(Row 2) to Row 3


1 0 1 / 3    5 / 3 4 / 3 0
0 1 2 / 3   2 / 3  1 / 3 0 
  
0 0  1 / 3  11 / 3  7 / 3 1

• Step 7: Add Row 3 to Row 1


1 0 0  2  1 1
0 1 2 / 3   2 / 3  1 / 3 0 
  
0 0  1 / 3 11 / 3  7 / 3 1
Matrix Inversion – cont.

• Step 9: Add 2(Row 3) to Row 2


1 0 0  2  1 1
0 1 0  8  5 2 
  
0 0  1 / 3 11 / 3  7 / 3 1

• Step 9: Multiply Row 3 by -3


1 0 0  2 1 1 
0 1 0   8  5 2 
  
0 0 1  11 7  3
Checking the calculation

• Remember AA-1=I
1 4 3  2  1 1  1 0 0
2 5 4   8  5 2   0 1 0 
    
1  3  2  11 7  3 0 0 1

• Thus 1 * 2  4 * 8  3 * 11  1
1 * 1  4 * 5  3 * 7  0
etc
Identity Matrix and Inverses

 1 0 0
 
I 33   0 1 0
 0 0 1
 
1 1
AA  A A  I
1 1 1
( AB)  B A

You might also like