Numerical Linear Algebra
CS 740
Instructor: Ajit Rajwade
1
What is numerical linear algebra?
2
What is a matrix?
3
Examples:
Square matrix: m = n
Row and Column Vectors
4
Some notation
5
Some notation
6
Common types of matrices
7
Common matrix operations
8
Common matrix operations: multiplication
9
Note:
AB ≠ BA
Matrix multiplication is non-commutative (or does not commute).
Common matrix operations: multiplication
10
Common matrix operations
11
Common matrix operations
12
Common matrix operations
13
Common matrix operations
14
Matrix of size n x n
Matrix of size (n-1) x (n-1) created by dropping the i-th row and j-th column of A
Element from the i-th row and j-th column of A
This formula is true for any integer i. Note that replacing i by some i’ is equivalent to swapping rows i and i’. A swap of any two rows of a matrix causes the sign of its determinant to flip. This formula here essentially involves exchanging the i-th row and the first row.
Matrix Inverse
15
Rank of a square matrix: linearly (in)dependent vectors
Otherwise the vectors are said to be linearly independent.
16
Rank of a square matrix: linearly (in)dependent vectors
17
Rank of a square matrix: linearly (in)dependent vectors
18
Rank of a square matrix
19
Rank of a square matrix
20
Non-invertible
Invertible
What about rank of a non-square matrix?
21
Multiplying a matrix with a vector – Geometric meaning
22
Multiplying a matrix with a vector – Geometric meaning
23
Reflection across Y axis
Reflection across X axis
These matrices are called reflection matrices.
Multiplying a matrix with a vector – Geometric meaning
24
Multiplying a matrix with a vector – Geometric meaning
25
This matrix is called as a rotation matrix – more specifically it is a rotation matrix for anti-clockwise rotation through angle Θ about the origin. The rotation matrix for clockwise rotation through angle Θ about the origin is given as follows:
Multiplying a matrix with a vector – Geometric meaning
26
Multiplying a matrix with a vector – Geometric meaning
T(ax + by) = aT(x) + bT(y) for any vector x and y, and any scalars a, b (for now, we assume all these are defined over real numbers).
A(ax + by) = aAx + bAy
27
Multiplying a matrix with a vector – Geometric meaning
transforms the points (0,0),
(0,1),(1,0),(1,1) into (0,0),
(c,d),(a+c,b+d),(a,b).
28
The vectors represented by a 2-by-2 matrix correspond to the sides of a unit square transformed into a parallelogram.
Multiplying a matrix with a vector – Geometric meaning
29
Multiplying a matrix with a vector – Geometric meaning
30
Multiple geometric transformations
31
Inverse geometric transformations
32
More geometric transformations
33
Motion Models
34
2D Rotation matrix (orthonormal matrix)
Motion Models
35
-Perform translation such that (xc,yc) coincides with the origin (0,0).
-Rotate about the new origin.
-Translate back.
-The extra ones (third row) are called homogeneous coordinates – they facilitate using matrix multiplication to represent translations.
Motion Models
36
Assumption: the 2 x 2 sub-matrix A is NOT rank deficient, otherwise it will transform two-dimensional figures into a line or a point
Systems of Linear Equations
37
Unknowns are x1,x2,…,xn – the coefficients {bi} and {aij} are all known.
Systems of Linear Equations
38
Unknown: x (size n x 1),
Known: A (size n x n),b (size n x 1).
There are systems of linear equations where A has size m x n (m not equal to n), but we will take up those cases later!
Systems of Linear Equations
39
Systems of Linear Equations
40
Systems of Linear Equations: Geometric Interpretation
41
Systems of Linear Equations: Geometric Interpretation
42
Systems of Linear Equations: Geometric Interpretation
43
Systems of Linear Equations: Geometric Interpretation
44
Homogeneous system of equations
45
Homogeneous system of equations
46
Homogeneous system of equations
47
The null-space of this matrix consists of all points lying on the line x=0,y+z=0
Range of a matrix
48
Example: Range
49
Recap: singular matrices
50
System of linear equations with m≠n
51
System of linear equations with m≠n
52
Solving an over-determined system
53
Solving an over-determined system
54
See the board-work to understand how the derivatives were obtained.
Solving an over-determined system
55
x = inv(A’*A)*A’*b; % slower, less accurate
x = A\b; % this is the back-slash operator and it implements the
% pseudo-inverse of A efficiently and accurately
% In case of either method, the MATLAB system will produce a %warning if the matrix is low-rank or ill-conditioned (i.e. close to %being a low-rank matrix)
Application of over-determined systems
56
Application of over-determined systems
57
58
Application of over-determined systems
59
Application of over-determined systems
60
Orthogonal Matrices
61
Properties of orthogonal matrices
62
Applications of orthogonal matrices
63
Applications of orthogonal matrices
64
Applications of orthogonal matrices
65
Ajit Rajwade
66
512 x 512 Barbara image
Image reconstructed from top 80,000 largest DCT coefficients
67
DCT coefficients of images/audio signals decay very rapidly. The top plot shows the magnitudes of the DCT coefficients in descending order of absolute value. The plot below shows the magnitudes of all except the 20 largest coefficients (in terms of absolute value).
How does the DCT matrix look like?
68
It can be shown that Q is orthonormal. Q-1 is called as the DCT matrix. Q provides a mapping from the signal to its DCT coefficients, whereas its inverse provides the mapping from the DCt coefficients to the signal values.
Here is an 8 x 8 DCT matrix
N x N DCT matrix
Discrete Cosine Transform (DCT) in 1D
69
In this slide and the ones that follow, F is the vector of DCT coefficients (i.e. 𝛉 in slide 63), f is the original signal (i.e. x in previous slides), n is the time index (for the original signal) and u is the frequency index.
Discrete Cosine Transform (DCT) in 1D
70
n
u
u
n
DCT
71
72
u
n
Digression: matrix view of a discrete orthonormal transform (Fourier transform used as example here)
73
Fourier matrix: in any row, the value of x is fixed, the value of u ranges from 0 to M-1
74
Vector Norms
75
triangle inequality
Vector Norms
76
Weighted Norms
77
In this definition, W is a diagonal matrix. But a weighted norm may be defined with a non-diagonal matrix as well.
Matrix Norms
78
79
Matrix Norms
80
Matrix Norms
Given norms ∥.∥(m) and ∥.∥(n) on the range and domain of A, the induced norm ∥A∥(m,n)is the smallest number C such that the following is true for all vectors x in R^n:
81
This is the maximum factor by which a vector can stretch under the action of A. For the purposes of this course, sup and max are (roughly) equivalent.
82
83
Matrix Norm Inequalities
84
The last inequality follows from the very definition of ||A|| – why?
Why study matrix norms?
85
86
source: chatgpt (there is a mistake on this slide: what is it?)
Why study matrix norms?
‖𝛥x‖/‖x‖≤‖A-1‖‖𝛥b‖ ‖A‖/‖b‖=cond(A)‖𝛥b‖/‖b‖
87
Why study matrix norms?
‖𝛥x‖/‖x’‖≤‖A-1‖‖E‖ = cond(A) ‖E‖/‖A‖
88
89
Assume
If the condition number is high, then only a smaller perturbation is accommodated
References
90