0% found this document useful (0 votes)
43 views46 pages

Mat Rice

A matrix is a rectangular array of numbers or other items arranged in rows and columns. Matrices are commonly used in linear algebra. They are sized using the number of rows by the number of columns. Common matrix operations include addition, subtraction, scalar multiplication, and multiplication. Matrix multiplication is only defined if the number of columns of the first matrix equals the number of rows of the second matrix. Special types of matrices include zero matrices, diagonal matrices, identity matrices, and square matrices where the number of rows equals the number of columns.

Uploaded by

Sir Kay Swiss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views46 pages

Mat Rice

A matrix is a rectangular array of numbers or other items arranged in rows and columns. Matrices are commonly used in linear algebra. They are sized using the number of rows by the number of columns. Common matrix operations include addition, subtraction, scalar multiplication, and multiplication. Matrix multiplication is only defined if the number of columns of the first matrix equals the number of rows of the second matrix. Special types of matrices include zero matrices, diagonal matrices, identity matrices, and square matrices where the number of rows equals the number of columns.

Uploaded by

Sir Kay Swiss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Matrices

What is a matrix?

A Matrix is just rectangular arrays of items


A typical matrix is a rectangular array of
numbers arranged in rows and columns.

 21 62 33 93
 
A   44 95 66 13 
3x4
77 38 79 33
Sizing a matrix

By convention matrices are “sized” using


the number of rows (m) by number of
columns (n). 7 3 2 
 21 62 33 93 B  8 4 1 
A   44 95 66 13  3x3
 6 5 9 
3x4
77 38 79 33
11 4
14 7 
C  D  17 
1 x1
4x2 16 8 
 
 22 3
“Special” Matrices
Square matrix: a square matrix is an mxn
matrix in which m = n. 7 3 2 
B  8 4 1 
3 x3
 6 5 9 
Vector: a vector is an mxn matrix where
either m OR n = 1 (but not both).
12 
9
X   Y   7 22 14
4 x1  4  1x 3
 
0
Addition, Scalar Multiplication, and
Multiplication of Matrices
• aij: the element of matrix A in row i and column j.
• For a square nn matrix A, the main diagonal is:
 a11 a12  a1n 
a a22  a2 n 
A   21
     
 
an1 an 2  ann 

Definition
Two matrices are equal if they are of the same size and if their
corresponding elements are equal.

Thus A = B if aij = bij  i, j. ( for every, for all)


Addition of Matrices
Definition
Let A and B be matrices of the same size.
Their sum A + B is the matrix obtained by adding together the
corresponding elements of A and B.
The matrix A + B will be of the same size as A and B.
If A and B are not of the same size, they cannot be added, and we
say that the sum does not exist.

Thus if C  A  B, then cij  aij  bij i,j.


Example
Let A   1 4 7, B   2 5  6, and C   5 4.
0  2 3  3 1 8  2 7 
Determine A + B and A + C, if the sum exist.
Solution
(1) A  B   1 4 7    2 5  6
0  2 3  3 1 8
 1  2 4  5 7  6
0  3  2  1 3  8
  3 9 1.
 3  1 11
(2) Because A is 2  3 matrix and C is a 2  2 matrix, there are
not of the same size, A + C does not exist.
Scalar Multiplication of matrices
Definition
Let A be a matrix and c be a scalar. The scalar multiple of A by c,
denoted cA, is the matrix obtained by multiplying every element
of A by c. The matrix cA will be the same size as A.
Thus if B  cA, then bij  caij i, j.

Example

Let A   1  2 4.
7  2 0
 3  1 3  (2) 3  4  3  6 12
3A   .
3  7 3  ( 3) 3  0 21  9 0
Observe that A and 3A are both 2  3 matrices.
Subtraction
Definition
We now define subtraction of matrices in such a way that makes it
compatible with addition, scalar multiplication, and negation. Let
A – B = A + (–1)B
Example

Suppose A  5 0  2 and B  2 8  1.


3 6  5 0 4 6
 5  2 0  8  2  ( 1) 3  8  1
A B   .
3  0 6  4  5  6 3 2  11
Multiplication of Matrices
Definition
Let the number of columns in a matrix A be the same as the
number of rows in a matrix B. The product AB then exists.
Let A be mn matrix, B be nk matrix,
The product matrix C=AB
 b1 j 
b 
cij  ai1  ain   2j
ai 2  ai1b1 j  ai 2b2 j    ainbnj
  
 
 bnj 
C is a mk matrix.
If the number of columns in A does not equal the number of row B,
we say that the product does not exist.
Example
 1 3 5 0 1
Let A    ,B  , and C  6  2 5.
 2 0 3  2 6 
Determine AB, BA, and AC , if the products exist.
Sol.
AB   1 3 5 0 1
2 0 3  2 6
 5   0 1  
 1 3   1 3  1 3   
3  2  6  
 
 5   0 1  
 2 0  2 0
2 
2 0 
 3  6  
 (1 5)  (3  3) (1 0)  (3  (2)) (11)  (3  6)
 
(2  5)  (0  3) (2  0)  (0  (2)) (2  1)  (0  6)
14  6 19
 .
10 0 2 
BA and AC do not exist. Note. In general, ABBA.
Example
 2 1
Let A   7 0 and B   1 0. Determine AB.
 3 5
 3  2
 2 1 1 2 10 
  3 5 
 2 1
 1 0   1 0 
AB   7 0     7 0   
7 05  
 3 5   3
 3  2  

   

 3  2   1  3  2  0 
  3 5 
  2  3 0  5  1 5
   7  0 0  0    7 0
 3  6 0  10   3  10
Example
Let C = AB, A   2 1 and B   7 3 2 Determine c23.
 3 4  5 0 1
  2  (3  2)  (4  1)  2
c23  3 4
 1
Size of a Product Matrix
If A is an m  r matrix and B is an r  n matrix, then AB will be an
m  n matrix.

A B = AB
mr rn mn

Example
If A is a 5  6 matrix and B is an 6  7 matrix.
Because A has six columns and B has six rows. Thus AB exits.
And AB will be a 5  7 matrix.
Special Matrices
Definition
A zero matrix is a matrix in which all the elements are zeros.
A diagonal matrix is a square matrix in which all the elements
not on the main diagonal are zeros.
An identity matrix is a diagonal matrix in which every diagonal
element is 1.
a11 0  0 1 0  0
0 0  0 0 a22  0  I n  0 1  0
0mn  0 0  0 A    
        
0 0  0   0 0  1
0 0  ann 

zero matrix identity matrix


diaginal matrix A
Theorem
Let A be m  n matrix and Omn be the zero m  n matrix. Let B be
an n  n square matrix. On and In be the zero and identity n  n
matrices. Then
A + Omn = Omn + A = A
BOn = OnB = On
BIn = InB = B
Example
Let A  2 1  3 and B   2 1.
4 5 8  3 4
2 1  3 0 0 0 2 1  3
A  O23     A
4 5 8 0 0 0 4 5 8
 2 1 0 0 0 0
BO2         O2
 3 3 0 0 0 0
 2 1 1 0  2 1
BI 2     B
 3 4 0 1  3
  4
Example
Let A be a matrix whose third row is all zeros. Let B be any
matrix such that the product AB exists.
Prove that the third row of AB is all zeros.
Solution

 b1i   b1i 
b  b 
( AB )3i  [a31 a32  a3n ]  2i   [0 0  0]  2i   0, i.
 
   
b
 ni  bni 
Algebraic Properties of Matrix
Operations
Theorem
Let A, B, and C be matrices and a, b, and c be scalars. Assume that the
size of the matrices are such that the operations can be performed.
Properties of Matrix Addition and scalar Multiplication
1. A + B = B + A Commutative property of addition
2. A + (B + C) = (A + B) + C Associative property of addition
3. A + O = O + A = A (where O is the appropriate zero matrix)
4. c(A + B) = cA + cB Distributive property of addition
5. (a + b)C = aC + bC Distributive property of addition
6. (ab)C = a(bC)
Theorem
Let A, B, and C be matrices and a, b, and c be scalars. Assume that the
size of the matrices are such that the operations can be performed.
Properties of Matrix Multiplication
1. A(BC) = (AB)C Associative property of multiplication
2. A(B + C) = AB + AC Distributive property of multiplication
3. (A + B)C = AC + BC Distributive property of multiplication
4. AIn = InA = A (where In is the appropriate zero matrix)
5. c(AB) = (cA)B = A(cB)
Note: AB BA in general. Multiplication of matrices is not
commutative.
Proof of Thm. (A+B=B+A)
Consider the (i,j)-th elements of matrices A+B and B+A:
( A  B ) ij  aij  bij  bij  aij  ( B  A) ij .
A+B=B+A

Example
Let A   1 3, B  3  7 , and C  0  2.
 4 5 8 1 5  1
A  B  C   1 3  3  7   0  2
 4 5 8 1 5  1

  1  3  0 3  7  2  4  6.
 4  8  5 5  1  1 9 5
Example
 4
Let A   1 2, B   0 1 3, and C   1 .
  Compute ABC.
3  1  1 0  2
 0
Sol. Which method is better?
(1) (AB)C
AB   1 2  0 1 3   2 1  1.
3  1  1 0  2  1 3 11
 2 1  1  4  9
( AB )C     1   .
 1 3 11 0  1
 
(2) A(BC)

 4
BC   0 1 3   1    1 
 1 0 2 0  4
 
A( BC )   1 2   1   9.  A(BC) is better.
3  1  4  1
Remark
In algebra we know that the following cancellation laws apply.
If ab = ac and a  0 then b = c.
If pq = 0 then p = 0 or q = 0.
However the corresponding results are not true for matrices.
AB = AC does not imply that B = C.
PQ = O does not imply that P = O or Q = O.

Example
 1 2   1 2  3 8 
(1) Consider the matrices A   , B   2 1, and C   3  2.
 2 4     
3 4
Observe that AB  AC    , but B  C.
6 8 
 1  2  2  6
(2) Consider the matrices P    , and Q   .
 2 4 1  3
Observe that PQ  O, but P  O and Q  O.
Powers of Matrices
Definition
If A is a square matrix, then
Ak  
AA
 
A
k times

Theorem
If A is an n  n square matrix, r and s are nonnegative integers,
then
1. ArAs = Ar+s.
2. (Ar)s = Ars.
3. A0 = In (by definition)
Example
 1  2
If A    , compute A 4
.
 1 0
Solution  1  2  1  2  3  2
A 
2
    
  1 0   1 0    1 2 
 3  2  3  2  11  10
A 
4
    .
 1 2   1 2   5 6

Example Simplify the following matrix expression.


A( A  2 B )  3B(2 A  B )  A2  7 B 2  5 AB
Solution
A( A  2 B )  3B(2 A  B )  A2  7 B 2  5 AB
 A2  2 AB  6 BA  3B 2  A2  7 B 2  5 AB
 3 AB  6 BA  4 B 2
Systems of Linear Equations

A system of m linear equations in n variables as follows


a11 x1    a1n xn  b1
   
am1 x1    amn xn  bm
Let
 a11  a1n   x1   b1 
A      , X    , and B    
am1  amn   xn  bm 
     
We can write the system of equations in the matrix form
AX = B
Idempotent and Nilpotent Matrices

Definition
(1) A square matrix A is said to be idempotent if A2=A.
(2) A square matrix A is said to nilpotent if there is a
p
positive integer p such that A =0. The least integer p such that
p
A =0 is called the degree of nilpotency of the matrix.

Example
3  6 2 3  6
(1) A    ,A    A.
 1  2  1  2

3  9 2 0 0
(2) B    ,B  . The degree of nilpotency : 2
 1  3 0 0 
Transpose of a Matrix

Definition
The transpose of a matrix A, denoted At, is the matrix whose
columns are the rows of the given matrix A.
i.e., A : m  n  At : n  m, ( At )ij  A ji i, j.

Example
A   2 7 , B   1 2  7, and C   1 3 4.
 8 0 4 5 6

 1 4   1
At  2  8 C   3.
t
B t
  2 5 
7 0  4
 7 6
Theorem (Properties of Transpose)

Let A and B be matrices and c be a scalar. Assume that the sizes


of the matrices are such that the operations can be performed.
1. (A + B)t = At + Bt Transpose of a sum
2. (cA)t = cAt Transpose of a scalar multiple
3. (AB)t = BtAt Transpose of a product
4. (At)t = A
Proof for (AB)t = BtAt
 b1i 
b 

( AB)t ij  ( AB) ji  a j1 a j 2  a jn   2i 

 
bni 
 a j1b1i  a j 2b2i    a jn bni

( B t At )ij  [row i of B t ] [column j of At ]  [column i of B]t [row j of A]t


 a j1 
a 
 b1i b2i  bni     a j1b1i  a j 2b2i    a jnbni
j2

  
 
 a jn 
Symmetric Matrix
Definition
A symmetric matrix is a matrix that is equal to its transpose.

A  At , i.e., aij  a ji i, j

Example match
1 0 2 4
 0 1  4  0 9
2 5
 1 7 8 7 3
 5  4 2 2  3
 4 8  3  4
3
 9 3 6 match
Example
Let A and B are symmetric matrices of the same size. Prove that
the product AB is symmetric if and only if AB = BA.
Proof
*We have to show (a) AB is symmetric  AB = BA,
and the converse, (b) AB is symmetric  AB = BA.
() Let AB be symmetric, then
AB= (AB)t by definition of symmetric matrix
= BtAt by Thm (3)
= BA since A and B are symmetric
() Let AB = BA, then
(AB)t = (BA)t
= AtBt by Thm (3)
= AB since A and B are symmetric
Example
Let A be a symmetric matrix. Prove that A2 is symmetric.

Proof

( A )  ( AA)  ( A A )  AA  A
2 t t t t 2
Definition
Let A be a square matrix. The trace of A, denoted tr(A) is the sum
of the diagonal elements of A. Thus if A is an n  n matrix.
tr(A) = a11 + a22 + … + ann

Example
4 1  2
Determine the trace of the matrix A  2  5 6.
7 3 0
Solution
We get
tr ( A)  4  (5)  0  1.
Theorem (Properties of Trace)
Let A and B be matrices and c be a scalar. Assume that the sizes
of the matrices are such that the operations can be performed.
1. tr(A + B) = tr(A) + tr(B)
2. tr(AB) = tr(BA)
3. tr(cA) = c tr (A)
4. tr(At) = tr(A)
Proof of (1)
Since the diagonal element of A + B are (a11+b11), (a22+b22), …,
(ann+bnn), we get
tr(A + B) = (a11 + b11) + (a22 + b22) + …+ (ann + bnn)
= (a11 + a22 + … + ann) + (b11 + b22 + … + bnn)
= tr(A) + tr(B).
Example of (2) tr(AB)=tr(BA)
1 3
   3 2  1
A 2 0 , B   
  1 0 1 
 1  2

0 2 2
   8 11 
AB   6 4  2, BA   
  2  5
 1  2  1

tr ( AB)  3  tr ( BA)
The Inverse of a Matrix
Definition
Let A be an n  n matrix. If a matrix B can be found such that
AB = BA = In, then A is said to be invertible and B is called the
inverse of A. If such a matrix B does not exist, then A has no
inverse. (denote B = A1, and Ak=(A1)k )
Example  2 1 
Prove that the matrix A   1 2 has inverse B   3  1 .
3 4  2 2 
Proof
 2 1
AB   1 2  3  1    1 0  I 2
3 4  2 2 0 1
 2 1  1 2  1 0
BA   3  1    I2
 2 23 4 
   0 1

Thus AB = BA = I2, proving that the matrix A has inverse B.
Theorem
The inverse of an invertible matrix is unique.

Proof
Let B and C be inverses of A.
Thus AB = BA = In, and AC = CA = In.
Multiply both sides of the equation AB = In by C.
C(AB) = CIn
(CA)B = C
In B = C
B=C
Thus an invertible matrix has only one inverse.
Gauss-Jordan Elimination for finding
the Inverse of a Matrix
Let A be an n  n matrix.
1. Adjoin the identity n  n matrix In to A to form the matrix
[A : In].
2. Compute the reduced echelon form of [A : In].
If the reduced echelon form is of the type [In : B], then B is
the inverse of A.
If the reduced echelon form is not of the type [In : B], in that
the first n  n submatrix is not In, then A has no inverse.

An n  n matrix A is invertible if and only if its reduced echelon


form is In.
Example
 1  1  2
Determine the inverse of the matrix A   2  3  5
 1 3 5
Solution
 1  1  2 1 0 0  1 1  2 1 0 0
[ A : I 3 ]   2  3  5 0 1 0 R2  (2) R10  1  1  2 1 0
 1 3 5 0 0 1 R3  R1 0 2 3 1 0 1
  1  1  2 1 0 0  1 0 1 3  1 0
( 1)R2 0 1 1 2  1 0 R1  R2 0 1 1 2  1 0
0 2 3 1 0 1 R3  (2) R2 0 0 1  3 2 1
 1 0 0 0 1 0
R1  R3 0 1 0 5  3  1
R2  (1)R3 0 0 1  3 2 1

1
 0 1 1
Thus, A   5  3  1.
 3 2 1
Example
Determine the inverse of the following matrix, if it exist.
 1 1 5
A   1 2 7
2  1 4
Solution
 1 1 5 1 0 0  1 1 5 1 0 0
[ A : I 3 ]   1 2 7 0 1 0 R2  (1)R1 0 1 2  1 1 0
2  1 4 0 0 1 R3  (2)R1 0  3  6  2 0 1
 1 0 3 2  1 0
R1  ( 1)R2 0 1 2  1 1 0
R3  3R2 0 0 0  5 3 1
There is no need to proceed further.
The reduced echelon form cannot have a one in the (3, 3) location.
The reduced echelon form cannot be of the form [In : B].
Thus A–1 does not exist.
Properties of Matrix Inverse
Let A and B be invertible matrices and c a nonzero scalar, Then
1. ( A1 ) 1  A 4. ( An ) 1  ( A1 ) n
1 1 1
2. (cA)  A 5. ( At ) 1  ( A1 ) t
1
c 1 1
3. ( AB)  B A
Proof
1. By definition, AA1=A1A=I.
2. (cA)( 1c A1 )  I  ( 1c A1 )(cA)
3. ( AB)( B 1 A1 )  A( BB 1 ) A1  AA1  I  ( B 1 A1 )( AB)
4. A n ( A 1 ) n  
A
 A 
A 1 1
A
  I  ( A 1 ) n A n
n times n times
5. AA1  I , ( AA1 ) t  ( A1 ) t At  I ,
A1 A  I , ( A1 A) t  At ( A1 ) t  I ,
Example
If A  4 1, then it can be shown that A1   1  1. Use this
 3 1  3 4
information to compute ( At ) 1.
Solution
t
t 1  1 1
1 t
(A )  (A )     1 3
.
3 4 1 4
Theorem
Let AX = Y be a system of n linear equations in n variables.
If A–1 exists, the solution is unique and is given by X = A–1Y.

Proof
(X = A–1Y is a solution.)
Substitute X = A–1Y into the matrix equation.
AX = A(A–1Y) = (AA–1)Y = InY = Y.

(The solution is unique.)


Let X1 be any solution, thus AX1 = Y. Multiplying both sides of
this equation by A–1 gives
A–1AX1= A–1Y
InX1 = A–1Y
X1 = A–1Y.
Example
x1  x2  2 x3  1
Solve the system of equations 2 x1  3x2  5 x3  3
 x1  3x2  5 x3  2
Solution
This system can be written in the following matrix form:
 1  1  2  x1   1
 2  3  5  x2    3
 1 3 5  x3   2
If the matrix of coefficients is invertible, the unique solution is
 x1   1  1  2 1  1
 x2    2  3  5  3
 x   1 3 5  2
 3
This inverse has already been found. We get
 x1   0 1 1  1  1
 x2    5  3  1  3   2
 x   3 2 1  2  1
 3
The unique solution is x1  1, x2  2, x3  1.
Elementary Matrices
Definition
An elementary matrix is one that can be obtained from the
identity matrix In through a single elementary row operation.

Example 1 0 0 
R2  R3 E1  0 0 1
0 1 0
1 0 0 
1 0 0
I 3  0 1 0 5R2
E2  0 5 0
0 0 1
0 0 1

1 0 0 
R2+ 2R1
E3  2 1 0
0 0 1
Elementary Matrices
elementary row operation, elementary matrix。

a b c  1 0 0
R2  R3  g h i   0 0 1  A  E1 A

d e f  0 1 0
a b c
a b c  1 0 0
A  d e f 
5R2
5d 5e 5 f   0 5 0  A  E2 A

 g h i   g h i  0 0 1

 a b c  1 0 0 
d  2a e  2b f  2c   2 1 0  A  E3 A
R2+ 2R1 
 g h i  0 0 1
Notes for elementary matrices
Each elementary matrix is invertible.
Example
I  E1  E1  I , i.e., E2 E1  I
R1 2 R 2 R1 2 R 2

1 0 0  1 2 0  1  2 0
I  0 1 0 E1  0 1 0 E2  0 1 0
0 0 1 0 0 1 0 0 1

If A and B are row equivalent matrices and A is


invertible, then B is invertible.
Proof
If A  …  B, then
B=En … E2 E1 A for some elementary matrices En, … , E2 and E1.
So B1 = (En … E2 E1A)1 =A1E11 E21 … En1.

You might also like