Module2 VectorsMatrices
Module2 VectorsMatrices
n-component vector:
1
Operations
• Sum (difference):
a ± b = (a1 ± b1 , . . . , an ± bn )
a − a = 0 = (0, . . . , 0)
• Scalar multiplication:
a = (a1 , . . . , an ) and λ ∈ R
⇒ λ · a = (λ · a1 , . . . , λ · an )
2
Operations
• Linear combination:
p
x = k1 · x1 + · · · + kp · xp = ki xi
X
i=1
3
Operations
b1 = k1 · a11 + · · · + kp · ap1
p
b = k · a + ··· + k · a
2 1 12 p p2
⇔ bi = kj · aji (i = 1, . . . , n)
X
· · · j=1
bn = k1 · a1n + · · · + kp · apn
4
Examples
5
Dot product or inner product
i=1
NOTE
If the product of two vectors is zero ; at least one factor is
zero
COUNTEREXAMPLE
v
u n
√
kxk = x · x = t xi2
uX
(B)
i=1
7
Distance between two vectors
v
u n
d(x, y) = kx − yk = t (xi − yi )2
uX
i=1
8
Linear dependence
p−1
xp = ki xi
X
i=1
p−1 p
ki xi − xp = 0 ⇒ ki xi = 0, with kp = −1
X X
⇒
i=1 i=1
⇒ k1 · x1 + · · · + kp · xp = 0
with at least one ki 6= 0 (kp = −1) 9
Linear dependence
Example
• Is vector (6, 2, 3) dependent on {(1, 2, 3), (2, −1, 4)} ?
• The following relation should hold:
(6, 2, 3) = α · (1, 2, 3) + β · (2, −1, 4)
2α − β = 2 → α = 2
⇔ α + 2β = 6 → β = 2
3α + 4β = 3 → not possible
p
ki xi = 0
X
i=1
⇒ k1 · x1 + · · · + kp · xp = 0 ⇔ k1 = . . . = kp = 0
e1 = (1, 0, 0, 0, . . . , 0)
e2 = (0, 1, 0, 0, . . . , 0)
e3 = (0, 0, 1, 0, . . . , 0)
...
en = (0, . . . , 0, 1)
13
Basis of a vector space
v1 , . . . , vn
v = (v1 , . . . , vn ) = v1 · (1, 0, . . . , 0) + · · · + vn · (0, . . . , 0, 1)
15
Examples
2 dimesions
3 dimesions
(4, −2, 5) = (4, 0, 0) + (0, −2, 0) + (0, 0, 5) =
4 · (1, 0, 0) − 2 · (0, 1, 0) − 5 · (0, 0, 1)
Basis: {(1, 0, 0), (0, 1, 0), (0, 0, 1)}
16
Matrices
Matrices
n=m=3⇒ matrix 3 × 3
1 2 1
A=7 9 2
0 1 3
1
Main diagonal 9
3
18
Matrix examples
Rectangular matrix
n = 2, m = 3 ⇒ matrix 2 × 3
1 −1 0
!
A=
3 −1 2
19
Particular matrices
1 0 0
I =0 1 0
0 0 1
20
Operations
Example
1 4 5 2 −2 0 3 2 5
! ! !
+ =
−2 0 3 3 −1 −3 1 −1 0
21
Operations
• Scalar multiplication:
λ · A = B → bij = λ · aij
Example
2 1 −3 4 2 −6
! !
2· =
0 4 5 0 8 10
22
Operations
Example
1 4
1 2 3
!
T
A= →A =2 5
4 5 6
3 6
23
Operations
Example
1 2 1 1 2 1
A = 2 7 3 , AT = 2 7 3
1 3 9 1 3 9
24
Operations
Example
1 4 5 2 −2 0
! !
2· −3· =
−2 0 3 3 −1 −3
2 8 10 6 −6 0 −4 14 10
! ! !
− =
−4 0 6 9 −3 −9 −13 3 15
25
Operations
26
Matrix Multiplication
where:
C = [cij ] , cij = a i,∗ · b∗,j = ai,1 · b1,j + ai,2 · b2,j + · · · + an,1 · bn,j
Entries cij are given by dot product of the corresponding row i
of A and the corresponding column j of B.
27
Matrix multiplication
Example
1 0 1
1 0 0
!
A= ,B = 0 2 0
2 1 0
1 3 0
A(2 × 3) · B(3 × 3) = C (2 × 3)
1+0+0 0+0+0 1+0+0 1 0 1
! !
C= =
2+0+0 0+2+0 2+0+0 2 2 2
28
Matrix multiplication
NOTE
• Generally, if A and B are conformable, B and A are not
conformable (thus, A · B is possible, but not B · A)
• If A e B are squared with same sizes, then A · B and B · A
are possible but with different result
(matrix multiplication is not commutative)
• A · B = 0 (null matrix) does not imply that A or B are null
1 0 0 0 0 0
! ! !
A= ,B = ,A · B = =0
1 0 0 1 0 0
29
Determinant
Example 2 × 2
1 2
!
A=
9 3
det A = 1 · 3 − 2 · 9 = −15
30
Determinant
Example
1 2 3 1 2 3 1 2
1 0 1 = 1 0 1 1 0 =
2 2 2 2 2 2 2 2
=1·0·2+2·1·2+3·1·2−2·0·3−2·1·1−2·1·2=4
32
Minor
33
Minor
Example
1 2 3
A=4 5 6
7 8 9
Some 2 × 2 minors:
1 2 4 6 2 3
= −3; = −6; = −3
4 5 7 9 5 6
1 3 1 3
= −12; = −6
7 9 4 6 34
Minor
Example
1 −1 0
!
A=
3 −1 2
Minors k = 2 :
1 −1 1 0 −1 0
= 2; = 2; = −2
3 −1 3 2 −1 2
Minors k = 1 :
|1| = 1; |0| = 0; | − 1| = −1 35
Cofactor
where Mij is the minor obtained deleting the i-th row and j-th
column of aij (be careful, the cofactor sign depends on the
position of aij ).
36
Laplace expansion
k=1
k=1 37
Laplace expansion
Example
1 2 3
0 1 1 1 1 0
1 0 1 = 1· −2· +3· = −2 − 0 + 6 = 4
2 2 2 2 2 2
2 2 2
38
Properties of determinants
39
Properties of determinants
Example
1 4 5
2 5 7 =0
3 6 9
40
Rank
A = −3 5 9
2 22 −6
The only minor of order three is:
1 0 −3
1 0
−3 5 9 = 0 ⇒ rk(A) < 3, = 5 6= 0
−3 5
2 22 −6
42
⇒ rk(A) = 2
Rank
Example
1 2 3
!
C=
4 5 6
The maximum possible rank is 2
1 2
= −3 6= 0 ⇒ rk(C ) = 2
4 5
43
Rank
Example
1 4 3 2
A = −2 1 0 −3
−1 5 3 −1
1 4
= 9 6= 0 ⇒ rk(A) = 2
−2 1 44
Rank
Rule of thumb
• Consider the maximum possible rank rmax (equal to the
smallest of the number of rows and columns).
• If we find a non-zero minor of order rmax , the rank will be
rmax
• Otherwise, we consider a smaller order minor (one unit
smaller) and apply the same procedure until we find a
non-null minor.
45
Rank as function of a parameter
A = −3 1 5
−2 4 k
Example (cont’d)
• Compute the determinant:
1 3 2
−3 1 5 = 10k − 70 6= 0 ⇒ k 6= 7
−2 4 k
• If k 6= 7 ⇒ rk(A) = 3
47
Rank as function of a parameter
Example (cont’d)
• If k = 7
1 3 2
1 3
= 10 6= 0 ⇒ rk(A) = 2
−3 1 48
Rank as function of a parameter
Example
1 3 −2
A = −3 −9 k
2 k −4
49
Rank as function of a parameter
Example (cont’d)
• If k 6= 6 ⇒ rk(A) = 3
• If k =6
1 3 −2
Example
4 1 2
!
A=
k 3 k
51
Rank as function of a parameter
Example (cont’d)
Minors of order 2:
4 1
= 12 − k 6= 0 ⇒ k 6= 12
k 3
4 2
= 2k 6= 0 ⇒ k 6= 0
k k
1 2
= k − 6 6= 0 ⇒ k 6= 6
3 k 52
Rank as function of a parameter
Example (cont’d)
Conclusion:
53
Linear systems
Systems of linear equations
or in matrix form:
Ax = b
55
Systems of linear equations
56
Solving a system
• Cramer theorem
det A 6= 0 is a necessary and sufficient condition for a
system of n linear equations in n unknowns to have a
unique solution.
Example
x +y+z =1
x − 2y − z = 2
2x + y − 6z = 3
2
58
Square system
Example (cont’d)
1 1 1 1
A = 1 −2 −1 , b= 2
2 1 −6 3/2
1 1 1
det A = 1 −2 −1 =
2 1 −6
= 12 + (−2) + 1 − (−1) − (−4) − (−6) = 22 6= 0
⇒ unique solution
59
Solutions
If det A 6= 0 ⇒
60
Cramer’s rule
• Generally:
det Ai
xi = , i = 1, . . . , n,
det A
where Ai is the matrix obtained from A by replacing the i-th
column with the vector of constant terms.
61
Cramer’s rule
Example
x +y =3 1 1
( !
, A= , det A = −2
x −y =1 1 −1
3 1 1 3
1 −1 −4 1 1 1−3
x= = = 2, y= = =1
1 1 −2 1 1 −2
1 −1 1 −1
x = 2, y=1 62
General case
• Rouché-Capelli theorem
A system of linear equations with n equations and m
unknowns has solutions if the rank of the coefficient
matrix is equal to the rank of the augmented matrix:
If rk(A) = rk(A|b) ⇒ the system is consistent (has
solutions)
a11 a12 . . . a1m
64
Meaning of Rouché-Capelli theorem
Unique solution (r = m)
Consider the r-order minor used to identify the rank of A. The
rows contain the main equations of the system. The
remaining equations will be discarded and we are left to solve
a square system of order r with Cramer’s rule.
67
Solutions of a system
68
Examples
Example 1
x +y =3 1 1
x + 2y = 3, A = 1 2 , rk(A) = 2
2x + y = 5
2 1
1 1 1 2 1 1
= 1, = −3, = −1
1 2 2 1 2 1
69
Examples
Example 1 (cont’d)
1 1 3
70
Examples
Example 2
x +y =1 1 1
x + 2y = 2, , A = 1 2 , rk(A) = 2
2x + 3y = 3
2 3
1 1 1
71
Examples
Example 2 (cont’d)
Because rk(A) = rk(A|b) = 2, the system has a unique
solution
We can use any two equations to find the solution, as all
minors of order 2 are different from zero.
72
Examples
Example 2 (cont’d)
1 1
2 2
x =0
=
1 1
x +y =1 1 2
⇒
x + 2y = 2
1 1
1 2
y= =1
1 1
1 2
73
Examples
Example 3
x + 2y + z = 0
2x + 2y + 2z = 4
x −y−z =1
3 5
x = , y = −2, z =
2 2
74
Examples
Example 4 - n = 3 equations, m = 2 unknowns
3x − 2y = 0
x − y = −1
2x − 3y = −4
3 −2
Coefficient matrix A = 1 −1
2 −3
3 −2 0
Example 4 (cont’d)
3 −2
A = 1 −1
2 −3
3 −2
= −3 + 2 = −1 6= 0 ⇒ rk(A) = 2
1 −1
76
Examples
Example 4 (cont’d)
3 −2 0 3 −2 0
A|b = 1 −1 −1 , 1 −1 −1 = −1 6= 0
2 −3 −4 2 −3 −4
⇒ rk(A|b) = 3
rk(A|b) = 3 > rk(A) = 2
⇒ NO SOLUTIONS
77
Examples
Example 5
3x − 2y = 0
x − y = −1
4x − 3y = −1
3 −2
3 −2
A = 1 −1 , = −1 6= 0 ⇒ rk(A) = 2
1 −1
4 −3
78
Examples
Example 5 (cont’d)
3 −2 0 3 −2 0
A|b = 1 −1 −1 , 1 −1 −1 = 0
4 −3 −1 4 −3 −1
⇒ rk(A|b) < 3
rk(A|b) = rk(A) = 2
⇒ UNIQUE SOLUTIONS
79
Examples
Example 5 (cont’d). Delete the third equation.
0 −2
−1 −1
x =2
=
3 −2
3x − 2y = 0
⇒ 1 −1
x − y = −1
3 0
y= =3
3
−2
1 −1
80
Examples
Example 6
x + 2y − 3z = 2
(
4x − y + 2z = 3
n = 2 equations, m = 3 unknowns
1 2 −3
!
Coefficient matrix A =
4 −1 2
1 2 −3 2
!
Augmented matrix A|b =
4 −1 2 3
81
Examples
Example 6 (cont’d)
• The rank of matrix A is 2 :
1 2
= −9 6= 0 ⇒ rk(A) = 2
4 −1
• Rouché-Capelli theorem:
rk(A|b) = rk(A) = 2 < m = 3
⇒ INFINITE SOLUTIONS
Secondary variable: z 82
Examples
Example 6 (cont’d)
• Solution:
x + 2y = 3z + 2
(
4x − y = −2z + 3
3z + 2 2
− −2z + 3 −1 = −3z−2+4z−6 = 8−z
⇒ −9 −9 9
1 3z + 2
4 −2z + 3
x= = 14z+5
= −2z+3−12z−8
−9 −9 9 83
Examples
Example 7. Discuss as function of the real parameter k.
x +y =4
4x − ky = 8
x −y =0
1 1
1 1
A = 4 −k , = −2 6= 0 ⇒ rk(A) = 2
4 −1
1 −1
1 1 4
A|b = 4 −k 8 , det A = 4k
84
1 −1 0
Examples
Example 7 (cont’d)
•
• if k 6= 0 ⇒ 4k 6= 0 ⇒ rk(A|b) = 3 > rk(A) = 2 ⇒ NO
SOLUTIONS
• if k = 0 ⇒ 4k = 0 ⇒ rk(A|b) = 2 = rk(A)
⇒ UNIQUE SOLUTIONS
x=y=2
85
Homogeneous systems