chapter 2 basic linear algebra ( 基本線性代數 ) 2 2.1 2.1 matrices ( 矩陣 ) & vectors (...
Post on 27-Dec-2015
397 Views
Preview:
TRANSCRIPT
Chapter 2
Basic Linear Algebra( 基本線性代數 )
2
2.12.1 Matrices( 矩陣 ) & Vectors( 向量 )
A matrix( 矩陣 )is any rectangular array of numbers
If a matrix If a matrix AA has has mm rows and rows and nn columns it is columns it is referred to as an referred to as an mm x x nn matrix. matrix.
mm x x nn is the is the order( 階 ) of the matrix. It is typically of the matrix. It is typically written aswritten as
1
3
2
4
1
4
2
5
3
6
1
2
2 1( )
A
a 11
a 21
....
a m1
a 12
a 22
....
a m2
....
....
....
....
a 1n
a 2n
....
a mn
p.11
3
The number in the The number in the iith row and th row and jjth column of A is th column of A is called the called the ijth element of of AA and is written and is written aaij..
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 = 4A = B if and only if x = 1, y = 2, w = 3, and z = 4
If A1
3
2
4
and Bx
w
y
z
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)
1
2
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 uu
corresponds to the line segment joining the point (0,0) to the point (1,2)
0 0 0( )0
0
6
Other Forms
Diagonal matrix ( 對角線矩陣 )
Identity matrix ( 單位矩陣 )
Upper triangular matrix( 上三角矩陣 )
Lower triangular matrix ( 下三角矩陣 )
)nj,i1 ,ji ( 0a ,]a[A ijnnij ≤≤≠∀
nj,i1 ; ji ,0
ji ,1a ,]a[A ijnnij
)nj,i1 ,ji ( 0a ,]a[A ijnnij ≤≤∀
)nj,i1 ,ji ( 0a ,]a[A ijnnij ≤≤∀
7
Example :
8
Transpose Matrix ( 轉置矩陣 )
,A nnaij
.atrixranspose mcalled a t is ]a[=A
then )nj1 m,i1(a=a ,]a[=A If
m×nTij
T
ijTijn×mij ≤≤≤≤
p.15
9
Example :
34
10
17
41
A =A T⇒
3114
4071
10
轉置矩陣之性質
786
921
543
A
708060
902010
504030
B
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
31
42A
51
23B
1955
460160
238
167
55
200BA
but
2890
432100
170
1610)AB(
22
2
2
Example : (AB)2≠A2B2 (AB = BA)?
13
Symmetric Matrix ( 對稱矩陣 ) & Skew-symmetric Matrix ( 斜對稱矩陣 )
14
Example :
029
205
950
653
542
321
B
Ais 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:
u v u 1 v1 u 2 v2 .... u n vn
u 1 2 3( ) v212
u v 1 2( ) 2 1( ) 3 2( ) 10
p.13
17
The Scalar Multiple of a MatrixGiven 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 MatricesLet 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.
A1
1
2
0
3 A3
3
6
0
A1
0
2
1
3
1
B1
2
2
1
3
1
C1 1
0 2
2 2
1 1
3 3
1 1
0
2
0
0
0
0
p.14
18
矩陣相加
6753
4812
7543
A
3276
8593
4257
B ?C
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.
v 2 1( )
u 1 2( )
u v 3 3( )
X1
X2
u
v
u+v
1 2 3
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 vectorscu +(1-c)v, where 0 ≤ c ≤ 1.
X1
X2
u
v
1 2
1
2c=1
c=1/2
c=0
21
矩陣加法之性質
22
常數乘以矩陣之性質
23
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
p.16
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.
A1
2
1
1
2
3
B
1
2
1
1
3
2
C5
7
8
11
C11
1 1 2( )
1
2
1
5 C12
1 1 2( )
1
3
2
8
C21
2 1 3( )
1
2
1
7 C22
2 1 3( )
1
3
2
11
p.16
28
LU Decomposition (LU 分解法 )
29
30
例題:
31
32
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.
a11 x1 a12 x2 .... a1n xn b1
a21 x1 a22 x2 .... a2n xn b1
.... .... .... ....
am1 x1 am2 x2 .... amn xn bm
2.2 Matrices and Systems of Linear Equations
p.20
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.
x1
2
1
3x
p.21
0=x+x2
5=x2+x
21
21
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
x1
2
1
3x
35
Matrices can simplify and compactly represent a system of linear equations.
This system of linear equations may be written as This system of linear equations may be written as AAxx==bb and is called it’s and is called it’s matrix representation..
AA : : coefficent matrix ( 係數矩陣 ) X X : : variable matrix ( 變數矩陣 ) bb : : constant matrix ( 常數矩陣 ) A|b : : augmented matrix ( 擴增矩陣 )
A
a 11
a 21
....
a m1
a12
a 22
....
a m2
....
....
....
....
a 1n
a 2n
....
a mn
x
x1
x2
....
xn
b
b 1
b 2
....
b m
a11 x1 a12 x2 .... a1n xn b1
a21 x1 a22 x2 .... a2n xn b1
.... .... .... ....
am1 x1 am2 x2 .... amn xn bm
p.21
36
Row equivalent( 列同義 ) & Elementary matrix( 基本矩陣 )
37
交 換
乘常數
相 加
38
Elementary row operations( 基本列運算 )
Elementary row operations (ERO) transforms agiven matrix A into a new matrix A’ via one of thefollowing 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. ( 任二列交換 )
p.22
39
Reduced Row Echelon Form( 簡約列梯陣 )
40
可求一方陣的逆方陣 (A-1)
可解線性方程組。。 基本列運算將矩陣變形成另一矩陣,,使所得矩陣適合
某一特殊形式 ( 同義 ) 。。 原始矩陣與所得矩陣並無相等關係
基本列運算 (EROs) 之功能
41
Example :Example:
42
43
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.
p.22
44
Case1 : a unique solution
P.24 The steps to using the Gauss-Jordan method
The augmented matrix representation is
2
2
1
2
1
1
1
2
2
9
6
5
A|b =A|b =
5=2x+ x x
6=2x+ x 2x
9=x + 2x + 2x
321
321
321
p.24
45
Step 1 Multiply row 1 by ½. This Type 1 ERO yields
Step 2 Replace row 2 of A1|b1 by -2(row 1 A1|b1) + row 2 of A1|b1. The result of this Type 2 ERO is
5211
6212
11
bA29
21
11 |
5211
3130
11
bA29
21
22 |
46
Step 3 Replace row 3 of A2|b2 by -1(row 1 of A2|b2) + row 3 of A2|b2. The result of this Type 2 ERO is
The first column has now been transformed into
1
0
0
21
23
29
21
33
20
3130
11
bA |
47
Step 4 Multiply row 2 of A3|b3 by -1/3. The result of this Type 1 ERO is
Step 5 Replace row 1 of A4|b4 by -1(row 2 of A4|b4) + row 1 of A4|b4. The result of this Type 2 ERO is
21
23
31
29
21
44
20
110
11
bA |
21
23
31
27
65
55
20
110
01
bA |
48
Step 6 Place row 3 of A5|b5 by 2(row 2 of A5|b5) + row 3 of A5|b5. The result of this Type 2 ERO is
Column 2 has now been transformed into
1
0
0
25
65
31
27
65
66
00
110
01
bA |
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 -5/6 (row 3 of A7|b7)+A7|b7. The result of this Type 2 ERO is
3300
13
100
2
7
6
501
3300
110
01
bA 31
27
65
77 |
3300
110
1001
bA 31
88 |
50
Step 9 Replace row 2 of A8|b8 by 1/3(row 3 of A8|b8)+ row 2 of A8|b8. The result of this Type 2 ERO is
A9|b9 represents the system of equations and thus the unique solution
3100
2010
1001
bA 99 |
51
Case2 : no solution
Example 6 (p.28)
p.28
x1+ 2x2 =3
2x1+ 4x2 =4
52
Case3 : an infinite number of solutions
Example 7 (p.28)
p.28
x1+ x2 =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
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).
Basic Variablesp.30
59
kcx
cx
kx
cx
kx
bA
3
22
1
000000
110100
202010
311001
'|'
1
2
3
4
5
20000
00000
13100
12010
11001
'|' bA
3
2
1
3100
2010
1001
'|'
3
2
1
x
x
x
bA
No solution
Unique solution
BV={x1,x2,x3}, NBV is empty.
Infinite number of solutions
BV={x1,x2,x3}
NBV={x4,x5}
p.30
60
Summary of Gauss-Jordan Method
Does A' | b ' have a row [ 0, 0 , ..., 0 | c ] (c < > 0 ) ?
Ax = b has nosolution.
Find BV and NBV.
Is NBV empty?
Ax = b has a uniquesolution.
Ax = b has an infinitenumber of solutions.
Yes No
Yes
No
p.32
Figrue 6
61
Exercise :
方程組 ,求所有 a 之值。
(1)no solution
(2)a unique solution
(3) infinite number of solutions
a10)xa(xx
43x xx
3x xx
32
21
321
321
(3)a=3
(2) 除了 a=3,-3 以外
(1) a=-3
62
Exercise : p.32 #1 ~ #8
1. X1+ X2+ X4 =3 X2+ X3 =4 X1+2X2+ X3+ X4 =8
2. X1+ X2+ X3 =4 X1+2X2 =6
3. X1+ X2 =12X1+ X2 =33X1+2X2 =4
4. 2X1- X2+ X3+ X4 =6 X1+ X2+ X3 =4
5. X1+ X4 =5 X2+ 2X4 =5 X3+ 0.5X4 =1 2X3+ X4 =3
6. 2X2+ 2X3 =4 X1+2X2+ X3 =4 X2- X3 =0
7. X1+ X2 =2 -X2+ 2X3 =3 X2+ X3 =3
8. X1+ X2+ X3 =1 X2+ 2X3+ X4 =2 X4 =3
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.
P.32
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
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.
Linear dependent
66
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’.
The Rank of a MatrixP.34
67
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.
Whether a Set of Vectors Is Linear Independent
68
2.52.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.
P.36
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 isStep 1. Write down the m x 2m matrix A|ImStep 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
AX=b 為一線性方程組 , 若 b1=b2=…=bm=0 ,
則稱為齊次方程組 (homogeneous) , 以 AX=0 表之。
1.若 x1=x2=…=xn=0 為其中一組解,則稱為必然解 (trivial solution)
2.若 x1 、 x2 、… xn 不全為 0 ,
則稱為非必然解 (nontrivial solution)
Homogeneous System Equations
75
76
Example: ? solution trival a has
101
011
326
A ,0AX
solution. trival a has system the
00A]x,x,[xX
matrix,singular non is A 1.1-T
321
solution. trival a has system the ,0]xxx[X
0100
0010
0001
~
0100
0010
0101
~
0100
0110
0101
~
0010
0110
0101
~
0320
0110
0101
~
0320
0011
0101
~
0326
0011
0101
~
0326
0011
0101
~
0101
0011
0326
.2
T321
77
Example: ? solution trival a has
222
012
111
A ,0AX
solution. nontrival a has system theRt
tx
t32
x
3t
x
3
2
1
78
Example : Solving linear system by inverse matrix
79
80
81
82
Exercise : Solving linear system by inverse matrix
1x x 3x
62xx 5 2x
7x x 2 x
321
321
321
19x 8,x 4,x 321 Answer:
83
Exercise : p.41 #5~#6
1. Use A-1 to solve the following linear system:
2. Use A-1 to solve the following linear system:
7=x5+x2
4=x3+x
21
21
2=x-x+x3
0=x2-x+x4
4=x+x
321
321
31
84
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.
p.42
85
86
餘因子展開式
87
行列式之性質 (1)
88
行列式之性質 (2)
89
行列式之性質 (3)
90
Exercise : p.43 #1~#4
1. 2. 3. 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.)
4. 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, λ= ?
212
030
313
A
λ =-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 元一次方程組為矛盾方程組,其為無解。
)Adet()Adet(
=x ..., ,)Adet()Adet(
=x ,)Adet()Adet(
=x nn
22
11
95
Example : Solving
635
212
211
A
6x6x3x5
1x2x x2
4x2x x
321
321
321
Sol:
0
635
112
411
)Adet(
,0
665
212
241
)Adet( ,0
636
211
214
)Adet( ,0
635
212
211
)Adet(
3
21
The system has an infinite number of solutions
96
Exercise : Solving linear system by Cramer’s rule
1x x 3x
62xx 5 2x
7x x 2 x
321
321
321
19=x 8,=x 4,=x 321Answer:
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
3
2
2
x
x
x
100
310
131
734
013
002
100
310
131
734
013
002
294
083
262
3
2
1
3
2
2
294
083
262
3
2
1
x
x
x
100
Step 2. Ux=y
Step 3. Ly=b
Solving y by forward-substitution. y1=1, y2=5, y3=2
37y3y 4y
2 y 3y
2 2y
3
2
2
734
013
002
321
21
1
3
2
1
y
y
y
3
2
1
3
2
1
100
310
131
y
y
y
x
x
x
101
Step 4. y1=1, y2=5, y3=2
Solving y by backward-substitution. x1=2, x2=-1, x3=2
2x
53xx
1x 3xx
2
5
1
x
x
x
100
310
131
3
32
321
3
2
1
3
2
1
3
2
1
100
310
131
y
y
y
x
x
x
102
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.
Doolittle method
=
103
=
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.
Crout method
104
Solving linear System By
Gauss-Jordan Elimination Inverse Matrix Cramer’s Rule LU-Decompositions
Doolittle Method Crout Method
top related