Download 1.3 Matrices and Matrix Operations

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Capelli's identity wikipedia , lookup

Basis (linear algebra) wikipedia , lookup

Quadratic form wikipedia , lookup

Tensor operator wikipedia , lookup

Bra–ket notation wikipedia , lookup

Linear algebra wikipedia , lookup

System of linear equations wikipedia , lookup

Cartesian tensor wikipedia , lookup

Rotation matrix wikipedia , lookup

Eigenvalues and eigenvectors wikipedia , lookup

Symmetry in quantum mechanics wikipedia , lookup

Jordan normal form wikipedia , lookup

Determinant wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Matrix (mathematics) wikipedia , lookup

Four-vector wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Matrix calculus wikipedia , lookup

Matrix multiplication wikipedia , lookup

Transcript
20
CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES
1.3
Matrices and Matrix Operations
1.3.1
De…nitions and Notation
Matrices are yet another mathematical object. Learning about matrices means
learning what they are, how they are represented, the types of operations which
can be performed on them, their properties and …nally their applications.
De…nition 50 (matrix)
1. A matrix is a rectangular array of numbers. in
which not only the value of the number is important but also its position
in the array.
2. The numbers in the array are called the entries of the matrix.
3. The size of the matrix is described by the number of its rows and columns
(always in this order). An m n matrix is a matrix which has m rows
and n columns.
4. The elements (or the entries) of a matrix are generally enclosed in brackets, double-subscripting is used to index the elements. The …rst subscript
always denote the row position, the second denotes the column position.
For example
2
3
a11 a12 ::: a1n
6 a21 a22 ::: a2n 7
6
7
::: ::: ::: 7
A = 6
(1.5)
6 :::
7
4 :::
::: ::: ::: 5
am1 am2 ::: amn
=
[aij ] , i = 1; 2; :::; m, j = 1; 2; :::; n
(1.6)
Enclosing the general element aij in square brackets is another way of
representing a matrix A .
5. When m = n , the matrix is said to be a square matrix.
6. The main diagonal in a square matrix contains the elements a11 ; a22 ; a33 ; :::
7. A matrix is said to be upper triangular if all its entries below the main
diagonal are 0.
8. A matrix is said to be lower triangular if all its entries above the main
diagonal are 0.
9. If all the entries of a square matrix are zero, except those entries on the
main diagonal, then we say the matrix is a diagonal matrix.
10. The n n identity matrix is an n n matrix having ones on the main
diagonal, and zeroes everywhere else. It is usually denoted In .
11. We say that two matrices are equal whenever they have the same dimension, and their corresponding entries are equal.
1.3. MATRICES AND MATRIX OPERATIONS
21
De…nition 51 (row and column vectors) Vectors are special forms of matrices.
1. A row vector is a vector which has only one row. In other words, it is an
1 n matrix.
2. A column vector is a vector which has only one column. In other words,
it is an m 1 matrix.
Example 52 Here are some matrices
2
3
1
2
1. 4 5 2:5 5 is a 3 2 matrix.
0
1
3
2
1 2 3
2. 4 3 p5 9 5 is a square (3 3) matrix.
2 0
3
2
1 0 0
3. 4 0 1 0 5is the 3 3 identity matrix.
0 0 1
3
2
1 3 5 4
6 0 2 6
4 7
7
4. 6
4 0 0 2 1 5 is a 4 4 upper triangular matrix.
0 0 0 5
3
2
1
6 2 7
7
5. 6
4 3 5 is a column vector. It is also a 4 1 matrix.
10
6.
5
0
2
is a row vector. It is also a 1
3 matrix.
In the case of a vector, there is no need to use double subscripts. For example,
instead of writing A = a11 a12 a13 a14 , we write A = a1 a2 a3 a4 .
In the special case that m = n = 1, the matrix is a 1 1 matrix and may be
written A = [a11 ] = [a] = a. In other words, subscripts are not needed. Since
the matrix only has one entry, it is the same as a number (also called a scalar).
1.3.2
Operations on Matrices
For each operation, we give the conditions under which the operation can be
performed. We then explain how the operation is performed. For the remaining
of this section, unless speci…ed otherwise, we assume that
A = [aij ]
B = [bij ]
C = [cij ]
22
CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES
Addition and Subtraction
Only matrices having the same size can be added or subtracted.
The resulting matrix has the same size.
To add (subtract) two matrices having the same size, simply add (subtract) the corresponding entries. In other words, if C = A + B, then
cij = aij + bij . Same for subtraction.
Example 53 Examples of matrix addition/subtraction.
2
3
3
5 5+
1
1
1. 4 2
0
2
1
2. 4 3
5
same
5
4
3
3 2
1
2
4 5 4 2
3
6
dimension.
2
1 =
2
1
2
3
4
6
3
5
6
3
3
1
2 5Cannot be done, the matrices do not have the
3
Scalar Multiplication
This is multiplication of a matrix by a number.
This operation can always be done.
The result is a matrix of the same size.
Simply multiply each entry of the matrix by the number.
Example 54 Examples of multiplication of a matrix by a scalar.
2
1
1. 4 4 2
3
2.
a11
a21
3 2
0
4
1 5=4 8
12
10
a12
a22
=
3
0
4 5
40
a11
a21
a12
a22
Multiplication of a Row Vector by a Column Vector
The row and column vector must have the same number of elements. This
means that if the …rst vector has n entries (that is is a 1 n matrix), then
the second vector must also have n entries (that is must be a n 1 matrix).
The result is a 1
1 matrix or a scalar.
1.3. MATRICES AND MATRIX OPERATIONS
Suppose that A =
a1
a2
AB
:::
an
23
2
3
b1
6 b2 7
7
and B = 6
4 : 5. Then
bn
= a1 b1 + a2 b2 + :::an bn
n
X
=
ai bi
i=1
You will note that the result is a scalar.
Example 55 Examples of multiplication of a row vector by a column vector.
2
3
2
6 1 7
7
1. 1 3 5 7 6
4 5 5 = [1 2 + 3 1 + 5 5 + 7 10] = 100
10
2 3
1
6 2 7
6
. This cannot be done, the vectors do not have the same
2. 1 3 5 4 7
3 5
4
number of elements.
Matrix Multiplication
Let us assume that A is m
p and B is q
n.
The product of A and B, denoted AB can be performed only if p = q.
In other words, the number of columns of the …rst matrix, A must be the
same as the number of rows of the second matrix, B.
In the case p = q, then AB is a new matrix. Its size is m
n.
In summary, if we put next to each other the dimensions of the matrices
we are trying to multiply, in this case m p and q n, then we see that we
can do the multiplication if the inner numbers (p and q) are equal. The
size is given by the outer numbers (m and n).
Matrix multiplication is a little bit more complicated than the other operations. We explain it by showing how each entry of the resulting matrix is
obtained. Let us assume that A = [aij ] is m p and B = [bij ] is p n. Let
C = [cij ] = AB. Then, C is a m n matrix. cij is obtained by multiplying
the ith row of A by the j th column of B. In other words,
cij =
p
X
k=1
aik bkj , i = 1; 2; :::; m, j = 1; 2; :::; n
24
CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES
Remark 56 Because of the condition on the sizes of the matrices, one can see
easily that matrix multiplication will not be commutative. For example, if A is
3 4 and B is 4 5 then one can compute AB. Its size will be 3 5. However,
BA cannot be computed. Even in cases when both AB and BA can be computed,
they are unlikely to be the same. For example
2
32
3 2
3
1 2 3
1 1 1
14 14 14
4 2 3 4 5 4 2 2 2 5 = 4 20 20 20 5
3 4 5
3 3 3
26 26 26
but
2
Example
2
1
1. 4 2
3
2
1
2. 4 3
1
2
1
3. 4 3
1
2
1
4. 4 2
3
2
1
5. 4 2
3
AIn
1.3.3
1
4 2
3
1
2
3
32
1
1
2 54 2
3
3
2
3
4
3 2
3
6
4 5 = 4 12
5
18
3
9 12
18 24 5
27 36
57 Examples of matrix multiplication.
3
3 2
32
14 14 14
1 1 1
2 3
3 4 5 4 2 2 2 5 = 4 20 20 20 5
26 26 26
3 3 3
4 5
3
3
2
32 9
3
1
1 0 0
2 3
4
4
3
2 1 5 4 17
2 5=4 0 1 0 5
4
4
1
7
0 0 1
3 6
1
4
4
3
3 2
32
x + 2y + 3z
x
2 3
2 1 5 4 y 5 = 4 3x + 2y + z 5
x + 3y + 6z
z
3 6
3
2
3 1 1 1
2 3 6
2 2 2 7
7
3 4 56
4 3 3 3 5 cannot be done (why?)
4 5
4 4 4
3
3 2
32
2 3
1 0 0
1 2 3
3 4 5 4 0 1 0 5 = 4 2 3 4 5. In fact if A is m
0 0 1
3 4 5
4 5
=A
n, then
Transpose and trace of a matrix
The operations we have de…ned earlier, have analogous operations with real
numbers. We now de…ne two operations which do not. We will see applications
of these operations later on in the course.
De…nition 58 (Transpose of a Matrix) If A is an m n matrix then the
transpose of A, denoted AT is the n m matrix obtained from A by interchanging the rows and columns of A.
1.3. MATRICES AND MATRIX OPERATIONS
Example 59
2
1
4 4
7
Example 60
2
Example 61
a11
4 a21
a31
3T 2
3
1
6 5 =4 2
9
3
2
5
8
a12
a22
a32
4
5
6
3T 2
a13
a11
a23 5 = 4 a12
a33
a13
2
3T
1
4 3 5 =
5
1
3
25
3
7
8 5
9
a21
a22
a23
3
a31
a32 5
a33
5
We are simply switching the rows and the columns. If A = [aij ] then AT =
[aji ]. Note that in this process, the elements on the main diagonal remain
unchanged.
De…nition 62 (Trace of a Matrix) If A is a square matrix (n n) then the
trace of A, denoted tr (A), is de…ned to be the sum of its entries on the main
diagonal of A. tr (A) is not de…ned if A is not a square matrix.
1
4
Example 63 if A =
2
2
7
a11
Example 64 If A = 4 a21
a31
1.3.4
then tr (A) = 8.
a12
a22
a32
3
a13
a23 5, then tr (A) = a11 + a22 + a33 .
a33
Problems
Do numbers 1 - 5, 12 - 14, 19 - 23, 25 on pages 34-37