Matrix Algebra Basics
FOUNDATION COURSE- Batch 2011
Matrix
A matrix is any doubly subscripted array of
elements arranged in rows and columns.
a
11 ,, a1n
21 ,, a 2n
a
A Aij
m1 ,, amn
a
Dimensions of a Matrix
5 4 7
3 6 1
B
2 1 3
Number of Rows: 2 Number of Rows: 3
Number of Columns:3 Number of Columns:3
A (2 x 3) Matrix A (3 x 3) Matrix
Row Vector
[1 x n] matrix
A a1 a 2 ,, an aj
Column Vector
[m x 1] matrix
a1
a 2
A ai
am
Square Matrix
Same number of rows and columns
4 7
5
B 6 1
3
1 3
2
The null matrix, written 0, is the matrix all of whose
components are zero.
The null matrix of order 2 × 3 is
The identity matrix, written I, is a square matrix all of
which entries are zero except those on the main diagonal, which
are ones.
The identity matrix of order 4 is
A diagonal matrix is a square matrix all of which entries
are zero except for those on the main diagonal, which may be
arbitrary.
An upper triangular matrix is a square matrix in
which all elements underneath the main diagonal vanish. A
lower triangular matrix is a square matrix in which all
entries above the main diagonal vanish.
Transpose Matrix
Rows become columns and columns become rows
a11 a 21 , , am1
a12 a 22 , , am 2
A'
a1n a 2 n , , amn
Transpose of a Product: The transpose of a matrix
product is equal to the product of the transposes of
the operands taken in reverse order:
(AB)T= BTAT
Matrix Addition and
Subtraction
A new matrix C may be defined as the
additive combination of matrices A and B
where: C = A + B
is defined by:
Cij Aij Bij
Note: all three matrices are of the same dimension
Addition
a
11 a12
If A
21 a 22
a
b
11 b12
and B
21 b 22
b
11 b11 a12 b12
a
then C
21 b 21 a 22 b22
a
Matrix Addition Example
3
4 2
1 4
6
A B C
6 4
5 3 10
8
Matrix Subtraction
C = A - B
Is defined by
Cij Aij Bij
Matrix Multiplication
Matrices A and B have these dimensions:
[r x c] and [s x d]
Matrix Multiplication
Matrices A and B can be multiplied if:
[r x c] and [s x d]
c=s
Matrix Multiplication
The resulting matrix will have the dimensions:
[r x c] and [s x d]
rxd
For hand computations, the matrix product is most
conveniently organized by the so-called Falk’s
scheme:
Computation: A x B = C
a
11 a12
A [2 x 2]
21 a 22
a
b
11 b12 b13
B [2 x 3]
21 b 22 b 23
b
a11b11 a12b21 a11b12 a12b22 a11b13 a12b23
C
a 21b11 a 22b21 a 21b12 a 22b22 a 21b13 a 22b23
[2 x 3]
Computation: A x B = C
3
2
1
1 1
A 1 and B
1
0 2
1
0
1
[3 x 2] [2 x 3]
A and B can be multiplied
2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 5 2 8
C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 2 1 3
1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111
[3 x 3]
Computation: A x B = C
3
2
1
1 1
A 1 and B
1
0 2
1
0
1
[3 x 2] [2 x 3]
Result is 3 x 3
2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 5 2 8
C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 2 1 3
1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111
[3 x 3]
Matrix Powers
If A = B, the product AA is called the square of A and is
denoted by A2. Note that A must be a square matrix.
Similarly, A3 = AAA = A2 A = A A2
This definition does not encompass negative powers.
A square matrix A that satisfies A = A2 is called
idempotent.
A square matrix A whose pth power is the null matrix
is called p-nilpotent.
Matrix Inversion
1 1
B B BB I
Like a reciprocal Like the number one
in scalar math in scalar math
Symmetry and Anti-symmetry
Square matrices for which aij = aji are called symmetric about the
main diagonal or simply
symmetric.
The following is a symmetric matrix of order 3:
Square matrices for which aij = -aji are called anti-symmetric or
skew-symmetric. The diagonal entries of an anti-symmetric matrix
must be zero.
The following is an anti-symmetric matrix of order 4:
Linear System of Simultaneous
Equations
First precinct: 6 arrests last week equally divided
between felonies and misdemeanors.
Second precinct: 9 arrests - there were twice as
many felonies as the first precinct.
1st Precinct : x1 x 2 6
2nd Pr ecinct : 2x1 x 2 9
1 1 11
Solution Note: Inverse of 2 1 is 2 1
1 1 x1 6
2 1 * x 9
2
11 11 x1 11 6 Premultiply both sides by
2 1 * 2 1 * x 2 1 * 9 inverse matrix
2
1 0 x1 3 A square matrix multiplied by its
0 1 * x 3 inverse results in the identity matrix.
2
x1 3 A 2x2 identity matrix multiplied by
x
the 2x1 matrix results in the original
3
2 2x1 matrix.
General Form
n equations in n variables:
n
aijxj bi or Ax b
j1
unknown values of x can be found using the inverse of
matrix A such that
1 1
x A Ax A b
Garin-Lowry Model
Ax y x
The object is to find x given A and y . This is
done by solving for x :
y Ix Ax
y (I A)x
1
(I A) y x
Properties of Matrix Products
Associativity: A(BC) = (AB)C
Distributivity: If B and C are matrices of the same order, then
A(B + C) = AB + AC, and (B + C)A = BA + CA
Commutativity: If A and B are square matrices of the same
order,
And if AB = BA, the matrices A and B are said to commute.
Scalar Multiplication of Matrices
If A is an m × n matrix and s is a scalar, then we let kA
denote the matrix obtained by multiplying every element of
A by k. This procedure is called scalar multiplication.
1 2 2 31 3 2 32 3 6 6
A 3A 30 3 1 33 0 3 9
0 1 3
PROPERTIES OF SCALAR MULTIPLICATION
k hA kh A
k h A kA hA
k A B kA kB
Matrix Operations in Excel
Select the
cells in
which the
answer
will
appear
Matrix Multiplication in Excel
1) Enter
“=mmult(“
2) Select the
cells of the
first matrix
3) Enter comma
“,”
4) Select the
cells of the
second matrix
5) Enter “)”
Matrix Multiplication in Excel
Enter these
three
key
strokes
at the
same
time:
control
shift
enter
Matrix Inversion in Excel
Follow the same procedure
Select cells in which answer is to be
displayed
Enter the formula: =minverse(
Select the cells containing the matrix to be
inverted
Close parenthesis – type “)”
Press three keys: Control, shift, enter
Determinant of a Matrix
34
Minor of the entry aij: The minor of an element aij of determinant of
a matrix A is the determinant obtained by deleting the ith row and jth
column in which the element aij lies.
a11 a12 L a1( j 1) a1( j 1) L a1 n
M M M
a( i 1)1 L a( i 1)( j 1) a( i 1)( j 1) L a( i 1) n
M ij
a( i 1)1 L a( i 1)( j 1)a ij a( i 1)( j 1) L a( i 1) n
M M M M
a n1 L an ( j 1) an ( j 1) L ann
Cofactor of a ij :
Cij (1)i j Mij
35
Ex:
a11 a12 a13 a11 a12 a13
A a21 a22 a23 A a21 a22 a23
a31 a32
a33
a31 a32
a33
a12 a13 a11 a13
M 21 M 22
a32 a33 a31 a33
C21 ( 1) 21 M 21 M 21 C22 ( 1) 22 M 22 M 22
L
L
Notes: Sign pattern for cofactors
L
L
L
M M M M M
36
Ex: The determinant of a matrix of order 3
a11 a12 a13
A a21 a22 a23
a31 a32
a33
det( A) a11C11 a12C12 a13C13
a21C21 a22C22 a23C23
a31C31 a32C32 a33C33
a11C11 a21C21 a31C31
a12C12 a22C22 a32C32
a13C13 a23C23 a33C33
37
Ex: (The determinant of a matrix of order 3)
0 2 1
A 3 1 2
4 4 1
det( A) ?
Sol:
1 2 3 2
1 2
C12 ( 1) (3 8) 5
1 1
C11 ( 1) 7 4 1
4 1
1 3 3 1
C13 (1) 12 4 8
4 4
det( A) a11C11 a12C12 a13C13
(0)(7) (2)(5) (1)( 8) 2
38
Determinant of a Triangular Matrix
If A is an n x n triangular matrix (upper triangular,
lower triangular, or diagonal), then its determinant is the
product of the entries on the main diagonal. That is
det( A) | A | a11a22a33 L ann
39
Ex: Find the determinants of the following triangular matrices.
1 0 0 0 0
2 0 0 0 0 3 0 0 0
4 2 0 0
(a) A (b) B 0 0 2 0 0
5 6 1 0
1 3 3 0 0 0 4 0
5 0 2
0 0 0
Sol:
(a) |A| = (2)(–2)(1)(3) = –12
(b) |B| = (–1)(3)(2)(4)(–2) = 48
40
Conditions that yield a zero determinant
If A is a square matrix and any of the following conditions is
true, then det (A) = 0.
(a) An entire row (or an entire column) consists of zeros.
(b) Two rows (or two columns) are equal.
(c) One row (or column) is a multiple of another row (or column).
41
Properties of Determinants
1. The value of a determinant remains unchanged if its rows and
columns are interchanged.
a1 a2 a3 a1 b1 c1
b1 b2 b3 a2 b2 c2
c1 c2 c3 a3 b3 c3
2. If two rows or columns of a determinant are interchanged, then the
sign of the determinant is changed.
a1 a2 a3 c1 c2 c3
b1 b2 b3 ; 1 b1 b2 b3
c1 c2 c3 a1 a2 a3
1
42
Properties of Determinants Cont..
3. If each element of a row or a column of a determinant is multiplied
by a constant k, then its value gets multiplied by k.
a1 a2 a3 ka1 a2 a3
b1 b2 b3 ; 1 kb1 b2 b3
c1 c2 c3 kc1 c2 c3
1 k
In case of matrices kA k n A
4. If some or all the elements of a row (or column) of a determinant are
expresses as sum of two (or more) terms, then the determinant can
be expressed as the sum of two or more determinants.
a11 a12 a13 a11 a12 a13 a11 a12 a13
a21 b21 a22 b22 a23 b23 a21 a22 a23 b21 b22 b23
a31 a32 a33 a31 a32 a33 a31 a32 a33
43
Adjoint and inverse of a matrix
The adjoint of a matrix A a ij is defined as the transposeof the
matrix A ij , whereA ij is the cofactorsof the element a ij . Adjoint of
the matrix A is denoted by adj A.
A square matrix A is said to be invertible if there exists a square matrix
B such that
AB BA I,
where I is the identity matrix. The matrix B is called the inverse of A
and vice versa.The inverse is denoted by A -1.
AA1 A1 A I
44
Suppose that A and B are invertible matrices of the same size. Then,
Determinant of an invertible matrix
A square matrix A is invertible (nonsingular) if and only if
det (A) 0
Ex: (Classifying square matrices as singular or nonsingular)
0 2 1 0 2 1
A 3 2 1 B 3 2 1
3 2 1
3 2
1
Sol:
A 0 A has no inverse (it is singular).
B 12 0 B has inverse (it is nonsingular).
46
Equivalent conditions for a nonsingular matrix:
If A is an n × n matrix, then the following statements are
equivalent.
(1) A is invertible.
(2) Ax = b has a unique solution for every n × 1 matrix b.
(3) Ax = 0 has only the trivial solution of zero column vector.
(4) A is row-equivalent to In
(5) A can be written as the product of elementary matrices.
(6) det (A) 0
47
Note:
1. If A and B are two invertible matrices of the same
order, then
(AB)-1 = B-1 A-1
2. If A = [aij] is a non - singular matrix, then
1
A -1
adj A
A
48
Applications of Determinants
Matrix of cofactors of A:
C11 C12 L C1n
C C2n
21 C22 L
Cij M M
M
Note Cij (1)i j Mij
C n1 C n 2 L Cnn
Adjoint matrix of A:
C11 C21 L C n1
C Cn2
adj( A) Cij
T
12 C22 L
M M M
C1n C2 n L Cnn
49
Ex:
1 3 2 (a) Find the adjoint of A.
A 0 2 1
1
1
0 2
(b) Use the adjoint of A to find A
Sol: Q Cij (1)i j Mij
2 1 0 1 0 2
C11 4, C12 1, C13 2
0 2 1 2 1 0
3 2 1 2 1 3
C21 6, C22 0, C23 3
0 2 1 2 1 0
3 2 1 2 1 3
C31 7, C 32 1, C33 2
2 1 0 1 0 2
50
cofactor matrix of A
4 1 2
C ij 6 0 3
7 1 2
inverse matrix of A adjoint matrix of A
Q det A 3
1 1
A adj ( A)
det A
4 6 7 4
3 2 7
3
1 1 0 1 1 0 1
3
3 3
2
3 2
2
3 1 3
2
Check: AA1 I 51
Cramer’s Rule
a11 x1 a12 x2 L a1n xn b1
a21 x1 a22 x2 L a2 n xn b2
M
x1 b1
an1 x1 an 2 x2 L ann xn bn x b
A aij x 2 b 2
Ax b n n
A(1) , A(2) ,L , A( n )
M M
xn bn
a11 a12 L a1n
a21 a22 L a2 n
det( A) 0
M M M (this system has a unique solution)
a n1 an 2 L ann
52
Aj A(1) , A(2) ,L , A( j 1) , b, A( j 1) ,L , A( n)
a11 L a1( j 1) b1 a1( j 1) L a1 n
a21 L a2( j 1) b2 a2( j 1) L a2 n
M O M
a n1 L
an ( j 1) bn an ( j 1) L ann
( i.e., det( Aj ) b1C1 j b2C 2 j L bnC nj
)
1 1
x A b adj ( A) b
det A
det( A j )
xj , j 1, 2,L , n
det( A)
53
Cramer’s rule to solve the system of linear
equations
x 2 y 3z 1
2x z 0
3x 4 y 4 z 2
Sol: 1 2 3 1 2 3
det( A) 2 0 1 10 det( A1 ) 0 0 1 8
3 4 4 2 4 4
1 1 3 1 2 1
det( A2 ) 2 0 1 15, det( A3 ) 2 0 0 16
3 2 4 3 4 2
det( A1 ) 4 det( A2 ) 3 det( A3 ) 8
x y z
det( A) 5 det( A) 2 det( A) 5 54
Matrix: a set of Column
Vectors
2 3
a11 a12 ¢¢¢ a1n
6 7
6 a21 a22 ¢¢¢ a2n 7
A = 6
6
7
4 ¢ ¢ ¢¢¢ ¢ 7 5 coefficient matrix =
a set of column vectors
am1 am2 ¢¢¢ amn
A = [a(1) a(2) ¢¢¢ a(n) ]
Linear Dependence and
Independence
A = [a(1) a(2) ¢¢¢ a(n) ]
The set of vectors are linearly dependent set if in
c1a(1) + c2a(2) + ¢¢¢+ cn a(n) = 0
there exists at least one value of the scalars c that is not
equal to zero. If all c are equal to zero, the set of vectors
is linearly independent.
Linear Combination
c1a(1) + c2a(2) + ¢¢¢+ cn a(n) = 0
If ck is nonzero
c1 c2 cn
a(k) = ¡ a(1) ¡ a(2) ¡ ¢¢¢¡ a(n)
ck ck ck
If one vector in a set of vectors can be expressed as
a linear combination of the others, the vectors are
linearly dependent.
Example Problems
3 -2 0
-2 4 -1
A = Answer: independent
0 -1 6
4 -2 0
2 -1 0
B = Answer: dependent
0 -1 6
Rank of a Matrix
The rank of a matrix A, written as r(A), is the maximum
number of linearly independent row vectors of a matrix A.
1 2 3
2 4 6
A = Answer: r(A) = 2
7 8 9
Matlab function: rank(A)
Rank in terms of Column
Vectors
The rank of a matrix A, written as r(A), is the maximum
number of linearly independent row vectors of a matrix A.
The rank of a matrix A equals the maximum number of
linearly independent column vector of A.
A and its transpose AT have the same rank.
(proof omitted)
Row-equivalent matrices have the same rank.
Linear
dependence/independence
p vectors are linearly independent if the matrix with the p vectors
has rank p; they are linearly dependent if that rank is less than p.
Applying Matlab, one uses rank to determine whether a number
of vectors are linearly independent.