Professional Documents
Culture Documents
4a Linear Models and Matrix Algebra
4a Linear Models and Matrix Algebra
Matrix Expression of a
System of Linear
Equations
Subject Expert:
ROY B. GACUS
Ingredients in the equation
system
• Coefficients
• Variables
• constant
Given this system of linear equation:
7x + 3y = 45
4x + 5Y = 25
Can be expressed in matrix form: AX=B
Cont:.
X & B is
always be a
column vectors
UNIVERSITY OF SOUTHERN MINDANAO
Matrices: Basic
Operations
Subject Expert:
ROY B. GACUS
Addition and Subtraction of matrices
A B aij bij
A B aij bij
An example:
• 1. Add the matrices • Solution: Adding corresponding
entries we have
4 3 1 1 2 3
0 5 2 6 7 9
5 6 0 0 4 8
• First, note that each matrix has
3 1 4
dimensions of 3X3, so we are 6 2 7
able to perform the addition.
The result is shown at right:
5 10 8
Subtraction of matrices
• Now, we will subtract the • Subtract corresponding
same two matrices entries as follows:
4 (1) 3 2 1 3
4 3 1 1 2 3 06
0 5 2 6 7 9 5 ( 7) 2 9
5 0 6 (4) 0 8
5 6 0 0 4 8
5 5 2
= 6 12 11
5 2 8
Scalar Multiplication
• The scalar product of a number k and a matrix A
is the matrix denoted by kA, obtained by
multiplying each entry of A by the number k . The
number k is called a scalar. In mathematical
notation,
kA kaij
Example of scalar
multiplication
• Find (-1)A where • Solution:
• A= • (-1)A=
1 2 3
6 7 9 • -1 1 2 3
6 7 9
0 4 8
0 4 8
1 2 3 1 2 3
(1) 6 7 9 6 7 9
0 4 8 0 4 8
Alternate definition of subtraction of
matrices:
• The definition of subtract • If A and B are two matrices
of two real numbers a and of the same dimensions,
b is then
• a – b = a + (-1)b or a plus • A – B = A + (-1)B, where -
the opposite of b. We can 1 is a scalar.
define subtraction of
matrices similarly:
An example
• The example at right • Solution:
illustrates this procedure
for 2 2X2 matrices.
1 2 5 6 1 2
3 4 7 8 3 4
5 6 1 2 5 6
(1)
7 8 3 4 7 8
4 4
4 4
Matrix product
• The method of • Matrix multiplication was
multiplication of matrices introduced by an English
is not as intuitive and may mathematician named
seem strange, although Arthur Cayley
this method is extremely • (1821-1895) . We will see
useful in many shortly how matrix
mathematical applications. multiplication can be used
to solve systems of linear
equations.
Arthur Cayley (1821-1895)
• 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 of 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
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 ith row and jth column is the real
number obtained from the product of the Ith row of A
and the jth 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.
Multiplying a 2X4 matrix by a 4X3 matrix
to obtain a 4X2
Why is this matrix multiplication 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
More examples:
1 6
Given A = 3 1 1 3B= 5
2 0 3
2 4
3 1 1 1 6
Find AB if it is defined: 3
2 0 3 5
2 4
Is Matrix Multiplication Commutative?
3 4
10 15 20 4 2
Qty sold of each item
on Tuesday
1 3
• Then your total revenue for the two days is =[110 130] Price
Quantity=Revenue
UNIVERSITY OF SOUTHERN MINDANAO
Determinants
Subject Expert:
ROY B. GACUS
Determinants
• Given a square matrix A its determinant is a real
number associated with the matrix.
• The determinant of A is written:
det(A) or |A|
• For a 2x2 matrix, the definition is
det a b = a b = ad - bc
c d c d
• For larger matrices the definition is more
complicated
Determinants 2x2 examples
1 1 -2
A = -1 2 3
2 7 0
|A|= 1x 2 3 - 1x -1 3 + (-2) -1 2
7 0 2 0 2 7
0 1 3
B= 5 3 1
-1 2 0
|B|= 0x 3 1 - 1x 5 1 + 3x 5 3
2 0 -1 0 -1 2
+ - +
- + -
+ - +
3.9.1 The formula for a 3x3 matrix
• Equally, we could have used any column as long as we
follow the signs pattern
+ - +
a11 a12 a13 - + -
A = a21 a22 a23 + - +
a31 a32 a33
• E.g. using the first column:
|A| = a11|M11| - a21|M21| + a31|M31|
• This choice sometimes makes it a bit easier to
calculate determinants. e.g.
1 1 -2
A= 0 2 3
0 1 1
• Using the first row:
|A|= 1x 2 3 - 1x 0 3 + (-2) x 0 2
1 1 0 1 0 1
1 1 -2
A= 0 2 3
0 1 1
• However, using the first column:
|A|= 1x 2 3 - 0 + 0 = 1x(-1) = -1
1 1
3.9.2 A general formula for determinants
• For a 4x4 matrix we add up minors like the 3x3 case, and
again use the same signs pattern
+ - + -
- + - +
+ - + -
- + - +
• Notice that if we think of the signs pattern as a matrix, then
it can be written as (-1)i+j
3.9.2 A general formula for determinants
• Or, n
|A|= a C
j 1
ij ij for any i=1,2,...,n
UNIVERSITY OF SOUTHERN MINDANAO
A =
-1 1 (matrix of co-factors)T
(ad-bc)
Examples
a b
• Calculate the inverse of A =
c d
• Found that:
1
= (matrix of co-factors)T
1
Examples 3x3 Matrix
• Using the formula,
1
B =
-1
(matrix of co-factors)T
|B|
1
2 0 -1 T
=
1 -1 2 -1
0 -1 1
Examples 3x3 Matrix
• Using the formula,
1
B =
-1
(matrix of co-factors)T
|B|
2 -1 0
= 0 2 -1
-1 -1 1
• Same answer obtained by Gauss-Jordan method
Examples 3x3 Matrix
Example: Find the inverse of a matrix using co-factor expansion:
-3 4 5
B= -1 5 -1
2 4 2
UNIVERSITY OF SOUTHERN MINDANAO
Cramer's Rule
Gabriel Cramer, a Swiss mathematician (1704-1752)
So: 2 5 8 2
10 4 and 2 10
x y
42 42
2 5
10 4 8 (50) 42
x 1
42 42 42
8 2
2 10 80 4 84
y 2
42 42 42
Solution: (-1,2)
Applying Cramer’s Rule
on a System of Two Equations
ax by e 2 x 3 y 16
cx dy f 3x 5 y 14
a b 2 3
D D (2)(5) (3)(3) 10 9 19
c d 3 5
e b 16 3
Dx Dx (16)(5) (3)(14) 80 42 38
f d 14 5
2 16
a e Dy (2)(14) (3)(16) 28 48 76
Dy 3 14
c f Dx 38 D y 76
x 2 y 4
Dx Dy D 19 D 19
x y
D D
Evaluating a 3x3 Determinant
(expanding along the top row)
2 4 5
D 3 5 7 336
5 3 8
36 4 5
D1 7 5 7 672
31 3 8
Example 1
2 36 5
D2 3 7 7 1008
5 31 8
2 4 36
D3 3 5 7 1344
5 3 31
D1 672
x1 2
D 336
D 1008
x2 2 3
D 336
D3 1344
x3 4
D 336
Cramer’s Rule - 3 x 3
• Consider the 3 equation system below with
variables x, y and z:
a1 x b1 y c1z C1
a2 x b2 y c2 z C2
a3 x b3 y c3 z C3
Cramer’s Rule - 3 x 3
• The formulae for the values of x, y and z are shown
below. Notice that all three have the same
denominator.
a1 C1 c1 a1 b1 C1
C1 b1 c1
a2 C2 c2 a2 b2 C2
C2 b2 c2
a 3 C 3 c3 a3 b3 C3
C3 b3 c3 y z
x a1 b1 c1 a1 b1 c1
a1 b1 c1
a2 b2 c2 a2 b2 c2
a2 b2 c2
a3 b3 c3 a3 b3 c3
a3 b3 c3
Example 1
• Solve the system : 3x - 2y + z = 9
• x + 2y - 2z = -5
x + y - 4z = -2
9 2 1 3 9 1
5 2 2 1 5 2
2 1 4 23 1 2 4 69
x 1 y 3
3 2 1 23 3 2 1 23
1 2 2 1 2 2
1 1 4 1 1 4
Example 1
3 2 9
1 2 5
1 1 2 0
z 0
3 2 1 23 The solution is
1 2 2
1 1 4 (1, -3, 0)
Business Application
• A commodity was produced by using 3 units of
labor and 2 units of capital, the total cost is P62.
If the commodity had been produced by using 4
units of labor and one unit of capital, the cost is
P56. What is the cost per unit of labor and
capital?
UNIVERSITY OF SOUTHERN MINDANAO
Simplex Method
Subject Expert:
PROF. ROY B. GACUS