Matrix Operation Rules
Example 1
Given:
3 1 5 2 7 5 6 2
A = 4 2 2 , B = 4 2 3 , C = 3 5
4 3 1 7 3 6 4 2
Solve for 1) A+B, 2) A-B, and 3) AC.
Solution:
3 + 2 1 + 7 5 + 5 5 8 10
1. A + B = 4 + 4 2 + 2 2 + 3 = 8 4 5
4 + 7 3 + 3 1 + 6 11 6 7
3 − 2 1 − 7 5 − 5 1 −6 0
2. A − B = 4 − 4 2 − 2 2 − 3 = 0 0 −1
4 − 7 3 − 3 1 − 6 −3 0 −5
3x6 + 1x3 + 5 x 4 3x 2 + 1x5 + 5 x 2
A C = 4 x6 + 2 x3 + 2 x 4 4 x 2 + 2 x5 + 2 x 2
4 x6 + 3x3 + 1x 4 4 x 2 + 3 x5 + 1x 2
18 + 3 + 20 6 + 5 + 10
3. = 24 + 6 + 8 8 + 10 + 4
24 + 9 + 4 8 + 15 + 2
41 21
= 38 22
37 25
Note: That CxA is not allowed because the interior dimensions of the two matrices to be
multiplied must be equal. Follow the rule of matrix multiplication as shown by the following
formula:
Example 2
Given:
1 3
−2 4 1
A = 2 −1 , B =
3 −5 2
4 −3
−2 x1 + 3x3 4 x1 + (−5) x3 1x1 + 2 x3
AB = −2 x 2 + 3x(−1) 4 x 2 + (−5) x(−1) 1x 2 + 2 x(−1)
−2 x 4 + 3(−3) 4 x4 + (−5)(−3) 1x4 + 2 x( −3)
7 −11 7
AB = −7 13 0
−17 31 −2
Identity Matrix is a square matrix that has a value of 1 unit, whose elements are zero except the
diagonal
1 0 0
For a 3x3 matrix, I = 0 1 0
0 0 1
Transpose of a matrix
The transpose of a matrix A with elements aij is A T having elements a ji
Example
1 −2 3
A = 2 3 −1
3 −1 2
1 2 3
AT = −2 3 −1
3 −1 2
In short, the transpose of A is a matrix of the same size in which the element in the rows
in A becomes the elements of the columns in the transpose A T .
Determinant of a Matrix
Example 3
1 −2 3
Given: A = 2 3 −1 , compute the determinant of matrix A
3 −1 2
Solution:
Repeat the first two columns of the matrix. Draw the arrow and proceed with multiplication of
the elements along the drawn lines. Sign convention: arrow down is positive, arrow up is
negative.
1 −2 3 1 −2
det A = 2 3 −1 2 3
3 −1 2 3 −1
= (1)(3)(2) + (−2)(−1)(3) + (3)(2)(−1)
− (3)(3)(3) + (−1)(−1)(1) + (2)(2)(−2)
= −14
Note: the above solution is only valid for determinants with dimension less or equal to 3. Higher
determinants can only be evaluated by the following method.
Minors of and Cofactors
a11 a12 a13
D = a21 a22 a23
a31 a32 a33
To get the minor of element a21, cross the element a21, the remaining elements outside the
crossing is the minor of element a21.
a a13
M 21 = 12
a32 a33
The cofactor of element a21 is given by the formula: Aij = ( −1)i + j M ij
a a13
A21 = (−1) 2+1 M 21 = (−1)3 12
a32 a33
a a13
= − 12
a32 a33
Example 4
2 −4 3 −1
−1 1 −2 2
Evaluate the determinant D =
3 2 −4 −1
−2 5 1 4
Solution:
Expand the matrix using the second row. Add all the cofactors of the elements of the second row
as follows:
D = a21 A21 + a22 A22 + a23 A23 + a24 A24
D = (−1) A21 + (1) A22 + (−2) A23 + (2) A24
−4 3 −1
A21 = (−1) 2+1 2 −4 −1
5 1 4
2 3 −1
A22 = (−1) 2+ 2 3 −4 −1
−2 1 4
2 −4 −1
A23 = (−1) 2+3 3 2 −1
−2 5 4
2 −4 3
A24 = (−1) 2+ 4 3 2 −4
−2 5 1
−4 3 −1 2 3 −1
D = (−1)(−1) 2+1 2 −4 −1 + (1)(−1) 2+ 2 3 −4 −1
5 1 4 −2 1 4
2 −4 −1 2 −4 3
+ (−2)(−1) 2+3 3 2 −1 + (2)(−1) 2+ 4 3 2 −4
−2 5 4 −2 5 1
−4 3 −1 2 3 −1
D = 2 −4 −1 + 3 −4 −1
5 1 4 −2 1 4
2 −4 −1 2 −4 3
+ 2 3 2 −1 + 2 3 2 −4
−2 5 4 −2 5 1
= 64 − 2 − 15 − (20 + 4 + 24) + −32 − 3 + 6 − (−8 − 2 + 36
+ 2 16 − 15 − 8 − (4 − 10 − 48) + 2 4 + 45 − 32 − ( −12 − 40 − 12)
= −1 − 55 + 94 + 162
Gauss-Jordan Elimination
Example 5
Solve the system of linear equation using matrix row operation.
x − 2 y + 3z = 6
2x + 3y − z = 5
3x − y + 2 z = 7
Solution:
Arrange the system in matrix form Ax = B
1 −2 3 x 6
2 3 −1 y = 5
3 −1 2 z 7
1 −2 3 6
Where: Coefficients A = 2 3 −1 , Constants B = 5 , x represents the unknown values
3 −1 2 7
Augmented matrix is a matrix composed of the coefficients A and the constants B
1 −2 3 6 R1
2 3 −1 5 R 2
3 −1 2 7 R3
Proceed with Gauss elimination or Forward elimination:
1 −2 3 6 R1
0 1 −1 −1 R2 / 7 , divide row2 by 7
0 5 −7 −1 R3
This ends Gauss elimination or Forward elimination. The backward elimination process
completes what is called Gauss-Jordan elimination. The objective of Gauss-Jordan elimination is
to make the Coefficient matrix A an Identity matrix I.
Backward elimination:
1 −2 3 6 R1
0 1 −1 −1 R2 , divide row3 by − 2
0 0 1 3 R3 / (−2)
Rewrite into matrix form Ax = B
1 0 0 x 1
0 1 0 y = 2
0 0 1 z 3
x 1
y = 2 Ans
z 3
Inverse of a Matrix
Example 6
Solve the system of linear equations by finding first the inverse of matrix A, using matrix row
operation.
x − 2 y + 3z = 6
2x + 3y − z = 5
3x − y + 2 z = 7
Solution:
1) Write the matrix equation:
Ax = B
1 −2 3 6
A = 2 3 −1 , B = 5
3 −1 2 7
The solution is x = A−1B
2) Find the inverse of matrix A.
Arrange the matrix A and identity matrix I as an augmented matrix AI as shown:
1 −2 3 1 0 0
A = 2 3 −1 , I = 0 1 0
3 −1 2 0 0 1
1 −2 3 1 0 0
AI = 2 3 −1 0 1 0
3 −1 2 0 0 1
1 −2 3 1 0 0 R1
2 3 −1 0 1 0 R2
3 −1 2 0 0 1 R3
The objective here is to transfer the identity matrix to the place of the coefficients and whatever
remains in the former position of the identity matrix, it is therefore the inverse of matrix A. The
result is an augmented matrix in the form of IA−1 .
1 −2 3 1 0 0 R1
0 7 −7 −2 1 0 R2 − 2 R1
0 5 −7 −3 0 1 R3 − 3R1
1 −2 3 1 0 0 R1
0 1 −1 −2 / 7 1/ 7 0 R2 / 7
0 5 −7 −3 0 1 R3
1 −2 3 1 0 0 R1
0 1 −1 −2 / 7 1/ 7 0 R2
0 0 −2 −11/ 7 −5 / 7 1 R3 − 5 R2
1 −2 3 1 0 0 R1
0 1 −1 −2 / 7 1/ 7 0 R2
0 0 1 11/14 −5 /14 −1/ 2 R3 / ( −2)
1 0 1 3/ 7 2/7 0 R1 + 2 R2
0 1 −1 −2 / 7 1/ 7 0 R2
0 0 1 11/14 −5 /14 −1/ 2 R3
1 0 0 −5 /14 −1/14 1/ 2 R1 − R3
0 1 0 1/ 2 1/ 2 −1/ 2 R2 + R3 = IA−1
0 0 1 11/14 −5 /14 −1/ 2 R3
−5 /14 −1/14 1/ 2
Therefore A = 1/ 2
−1
1/ 2 −1/ 2
11/14 5 /14 −1/ 2
3) Solve for the variables x, y, z
x = A−1B
x −5 /14 −1/14 1/ 2 6
y = 1/ 2 1/ 2 −1/ 2 5
z 11/14 5 /14 −1/ 2 7
6(−5 /14) + 5(−1/14) + 7(1/ 2)
= 6(1/ 2) + 5(1/ 2) + 7(−1/ 2)
6(11/14) + 5(5 /14) + 7( −1/ 2
1
= 2 ans
3