1 of 83

Chapter 2�Matrices and Linear Transformations

大葉大學 資訊工程系

黃鈴玲

Linear Algebra

2 of 83

2.1 Addition, Scalar Multiplication, and Multiplication of Matrices

Ch2_2

  • aij: the element of matrix A in row i and column j.

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)

3 of 83

Addition of Matrices

Ch2_3

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.

4 of 83

Example

Ch2_4

Determine A + B and A + C, if the sum exist.

Solution (自行練習)

(2) A and C are not of the same size, A + C does not exist.

5 of 83

Scalar Multiplication of matrices

Ch2_5

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.

Example

Observe that A and 3A are both 2 × 3 matrices.

6 of 83

Negation and Subtraction

Ch2_6

Definition

The matrix (1)C is written –C and is called the negative of C.

Example

We now define subtraction in terms of addition and scalar multiplication. Let

AB = A + (–1)B

Example

7 of 83

Matrix Multiplication

Ch2_7

Examples

8 of 83

Example 1

Ch2_8

無法相乘�∴AB does not exist.

Sol.

Note. In general, ABBA. 如此題之BA存在

9 of 83

Ch2_9

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.

If the number of columns in A does not equal the number of row B, �we say that the product does not exist.

Let A: m×n matrix, B: n×k matrix,

The product matrix C=AB has elements

C is a m×k matrix.

10 of 83

Example 2

Ch2_10

Sol.

Note. In general, ABBA.

BA does not exist.

Example 3

Let C = AB,

Determine c23.

隨堂作業:11(d)

隨堂作業:5(f)

11 of 83

Size of a Product Matrix

Ch2_11

If A is an m × r matrix and B is an r × n matrix, then AB will be an m × n matrix.

A

m × r

B

r × n

= AB

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.

隨堂作業:8(f)

12 of 83

Ch2_12

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.

Special Matrices

13 of 83

Theorem 2.1

Ch2_13

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 4

14 of 83

Ch2_14

(a) A: m×n, B: n×r� Let the columns of B be the matrices B1, B2, …, Br. � Write B=[B1 B2Br]. � Thus AB=A[B1 B2Br]=[AB1 AB2ABr].

Matrix multiplication in terms of columns

Example

and

15 of 83

Ch2_15

(b) � A: m×n, B: n×1, where A=[A1 A2An] and .� �� We get .

Matrix multiplication in terms of columns

Example

16 of 83

Ch2_16

Partitioning of Matrices

A matrix can be subdivided into a number of submatrices.

Example

where

Example

17 of 83

Ch2_17

Example 5

Let

隨堂作業:21(a)

Consider the following partition of A.

Under this partition A is interpreted as a 2×2 matrix. For the product AB�to be exist, B must be partitioned into a matrix having two rows.

Let

18 of 83

Homework

  • Exercise 2.1:�5, 8, 11, 17, 21

Ch2_18

Exercise 17

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

19 of 83

2.2 Algebraic Properties of Matrix Operations

Ch2_19

Theorem 2.2 -1

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)

20 of 83

Ch2_20

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.

Theorem 2.2 -2

21 of 83

Ch2_21

Example 1

Proof of Thm 2.2 (A+B=B+A)

Consider the (i,j)th elements of matrices A+B and B+A:

A+B=B+A

22 of 83

Example 2

Ch2_22

Compute ABC.

Sol.

A B C = D�2×2 2×3 3×1 2×1

ABC = (AB)C = A(BC)

23 of 83

Ch2_23

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.

Caution

Example

24 of 83

Powers of Matrices

Ch2_24

Theorem 2.3

If A is an n × n square matrix and r and s are nonnegative integers, then

1. ArAs = Ar+s.

2. (Ar)s = Ars.

3. A0 = In (by definition)

Definition

If A is a square matrix, then

25 of 83

Example 3

Ch2_25

Solution

注意這兩項不能合併!

Example 4

Simplify the following matrix expression.

Solution

26 of 83

Systems of Linear Equations

Ch2_26

A system of m linear equations in n variables as follows

Let

We can write the system of equations in the matrix form

AX = B

隨堂作業:32(c)

27 of 83

Solutions to Systems of Linear Equations

Ch2_27

Consider a homogeneous system of linear equations AX=0. �Let X1 and X2 be solutions. Then� AX1=0 and AX2=0

A(X1 + X2) = AX1 + AX2 = 0 ⇒ X1 + X2 is also a solution

Note. �The set of solutions to a homogeneous system of linear equations�is closed under addition and under scalar multiplication. It is a subspace.

If c is a scalar,�⇒ A(cX1) = cAX1 = 0 ⇒ cX1 is also a solution

28 of 83

Example 5

Ch2_28

Consider the following homogeneous system of linear equations.

It can be shown that there are many solutions,� x1=2r, x2=3r, x3 = r.

The solutions are vectors in R3 of the form (2r, 3r, r) or r(2, 3, 1). The solutions form a subspace of R3 of dimension 1.

Figure 2.4

Note. x1=0, , xn = 0, is a solution to every homogeneous system.�⇒ The set of solutions to every homogeneous system passes through the origin.

隨堂作業:36(a)

29 of 83

Solutions to Nonhomogeneous systems

Ch2_29

Let AX=Y be a nonhomogeneous system of linear equations, so Y≠0. �Let X1 and X2 be two solutions. Then� AX1=Y and AX2=Y

A(X1 + X2) = AX1 + AX2 = 2Y X1 + X2 is not a solution.

(可省略) If c is a scalar,�⇒ A(cX1) = cAX1 = cY cX1 is not a solution.

Exercise 41

Show that a set of solutions to a system of nonhomogeneous linear equations is not closed under addition or under scalar multiplication, and that it is thus not a subspace of Rn.

Proof

⇒The set of solutions is not a subspace of Rn.

30 of 83

Example

Ch2_30

Consider the following nonhomogeneous system of linear equations.

The general solution of this system is (2r+4, 3r+2, r).

(2r+4, 3r+2, r) = r(2, 3, 1)+(4, 2, 0)

Note that r(2, 3, 1) is the general solution of the corresponding homogeneous system. The vector (4, 2, 0) is the specific solution to the nonhomogeneous system corresponding to r=0.

Figure 2.5

隨堂作業:40

31 of 83

Idempotent and Nilpotent Matrices�(Exercise 24~30)

Ch2_31

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 � positive integer p such that Ap=0. The least integer p such that �Ap=0 is called the degree of nilpotency of the matrix.

Example

隨堂作業:28, 29(b)

32 of 83

Homework

  • Exercise 2.2:�6, 13, 21, 25, 27, 28, 29, 32, 36, 40, 41

Ch2_32

Exercise 21

A, B: diagonal matrix of the same size, c: scalar �Prove that A+B and cA are diagonal matrices.

33 of 83

Homework

Ch2_33

Exercise 25

Determine b, c, and d such that is idempotent.

Exercise 27

Prove that if A and B are idempotent and AB=BA, then AB is idempotent.

34 of 83

2.3 Symmetric Matrices

Ch2_34

Definition

The transpose (轉置) of a matrix A, denoted At, is the matrix whose columns are the rows of the given matrix A.

Example 1

35 of 83

Theorem 2.4 Properties of Transpose

Ch2_35

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

36 of 83

Theorem 2.4 Properties of Transpose

Ch2_36

Proof for 3. (AB)t = BtAt

37 of 83

Symmetric Matrix

Ch2_37

match

match

Definition

A symmetric matrix is a matrix that is equal to its transpose.

Example

隨堂作業:2(c)

38 of 83

Example 3

Ch2_38

Let C = aA+bB, where a and b are scalars.

Ct = (aA+bB)t

= (aA)t + (bB)t by Thm 2.4 (1)

= aAt + bBt by Thm 2.4 (2)

= aA + bB since A and B are symmetric

= C

Thus C is symmetric.

Proof

Let A and B be symmetric matrices of the same size. Let C be a linear combination of A and B. Prove that the product C is symmetric.

39 of 83

If and only if

  • Let p and q be statements.�Suppose that p implies q (if p then q), written pq,�and that also q p, we say that��“p if and only if q” � (若且唯若)� (通常簡寫為 iff )� (也說成: p is necessary and sufficient for q )

Ch2_39

40 of 83

Example 4

Ch2_40

*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 2.4 (3)

= BA since A and B are symmetric

() Let AB = BA, then

(AB)t = (BA)t

= AtBt by Thm 2.4 (3)

= AB since A and B are symmetric

Proof

Let A and B be symmetric matrices of the same size. Prove that the product AB is symmetric if and only if AB = BA.

41 of 83

Example 3 相關題目

Ch2_41

Proof

Let A be a symmetric matrix. Prove that A2 is symmetric.

42 of 83

Ch2_42

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 5

Determine the trace of the matrix

Solution

We get

隨堂作業:15(b)

Trace of a matrix

43 of 83

Theorem 2.5 Properties of Trace

Ch2_43

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)

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).

Proof of (1)

44 of 83

Example of (2) tr(AB)=tr(BA)

Ch2_44

45 of 83

Matrices with Complex Elements

Ch2_45

The element of a matrix may be complex numbers. A complex number is of the form

z = a + bi

Where a and b are real numbers and �a is called the real part and b the imaginary part (虛部) of z.

The conjugate (共軛複數) of a complex number z = a + bi is�defined and written z = a bi.

46 of 83

Example 7

Ch2_46

Compute A + B, 2A, and AB.

Solution

47 of 83

Ch2_47

Definition

(i) The conjugate of a matrix A is denoted A and is obtained by � taking the conjugate of each element of the matrix.

(ii) The conjugate transpose of A is written and defined by A*=A t.

(iii) A square matrix C is said to be hermitian if C=C*.

Example (i), (ii)

Example (iii)

隨堂作業:23

48 of 83

Homework

  • Exercise 2.3:�2, 5, 11, 15, 23

Ch2_48

Exercise 11

A matrix A is said to be antisymmetric if A = At. �(a) give an example of an antisymmetric matrix.�(b) Prove that an antisymmetric matrix is a square matrix having � diagonal elements zero.�(c) Prove that the sum of two antisymmetric matrices of the same � size is an antisymmetric matrix.

49 of 83

2.4 The Inverse of a Matrix

Ch2_49

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 = A1, and Ak=(A1)k )

Example 1

Prove that the matrix has inverse

Proof

Thus AB = BA = I2, proving that the matrix A has inverse B.

50 of 83

Theorem 2.7

Ch2_50

If a matrix has an inverse, that inverse 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

InB = C

B = C

Thus an invertible matrix has only one inverse.

Thm2.2 乘法結合律

51 of 83

Let A be an invertible n×n matrix�How to find A-1?

Ch2_51

We shall find A1 by finding X1, X2, …, Xn.

Since AA1 =In, then

Solve these systems by using Gauss-Jordan elimination:

Note. 若是最後沒有變成 [In:B] 的形式,則 A1不存在。

52 of 83

Gauss-Jordan Elimination for finding the Inverse of a Matrix

Ch2_52

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.

53 of 83

Example 2

Ch2_53

Determine the inverse of the matrix

Solution

隨堂作業:4(a), 14

1

54 of 83

Example 3

Ch2_54

Determine the inverse of the following matrix, if it exist.

Solution

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.

隨堂作業:4(c)

55 of 83

Properties of Matrix Inverse

Ch2_55

Let A and B be invertible matrices and c a nonzero scalar, Then

Proof

1. By definition, AA1=A1A=I.

56 of 83

Ch2_56

Example 4

Solution

隨堂作業:15,19

57 of 83

Theorem 2.8

Ch2_57

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–1YInX1 = A–1YX1 = A–1Y.

58 of 83

Example 5

Ch2_58

Solve the system of equations

Solution

This system can be written in the following matrix form:

If the matrix of coefficients is invertible, the unique solution is

This inverse has already been found in Example 2. We get

59 of 83

Elementary Matrices

Ch2_59

Definition

An elementary matrix is one that can be obtained from the identity matrix In through a single elementary row operation.

Example

R2 ↔ R3

5R2

R2+ 2R1

60 of 83

Elementary Matrices

Ch2_60

R2 ↔ R3

5R2

R2+ 2R1

一個矩陣做 elementary row operation,�相當於在左邊乘一個對應的 elementary matrix。

61 of 83

Notes for elementary matrices

  • Each elementary matrix is square and invertible.

Ch2_61

Example

  • If A and B are row equivalent matrices and A is invertible, then B is invertible.

Proof

If A ≈ … ≈ B, then

B=EnE2 E1 A for some elementary matrices En, … , E2 and E1.

So B1 = (EnE2 E1A)1 =A1E11 E21En1.

62 of 83

Homework

  • Exercise 2.4:�4, 7, 14, 15, 19, 21, 28

Ch2_62

(後面的 section 2.5~2.7 都跳過)

Exercise 7

If , show that

(求2×2之反矩陣,此公式較快)

63 of 83

Homework

Ch2_63

Exercise 21

Prove that (AtBt)1 = (A1B1)t.

Exercise 28

True or False:�(a) If A is invertible A1 is invertible.�(b) If A is invertible A2 is invertible.�(c) If A has a zero on the main diagonal it is not invertible.�(d) If A is not invertible then AB is not invertible.�(e) A1 is row equivalent to In.

64 of 83

2.5 Matrix Transformations, Rotations, and Dilations

Ch2_64

A function, or transformation, is a rule that assigns to each element of a set a unique element of another set.

We will be especially interested in linear transformations, which are transformations that preserve the mathematical structure of a vector space.

Consider the function f(x) =3x2+4.

domain (定義域) of the function: the set of all possible x

f(2)=16, we say that the image of 2 is 16.

Extend these ideas to functions between vector spaces

We usually use the term transformation rather than function in linear algebra.

65 of 83

Ch2_65

Consider the transformation T maps R3 into R2 defined by

T(x, y, z) = (2x, yz)

The domain of T is R3 and we say the codomain (對應域) is R2.

T(1, 4, 2) = (2, 6) ⇒ The image of (1, 4, 2) is (2, 6).

Convenient representations:

, and the image of

66 of 83

Ch2_66

Definition

A transformation T of Rn into Rm is a rule that assigns to each vector u in Rn a unique vector v in Rm. Rn is called the domain of T and Rm is the codomain. We write T(u) = v; v is the image of u under T. The term mapping is also used for a transformation.

67 of 83

Dilation(擴張) and Contraction(收縮)

Ch2_67

Consider the transformation , where r > 0.

Figure 2.11

This equation can be written as the following useful matrix form.

68 of 83

Reflection(反射)

Ch2_68

Consider the transformation . T is called a reflection.

This equation can be written as the following useful matrix form.

Figure 2.12

69 of 83

Matrix transformations

Every matrix defines a transformation. Let A be a matrix and x be a column vector such that Ax exists. Then A defines the matrix transformation T(x) = Ax.

For example, defines ��

and

Ch2_69

Figure 2.14 Matrix transformations.

, written as

, written as

隨堂作業:1

70 of 83

Definition

Ch2_70

Let A be an m×n matrix. Let x be an element of Rn written in a column matrix form. A defines a matrix transformation T(x)=Ax of Rn into Rm. The vector Ax is the image of x. The domain of the transformation is Rn and codomain is Rm.

We write T: Rn Rm if T maps Rn into Rm.

Geometrical Properties:�Matrix transformations maps line segments (線段) into line segments (or points). If the matrix is invertible (可逆) the transformation also maps parallel lines into parallel lines.

71 of 83

Example 1

Ch2_71

Consider the transformation T: R2 R2 defined by the matrix� � . Determine the image of the unit square under this ��transformation.

Sol.

The unit square is the square whose vertices are the points

Since

72 of 83

Ch2_72

The images are:

Figure 2.15

The square PQRO is mapped into the parallelogram P’Q’R’O.

73 of 83

Composition(合成) of Transformations

Ch2_73

Figure 2.16

Consider the matrix transformations T1(x)=A1x and T2(x)=A2x. �The composite transformation T=T2 ° T1 is given by� T(x) = T2(T1(x)) = T2 (A1x) =A2A1x

Thus T is defined by the matrix product A2A1.� T(x) = A2A1x

隨堂作業:10(a)

74 of 83

Homework

  • Exercise 2.5:�1, 10

Ch2_74

75 of 83

2.6 Linear Transformations

A vector space has two operations: addition and scalar multiplication.

Consider the matrix transformation T(u)=Au.

T(u+v) = A(u+v) = Au+Av = T(u)+T(v)

DefinitionLet u and v be vectors in Rn and let c be a scalar. A transformation �T: RnRm is said to be a linear transformation if �T(u + v) = T(u) + T(v) and T(cu) = cT(u).

u

T

T(u)

T(v)

v

u+v

T(u+v) = T(u)+T(v)

u

cu

T

T(cu) = cT(u)

T(u)

T(cu) = A(cu) = cAu = cT(u)

Ch2_75

76 of 83

Example 1

Prove that the following transformation T: R2R2 is linear.

T(x, y) = (x y, 3x)

Solution

“+”: Let (x1, y1) and (x2, y2) ∈ R2. Then

T((x1, y1) + (x2, y2)) = T(x1 + x2, y1 + y2)

= (x1 + x2 y1 y2, 3x1 + 3x2)

= (x1 y1, 3x1) + (x2 y2, 3x2)

= T(x1, y1) + T(x2, y2)

“×”: Let c be a scalar.

T(c(x1, y1)) = T(cx1, cy1) = (cx1 cy1, 3cx1)

= c(x1 y1, 3x1) � = cT(x1, y1)

Thus T is linear.

Note A linear transformation T: UU is called a linear operator.

Ch2_76

隨堂作業:1

77 of 83

Example 2

Show that the following transformation T: R3R2 is not linear.

T(x, y, z) = (xy, z)

Solution

“+”: Let (x1, y1, z1) and (x2, y2, z2) ∈ R3. Then

T((x1, y1, z1) + (x2, y2, z2))� = T(x1 + x2 , y1 + y2 , z1 + z2)� = ((x1 + x2)(y1 + y2), z1 + z2)

T is not linear.

and T(x1, y1, z1) + T(x2, y2, z2) = (x1y1, z1) + (x2y2, z2)

Thus, in general� T((x1, y1, z1) + (x2, y2, z2)) ≠ T(x1, y1, z1) + T(x2, y2, z2).

Ch2_77

隨堂作業:4(b)

78 of 83

Example 3

Determine a matrix A that describes the linear transformation

Solution

It can be shown that T is linear. The domain of T is R2.

We find the effect of T on the standard basis of R2.

and

T can be written as

Why? See the next page.

Ch2_78

79 of 83

Matrix Representation

Let T: Rn Rm be a linear transformation. {e1, e2, …, en} be the standard basis of Rn, and u be an arbitrary vector in Rn.

Express u in terms of the basis, u = a1e1+a2e2+ … + anen.

Since T is a linear transformation,

T(u) = T(a1e1+ a2e2 + … + anen) = T(a1e1) + T(a2e2) + …+ T(anen)� = a1T(e1) + a2T(e2) + …+ anT(en)�

Ch2_79

80 of 83

Thus the linear transformation T is defined by the matrix

A = [ T(e1) … T(en) ].

A is called the standard matrix of T.

Ch2_80

81 of 83

Example 4

The transformation defines a reflection in the line y = x.�It can be shown that T is linear. Determine the standard matrix of this transformation. Find the image of .

Solution

We find the effect of T on the standard basis.

and

T can be written as

Ch2_81

82 of 83

Ch2_82

Figure 2.22

隨堂作業:12

83 of 83

Homework

  • Exercise 2.6:�1, 4, 12

Ch2_83

(2.7~2.9節跳過)