Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Basic Linear Algebra(基本線性代數)

Similar presentations


Presentation on theme: "Chapter 2 Basic Linear Algebra(基本線性代數)"— Presentation transcript:

1 Chapter 2 Basic Linear Algebra(基本線性代數)

2 2.1 Matrices(矩陣) & Vectors(向量)
p.11 2.1 Matrices(矩陣) & Vectors(向量) A matrix(矩陣)is any rectangular array of numbers If a matrix A has m rows and n columns it is referred to as an m x n matrix. m x n is the order(階) of the matrix. It is typically written as

3 The number in the ith row and jth column of A is called the ijth element of A and is written aij.
Two matrices A = [aij] and B = [bij] are equal if and only if A and B are the same order and for all i and j, aij = bij. A = B if and only if x = 1, y = 2, w = 3, and z = 4

4 Any matrix with only one column is a column vector(行向量) or column matrix (行矩陣) . The number of rows in a column vector is the dimension of the column vector. C= Rm will denote the set all m-dimensional column vectors Any matrix with only one row (a 1 x n matrix) is a row vector (列向量) or row matrix (列矩陣). The dimension of a row vector is the number of columns. R=(1 2 3)

5 Any m-dimensional vector (either row or column) in which all the elements equal zero is called a zero vector (零向量) or zero matrix (零矩陣) (written 0). Any m-dimensional vector corresponds to a directed line segment in the m-dimensional plane. For example, the two-dimensional vector u corresponds to the line segment joining the point (0,0) to the point (1,2)

6 Other Forms Diagonal matrix (對角線矩陣) Identity matrix (單位矩陣)
Upper triangular matrix(上三角矩陣) Lower triangular matrix (下三角矩陣)

7 Example :

8 Transpose Matrix (轉置矩陣)

9 Example :

10 轉置矩陣之性質

11 Square Matrix of Order n(方陣之乘冪)
令A=[aij]nxn, 則矩陣A的乘命冪(非負)定義為A0=In, A1=A, 且對K≥2, AK=(AK-1)(A) 若A為一方陣,且若r 與s 均為非負整數,則 (1) Ar|s=(Ar)(As) (2) (Ar)s=Ars=(As)r

12 Example : (AB)2≠A2B2 (AB = BA)
? Example : (AB)2≠A2B2 (AB = BA)

13 Symmetric Matrix (對稱矩陣) & Skew-symmetric Matrix (斜對稱矩陣)

14 Example : is a symmetric matrix is a skew-symmetric matrix

15 對稱矩陣與斜對稱矩陣之性質

16 Matrix Operations (矩陣之基本運算)
The scalar product(純量積) is the result of multiplying two vectors where one vector is a column vector and the other is a row vector. For the scalar product to be defined, the dimensions of both vectors must be the same. The scalar product of u and v is written:

17 p.14 The Scalar Multiple of a Matrix Given any matrix A and any number c, the matrix cA is obtained from the matrix A by multiplying each element of A by c. Addition of Two Matrices Let A = [aij] and B =[bij] be two matrixes with the same order. Then the matrix C = A + B is defined to be the m x n matrix whose ijth element is aij + bij. Thus, to obtain the sum of two matrixes A and B, we add the corresponding elements of A and B.

18 矩陣相加

19 This rule for matrix addition may be used to add vectors of the same dimension.
Vectors may be added using the parallelogram law or by using matrix addition. X1 X2 u v u+v 1 2 3 (1,2) (2,1) (3,3)

20 Line segments can be defined using scalar multiplication and the addition of matrices.
If u=(1,2) and v=(2,1), the line segment joining u and v (called uv) is the set of all points in the m-dimensional plane corresponding to the vectors cu +(1-c)v, where 0 ≤ c ≤ 1. X1 X2 u v 1 2 c=1 c=1/2 c=0

21 矩陣加法之性質

22 常數乘以矩陣之性質

23 p.16 Matrix Multiplication (矩陣相乘) Given to matrices A and B, the matrix product of A and B (written AB) is defined if and only if the number of columns in A = the number of rows in B. The matrix product C = AB of A and B is the m x n matrix C whose ijth element is determined as follows: ijth element of C = scalar product of row i of A x column j of B

24 矩陣相乘

25

26 矩陣乘法之性質

27 Example 1: Matrix Multiplication
Computer C = AB for Solution Because A is a 2x3 matrix and B is a 3x2 matrix, AB is defined, and C will be a 2x2 matrix.

28 LU Decomposition (LU分解法)

29

30 例題:

31

32 2.2 Matrices and Systems of Linear Equations
p.20 2.2 Matrices and Systems of Linear Equations Consider a system of linear equations. The variables, or unknowns, are referred to as x1, x2, …, xn while the aij’s and bj’s are constants. A set of such equations is called a linear system of m equations in n variables. A solution to a linear set of m equations in n unknowns is a set of values for the unknowns that satisfies each of the system’s m equations.

33 Example 5: Solution to Linear System
Show that a solution to the linear system and that is not a solution to the linear system.

34 Example 5: Solution To show that is a solution, x1=1 and x2=2 must be substituted in both equations. The equations must be satisfied. The vector is not a solution, because x1=3 and x2=1 fail to satisfy 2x1-x2=0

35 p.21 Matrices can simplify and compactly represent a system of linear equations. This system of linear equations may be written as Ax=b and is called it’s matrix representation. A : coefficent matrix (係數矩陣) X : variable matrix (變數矩陣) b : constant matrix (常數矩陣) A|b : augmented matrix (擴增矩陣)

36 Row equivalent(列同義) & Elementary matrix(基本矩陣)

37 交 換 乘常數 相 加

38 Elementary row operations(基本列運算)
Elementary row operations (ERO) transforms a given matrix A into a new matrix A’ via one of the following operations: Type 1 ERO –A’ is obtained by multiplying any row of A by a nonzero scalar. (乘上一非零定數) Type 2 ERO – Multiply any row of A (say, row i) by a nonzero scalar c. For some j ≠ i, let row j of A’ = c*(row i of A) + row j of A and the other rows of A’ be the same as the rows of A. (乘上一非零定數+另一列) Type 3 ERO – Interchange any two rows of A (任二列交換)

39 Reduced Row Echelon Form(簡約列梯陣)

40 基本列運算(EROs)之功能 可求一方陣的逆方陣(A-1) 可解線性方程組。
基本列運算將矩陣變形成另一矩陣,使所得矩陣適合某一特殊形式(同義)。 原始矩陣與所得矩陣並無相等關係

41 Example: Example :

42

43 2.3 The Gauss-Jordan Method
p.22 2.3 The Gauss-Jordan Method Also Gauss-Jordan Elimination(高斯-約旦消去法). Using the Gauss-Jordan method, it can be shown that any system of linear equations must satisfy one of the following three cases: Case 1. no solution. Case 2. a unique solution. Case 3. an infinite number of solutions. The Gauss-Jordan method is important because many of the manipulations used in this method are used when solving linear programming problems by the simplex algorithm. The Gauss-Jordan method solves a linear equation system by utilizing EROs in a systematic fashion.

44 Case1: a unique solution
p.24 Case1: a unique solution P.24 The steps to using the Gauss-Jordan method The augmented matrix representation is A|b =

45 Step 1 Multiply row 1 by ½. This Type 1 ERO yields
Step 2 Replace row 2 of A1|b1 by (row 1 A1|b1) + row 2 of A1|b The result of this Type 2 ERO is

46 Step 3 Replace row 3 of A2|b2 by -1(row 1 of A2|b2) + row 3 of A2|b2
Step 3 Replace row 3 of A2|b2 by (row 1 of A2|b2) + row 3 of A2|b The result of this Type 2 ERO is The first column has now been transformed into

47 Step 4 Multiply row 2 of A3|b3 by -1/3
Step 4 Multiply row 2 of A3|b3 by -1/ The result of this Type 1 ERO is Step 5 Replace row 1 of A4|b4 by (row 2 of A4|b4) + row 1 of A4|b The result of this Type 2 ERO is

48 Step 6 Place row 3 of A5|b5 by 2(row 2 of A5|b5) + row 3 of A5|b5
Step 6 Place row 3 of A5|b5 by (row 2 of A5|b5) + row 3 of A5|b The result of this Type 2 ERO is Column 2 has now been transformed into

49 Step 7 Multiply row 3 of A6|b6 by 6/5. The result of this Type 1 ERO is
Step 8 Replace row 1 of A7|b7 by /6 (row 3 of A7|b7)+A7|b The result of this Type 2 ERO is

50 Step 9 Replace row 2 of A8|b8 by 1/3(row 3 of A8|b8)+ row 2 of A8|b8
Step 9 Replace row 2 of A8|b8 by /3(row 3 of A8|b8)+ row 2 of A8|b The result of this Type 2 ERO is A9|b9 represents the system of equations and thus the unique solution

51 p.28 Case2:no solution Example 6 (p.28) x1+ 2x2 =3 2x1+ 4x2 =4

52 Case3:an infinite number of solutions
p.28 Case3:an infinite number of solutions Example 7 (p.28) x1+ x =1 x2+ x3 =3 x1+2x2+ x3 =4

53 Exercise : Solving linear system by Gauss-Jordan Elimination

54

55 原擴增矩陣經有限次之基本列運算後,同義於一上三角矩陣,故由後代法(backward-substitution)解得x1,x2,x3。

56 若繼續矩陣之基本列運算,使其係數矩陣同義於一單位矩陣, 則可直接求得x1,x2,x3,而不必使用後代法的運算步驟,繼續 矩陣之基本列運算。

57

58 p.30 Basic Variables After the Gauss Jordan method has been applied to any linear system, a variable that appears with a coefficient of 1 in a single equation and a coefficient of 0 in all other equations is called a basic variable (基本變數, BV). Any variable that is not a basic variable is called a nonbasic variable (非基本變數,NBV).

59 p.30 No solution Unique solution BV={x1,x2,x3}, NBV is empty. Infinite number of solutions BV={x1,x2,x3} NBV={x4,x5}

60 Summary of Gauss-Jordan Method
p.32 Summary of Gauss-Jordan Method Does A' | b ' have a row [ 0, 0 , ..., 0 | c ] (c < > 0 ) ? A x = has no solution. Find BV and NBV. Is NBV empty? has a unique has an infinite number of solutions. Yes No Figrue 6

61 Exercise : 方程組 ,求所有a之值。 (1)no solution (2)a unique solution
(3) infinite number of solutions (1) a=-3 (2)除了a=3,-3以外 (3)a=3

62 Exercise :p.32 #1 ~ #8 X1+ X2+ X4 =3 X2+ X3 =4 X1+2X2+ X3+ X4 =8

63 2.4 Linear Independence and Linear Dependence
A linear combination(線性組合) of the vectors in V is any vector of the form c1v1 + c2v2 + … + ckvk where c1, c2, …, ck are arbitrary scalars. A set of V of m-dimensional vectors is linearly independent(線性獨立) if the only linear combination of vectors in V that equals 0 is the trivial linear combination. A set of V of m-dimensional vectors is linearly dependent (線性相依) if there is a nontrivial linear combination of vectors in V that adds up to 0.

64 Example 10: LD Set of Vectors
Show that V = {[ 1 , 2 ] , [ 2 , 4 ]} is a linearly dependent set of vectors. Solution Since 2([ 1 , 2 ])–1([ 2 , 4 ])=(0 0), there is a nontrivial linear combination with c1=2 and c2= -1 that yields 0. Thus V is a linear dependent set of vectors.

65 Linear dependent What does it mean for a set of vectors to linearly dependent? A set of vectors is linearly dependent only if some vector in V can be written as a nontrivial linear combination of other vectors in V. If a set of vectors in V are linearly dependent, the vectors in V are, in some way, NOT all “different” vectors. By “different we mean that the direction specified by any vector in V cannot be expressed by adding together multiples of other vectors in V. For example, in two dimensions, two linearly dependent vectors lie on the same line.

66 P.34 The Rank of a Matrix Let A be any m x n matrix, and denote the rows of A by r1, r2, …, rm. Define R = {r1, r2, …, rm}. The rank(秩) of A is the number of vectors in the largest linearly independent subset of R. To find the rank of matrix A, apply the Gauss-Jordan method to matrix A. (Example 14, p.35) Let A’ be the final result. It can be shown that the rank of A’ = rank of A. The rank of A’ = the number of nonzero rows in A’. Therefore, rank A = rank A’ = number of nonzero rows in A’.

67 Whether a Set of Vectors Is Linear Independent
A method of determining whether a set of vectors V = {v1, v2, …, vm} is linearly dependent is to form a matrix A whose ith row is vi. (p.35) If the rank A = m, then V is a linearly independent set of vectors. If the rank A < m, then V is a linearly dependent set of vectors.

68 2.5 The Inverse of a Matrix (反矩陣)
P.36 2.5 The Inverse of a Matrix (反矩陣) A square matrix(方陣) is any matrix that has an equal number of rows and columns. The diagonal elements (對角元素) of a square matrix are those elements aij such that i=j. A square matrix for which all diagonal elements are equal to 1 and all non-diagonal elements are equal to 0 is called an identity matrix(單位矩陣). An identity matrix is written as Im.

69 For any m x m matrix A, the m x m matrix B is the inverse of A if BA=AB=Im.
Some square matrices do not have inverses. If there does exist an m x m matrix B that satisfies BA=AB=Im, then we write B=A-1. (p.39) The Gauss-Jordan Method for inverting an m x m Matrix A is Step 1. Write down the m x 2m matrix A|Im Step 2. Use EROs to transform A|Im intoIm|B This will be possible only if rank A=m If rank A<m, then A has no inverse (p.40)

70 Inverse Matrix (反矩陣)

71 反矩陣之性質

72 Example : 例題:

73

74 Homogeneous System Equations
AX=b為一線性方程組,若b1=b2=…=bm=0, 則稱為齊次方程組(homogeneous) ,以 AX=0表之。 若x1=x2=…=xn=0為其中一組解, 則稱為必然解(trivial solution) 若x1、x2、…xn不全為0, 則稱為非必然解(nontrivial solution)

75

76 Example:

77 Example:

78 Example : Solving linear system by inverse matrix

79

80

81

82 Exercise : Solving linear system by inverse matrix
Answer:

83 Exercise : p.41 #5~#6 Use A-1 to solve the following linear system:

84 p.42 2.6 Determinants Associated with any square matrix A is a number called the determinant (行列式) of A (often abbreviated as det A or |A|). If A is an m x m matrix, then for any values of i and j, the ijth minor of A (written Aij) is the (m - 1) x (m - 1) submatrix of A obtained by deleting row i and column j of A. Determinants can be used to invert square matrices and to solve linear equation systems.

85

86 餘因子展開式

87 行列式之性質(1)

88 行列式之性質(2)

89 行列式之性質(3)

90 Exercise : p.43 #1~#4 A matrix is said to be upper triangular if i>j.aij=0. Show that the determinant of any upper triangular 3x3 matrix is equal the product of the matrix’s diagonal elements. (This result is true for any upper triangular matrix.) a. Show that for any 1x1 and 3x3 matrix. det(-A)=-detA . b. Show that for any 2x2 and 4x4 matrix. det(-A)=detA . c. Generalize the results of part (a) and (b).

91 Exercise : 若det(λI3-A)=0, λ=? λ =-5 或λ=0 或λ=3

92

93 Cramer’s Rule

94 Cramer’s Rule 注意事項 若det(A) ≠0,則n元一次方程組為相容方程組, 其唯一解為
若det(A) =det(A1) =det(A2)= …=det(An) =0, 則n元一次方程組為相依方程組,其有無限多組解 若det(A) =0,而det(A1) ≠0 或det(A2) ≠0 ,…,或 det(An) ≠0,則n元一次方程組為矛盾方程組,其為無解。

95 Example : Solving Sol: The system has an infinite number of solutions

96 Exercise : Solving linear system by Cramer’s rule
Answer:

97 LU-Decompositions Factoring the coefficient matrix into a product of a lower and upper triangular matrices. This method is well suited for computers and is the basis for many practical computer programs.

98 Solving linear systems by factoring
Let Ax = b,and coefficient matrix A can be factored into a product of n × n matrices as A = LU, where L is lower triangular and U is upper triangular, then the system Ax = b can be solved by as follows: Step 1. Rewrite Ax = b as LUx = b (1) Step 2. Define a n × 1 new matrix y by Ux = y (2) Step 3. Use (2) to rewrite (1) as Ly = b and solve this system for y. Step 4. Substitude y in(2) and solve for x

99 Example : Solving linear system by LU decomposition

100 Step 2. Ux=y Step 3. Ly=b Solving y by forward-substitution. y1=1, y2=5, y3=2

101 Step 4. y1=1, y2=5, y3=2 Solving y by backward-substitution. x1=2, x2=-1, x3=2

102 Doolittle method Assume that A has a Doolittle factorization A = LU. L:unit lower-△,U:upper-△ = The solution X to the linear system AX = b  , is found in three steps:      1.  Construct the matrices  L and U, if possible.       2.  Solve LY = b  for  Y  using forward substitution.     3.  Solve UX = Y for  X  using back substitution.

103 Crout method Assume that A has a Doolittle factorization A = LU. L:lower-△,U:unit upper-△  = The solution X to the linear system AX = b , is found in three steps:       1.  Construct the matrices  L and U, if possible.       2.  Solve LY = b  for  Y  using forward substitution.     3.  Solve UX = Y  for  X  using back substitution. 

104 Solving linear System By
Gauss-Jordan Elimination Inverse Matrix Cramer’s Rule LU-Decompositions Doolittle Method Crout Method


Download ppt "Chapter 2 Basic Linear Algebra(基本線性代數)"

Similar presentations


Ads by Google