Linear Algebra
Linear Algebra
Linear Algebra
Matrix:
A matrix is a rectangular array of numbers. The numbers in the array are
called the entries in the matrix. The size of a matrix is described in terms of
the number of rows (horizontal lines) and columns (vertical lines) it contains.
Examples of matrices:
2 −1
0 3
4 1
is a 3 × 2 matrix.
a b c
d e f
is a 2 × 3 matrix.
Notes:
1. In a size description the first number always denotes the number of rows
1
and the second denotes the number of columns.
2. We usually use capital letters for matrices and lowercase letters for entries.
The entry that occurs in row i and column j of a matrix A will be denoted
by aij . Thus a general 3 × 4 matrix might be written as
a11 a12 a13 a14
a21 a22 a23 a24
a31 a32 a33 a34
Definition 1:
If m and n are positive integers, then an m × n matrix is a rectangular array
of m rows and n columns of the form
a a12 a13 · · · a1n
11
a21 a22 a23 · · ·
a2n
.. .. .. ..
. . . .
am1 am2 am3 · · · amn
A matrix with only one row is called a row matrix. For example
h i
2 1 0 −3
is a 1 × 4 row matrix.
A matrix with only one column is called a column matrix. For example
1
3
is a 2 × 1 column matrix.
A matrix in which number of rows is equal to number of columns is called a
2
square matrix. A n × n square matrix B is of the form
a a12 · · · a1n
11
a22 · · · a2n
a21
B= .. .. ..
. . .
an1 an2 · · · ann
the entries a11 , a22 , · · · , ann are said to be on the main diagonal of B.
Definition 2
Two matrices are said to be equal if they have the same order and their
corresponding elements are equal.
2. If
a 6 2 6
10 d = 10 −1
e 0 3 0
, then a = 2, d = −1, e = 3
3. Consider the matrices
2 1 2 1 2 1 0
A= , B = , C=
3 x 3 5 3 4 0
If x = 5 then A = B but for all other values of x, matrices A and B are not
equal.
3
If two matrices have different dimensions, they cannot be equal.
There is no value of x for which A and C are equal since A and C have
different sizes.
Definition 3
If A = [aij ] and B = [bij ] are m × n matrices, their sum, A + B, is the m × n
matrix obtained by adding the corresponding entries, that is,
3 −2 0 −4 4 5 2 1
A= , B= , C=
6 −1 2 8 0 1 3 4
3 − 4 −2 + 4 0 + 5
A+B =
6 + 8 −1 + 0 2 + 1
−1 2 5
=
14 −1 3
3 − (−4) −2 − 4 0 − 5
A−B =
6−8 −1 − 0 2 − 1
7 −6 −5
−2 −1 1
4
The expressions A + C, B + C, A − C, B − C are not defined due to different
dimensions.
Important results
Result 1
Matrix Addition is commutative.
This means that A + B = B + A, where A, B are 2 matrices of the same order.
If
1 −1 3 0 1 3
A= , B=
4 0 −2 −2 0 4
1+0 −1 + 1 3+3 1 0 6
A+B = =
−2 + 4
4 + (−2) 0+0
2 0 2
0 + 1 1 + (−1) 3 + 3 1 0 6
B+A= =
−2 + 4 0+0 4−2 2 0 2
thus A + B = B + A.
Result 2
Matrix addition is associative i.e., if A, B, C are 3 matrices, then (A+B)+C =
A + (B + C)
Definition 4
If A = [aij ] is any m × n matrix and c is any scalar, then the scalar product
cA is the m × n matrix obtained by multiplying each entry of the matrix A by
c, that is
c[aij ] = [caij ]
5
then
9 −21 6 −3 7 −2
3A = , −A =
−3 0 6 1 0 −2
Definition 5
If A is an m × n matrix and B is an n × p matrix then the product AB is
an m × p matrix.
Single out row i from the matrix A and column j from the matrix B.
Multiply the corresponding entries from the row and column together and then
add up the resulting products.
Example1: Consider the matrices
1 2 3 2
A= , B =
3 4 1 5
then
(1 × 3) + (2 × 1) (1 × 2) + (2 × 5) 5 12
AB = =
(3 × 3) + (4 × 1) (3 × 2) + (4 × 5) 13 26
6
since A is 2 × 3 and B is 3 × 4, the product C = AB is defined and is an 2 × 4
matrix. We compute the eight entries as follows:
7
Transpose of a matrix, Trace of a matrix,
Diagonal, Triangular, Symmetric matrices
Transpose of a matrix
The transpose of a matrix A, denoted by AT , is obtained by interchanging its
rows and columns e.g the first column of AT is the first row of A, the second
column of AT is the second row of A, and so far.
If A is m × n matrix,the transpose of A is n × m matrix.
Examples
If
2 −1 3 h i 2 5
A= , B= 1 3 5 ,C =
0 5 2 −3 7
Then
2 0 1
T
2 −3
A = −1 5 , BT = 3 , C T =
5 7
3 2 5
Trace of a matrix
If A is a square matrix, then the trace of A, is defined to be the sum of
elements on the main diagonal. It is denoted by tr(A) and is undefined if A is
not a squire matrix.
Examples
1. If
−2 2 3
A = −1 1 3
2 0 −1
8
2. Consider the matrix
−1 2 7 0
5 −8 4
3
B=
7 −3
1 2
4 −2 1 0
9
( 12 )−k 0 0
−k
A = ( 13 )−k
0 0
0 0 ( 14 )−k
which can written as
k
2 0 0
−k k
A = 0 3 0
k
0 0 4
1
0 0
4
2 1
A = 0 9 0
1
0 0 16
4 0 0
A−2 = 0 9 0
0 0 16
10
Triangular matrices
A triangular matrix is a special kind of square matrix where the entries either
below or above the main diagonal are zero.
Lower triangular matrix
A square matrix in which all the entries above main diagonal are zero is called
lower triangular matrix.
Upper triangular matrix
A square matrix in which all the entries below main diagonal are zero is called
upper triangular matrix.
Examples
1. The 3 × 3 matrix
1 0 0
A= 5 2 0
3 9 5
11
4. The 4 × 4 matrix
1 5 2 −9
0 2 8 10
D=
0 0 5 20
0 0 0 1
12
Symmetric matrices
A square matrix A is called symmetric if A = AT .
Examples
1. The matrix
1 2 3
A = 2 −4 7
3 7 6
is symmetric as
1 2 3
AT = 2 −4 7 =A
3 7 6
13
Solution: First we will calculate the transpose of matrix A
2 3 0
AT = a − 2b + 2c −2
5
2a + b + c a + c 7
14
Row-Echelon Form
Pivot
Row-Echelon Form
1. All rows that contain only zeros are grouped at the bottom of the
matrix.
2. For each row that does not contain only zeros, the pivot appears
strictly to the right of the pivot of each row that appears above it.
15
Notes
1. In some books, they require that the pivot of each non-zero row is
one and call it as leading one.
Step 2: Interchange the top row with another row, if necessary, to bring a
nonzero entry to the top of column found in step 1.
Step 3: If the entry that is now at the top of the column found in pre-
vious Step is a, multiply the first row by 1/a in order to introduce a leading
one.
Step 4: Add suitable multiples of the top row to the rows below so
that all entries below the leading 1 become zero.
Step 5: Now cover the top row in the matrix and begin again with
Step 1 applied to the submatrix that remains. Continue in this way until the
entire matrix is in row-echelon form.
16
All matrices of the following types are in row-echelon form:
1 ∗ ∗ ∗ 1 ∗ ∗ ∗
0 1 ∗ ∗ 0 1 ∗ ∗
,
0 0 1 ∗ ∗
0 0 1
0 0 0 1 0 0 0 0
0 1 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
1 ∗ ∗ ∗
0 0 0 1 ∗ ∗ ∗ ∗ ∗ ∗
0 1 ∗ ∗
,
0 0 0 0 1 ∗ ∗ ∗ ∗ ∗
0 0 0 0
0 0 1 ∗ ∗ ∗ ∗
0 0 0
0 0 0 0
0 0 0 0 0 0 0 0 1 ∗
3R1 + R2 −→ R2 , −2R1 + R3 −→ R3
2 −1 −1 3
0 3 2 6
0 6 9 −3
−2R2 + R3 −→ R3
2 −1 −1 3
0 3 2 6
0 0 5 −15
The leading entries of the other rows move from left to right as we move down
the rows and each column consist of zeros below leading coefficients. Thus the
matrix is now in row echelon form.
17
We can make pivot as 1 If we let 12 R1 −→ R1 , 1/3R2 −→ R2 , 1/5R3 −→ R3
and we obtain
1 −1/2 −1/2 3/2
0 1 2/3 2
0 0 1 −3
6R1 + R2 −→ R2 , −4R1 + R3 −→ R3
1 −1/2 −1/2 3/2
0 3 2 6
0 6 9 −3
1
R
3 2
−→ R2
1 −1/2 −1/2 3/2
0 1 2/3 2
0 6 9 −3
−6R2 + R3 −→ R3
1 −1/2 −1/2 3/2
0 1 2/3 2
0 0 5 −15
18
1
R
5 3
−→ R3
1 −1/2 −1/2 3/2
0 1 2/3 2
0 0 1 −3
R1 + R2 −→ R2 , 2R1 + R3 −→ R3
1 4 5 −9 −7
4 −6 −6
0 2
0 5 10 −15 −15
0 −3 −6 4 9
1
R
2 2
−→ R2
1 4 5 −9 −7
2 −3 −3
0 1
0 5 10 −15 −15
0 −3 −6 4 9
5R2 + R3 −→ R3 , 3R2 + R4 −→ R4
1 4 5 −9 −7
0 1 2 −3 −3
0 0 0 0 0
0 0 0 −5 0
19
R3 R4
1 4 5 −9 −7
1 2 −3 −3
0
0 0 −5 0
0
0 0 0 0 0
− 15 R3 −→ R3
1 4 5 −9 −7
2 −3 −3
0 1
0 0 0 1 0
0 0 0 0 0
20
−2R2 + R3 −→ R3
1 1/2 −1/2 4
0 1 1 2
0 0 −1 1
−R3 −→ R3
1 1/2 −1/2 4
0 1 1 2
0 0 1 1
1/2R1 −→ R1
1 1/2 −1/2 4
−4 −2 −11
2
−3
4 4 6
−2 −3 2 −3
21
We interchange second and third rows. R2 R3
1 1/2 −1/2 4
−1 −10
0 2
0 0 0 5
0 −2 1 5
1
R
2 2
−→ R2
1 1/2 −1/2 4
0 1 −1/2 −5
0 0 0 5
0 −2 1 5
2R2 + R4 −→ R4
1 1/2 −1/2 4
0 1 −1/2 −5
0 0 0 5
0 0 0 −5
1
R
5 3
−→ R3
1 1/2 −1/2 4
0 1 −1/2 −5
0 0 0 1
0 0 0 −5
5R3 + R4 −→ R4
1 1/2 −1/2 4
0 1 −1/2 −5
0 0 0 1
0 0 0 0
Now the empty row is on the bottom and the leading entries of the other rows
move from left to right as we move down the rows and each column consist of
zeros below leading ones. Thus the matrix is now in row echelon form.
22
Reduced Row-Echelon Form
1. All rows that contain only zeros are grouped at the bottom of the
matrix.
2. For each row that does not contain only zeros, then first nonzero
number in the row is a 1. We call this as leading 1.
3. For each row that does not contain only zeros, the leading 1 of any
row is to the right of the leading one of the previous row.
Notes 1. The leading one of a row does not have to be to the imme-
diate right of the leading one of the previous row.
23
Example 1 The following matrices are in reduced row echelon form.
0 1 −2 0 1
1 0 0 4 1 0 0
0 0 0 1 3
0 1 0 7 , 0 1 0 ,
0 0 0 0 0
0 0 1 −1 0 0 1
0 0 0 0 0
Step 2: Interchange the top row with another row, if necessary, to bring a
nonzero entry to the top of column found in step 1.
Step 3: If the entry that is now at the top of the column found in pre-
vious Step is a, multiply the first row by 1/a in order to introduce a leading
one.
Step 4: Add suitable multiples of the top row to the rows below so
that all entries below the leading 1 become zero.
Step 5: Repeat Steps 1-4 for submatrix obtained by ignoring the top
row. Continue in this way until the entire matrix is in reduced row echelon
form.
Most important, each time you return to Step 1, ignore the rows already
taken care of.
24
All matrices of the following types are in reduced row-echelon form:
1 0 0 0 1 0 0 ∗
0 0 1 0 ∗
0 1 0
,
0 0 0 1 ∗
0 0 1
0 0 0 1 0 0 0 0
0 1 ∗ 0 0 0 ∗ ∗ 0 ∗
1 0 ∗ ∗
0 0 0 1 0 0 ∗ ∗ 0 ∗
∗ ∗
0 1
,
0 0 0 0 1 0 ∗ ∗ 0 ∗
0 0 0 0
0 0 1 ∗ ∗ 0 ∗
0 0 0
0 0 0 0
0 0 0 0 0 0 0 0 1 ∗
Solution:
Step 1: First column is the leftmost nonzero column.
Step 2: Interchange the first row with the third or fourth row to bring a nonzero
entry to the top of column found in step 1. R1 R3 (We can also R1 R4 ,
try in this way also!)
2 2 −5 2 4
0 0 2 3 4
2 3 −4 1
0
2 0 −6 9 7
25
Step 3: To introduce leading one in first column, letting 12 R1 −→ R1 , we have
1 1 −5/2 1 2
0 0 2 3 4
−4 1
0 2 3
2 0 −6 9 7
Step 4: Make all other entries in the first column zero by adding suitable
multiples of the first row to the other rows.
−2R1 + R4 −→ R4
1 1 −5/2 1 2
0 0 2 3 4
−4 1
0 2 3
0 −2 −1 7 3
Step 5: Repeat Steps 1-4 until the entire matrix is in reduced row echelon
form.
R2 R3 (We can also R2 R4 , try in this way also!)
1 1 −5/2 1 2
−4 1
0 2 3
0 0 2 3 4
0 −2 −1 7 3
1
R
2 2
−→ R2
1 1 −5/2 1 2
3/2 −2 1/2
0 1
0 0 2 3 4
0 −2 −1 7 3
26
−R2 + R1 −→ R1 , 2R2 + R4 −→ R4
1 0 −4 3 3/2
1 3/2 −2 1/2
0
0 0 2 3 4
0 0 2 3 4
1
R
2 3
−→ R3
1 0 −4 3 3/2
0 1 3/2 −2 1/2
0 0 1 3/2 2
0 0 2 3 4
− 23 R3 + R2 −→ R2 , 4R3 + R1 −→ R1 , −2R3 + R4 −→ R4
1 0 0 9 19/2
0 1 0 −17/4 −5/2
0 0 1 3/2 2
0 0 0 0 0
Now the empty row is on the bottom and the leading ones of the other rows
move from left to right as we move down the rows and each column consist of
zeros below and above leading ones. Thus the matrix is now in reduced row
echelon form.
Example 3 : Write the following matrix in reduced row-echelon form
2 −1 −1 3
−6 6 5 −3
4 4 7 3
1
R
2 1
−→ R1
1 −1/2 −1/2 3/2
−6 −3
6 5
4 4 7 3
27
6R1 + R2 −→ R2 , −4R1 + R3 −→ R3
1 −1/2 −1/2 3/2
0 3 2 6
0 6 9 −3
1
R
3 2
−→ R2
1 −1/2 −1/2 3/2
0 1 2/3 2
0 6 9 −3
1/2R2 + R1 −→ R1 , −6R2 + R3 −→ R3
1 0 −1/6 5/2
0 1 2/3 2
0 0 5 −15
1
R
5 3
−→ R3
1 0 −1/2 3/2
0 1 2/3 2
0 0 1 −3
−2/3R3 + R2 −→ R2 , 1/2R3 + R1 −→ R1
1 0 0 0
0 1 0 4
0 0 1 −3
which is reduced row-echelon form of given matrix.
2 7 −3 8 3
0 −3 7 5 1
A= 0 0
6 7 6
0 0 0 9 8
0 0 0 0 4
28