Linear Algebra Concepts and Solutions
Linear Algebra Concepts and Solutions
Forms
1/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Algebra
Matrices
In this session, we will review some matrix operations and their properties.
I, the identity matrix with diagonal elements all equal to 1 and off-diagonal elements
1 0 0
all equal to 0, e.g. I = 0 1 0.
0 0 1
a11
a21
[a11 , a12 , · · · , a1M ] is called a row vector; . is called a column vector;
..
aN1
By default, “vector” means “column vector”.
2/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Algebra
• Trace
If A = [aij ]N×N is a square matrix, then the trace of A is
N
X
tr (A) = aii ,
i=1
Matrix Algebra
Let matrices A and B have the same dimension: A = [aij ]N×M , B = [bij ]N×M , then
A + B = [aij + bij ]N×M , A − B = [aij − bij ]N×M .
• Matrix Multiplication
Let A = [aij ]N×M , B = [bij ]M×K , and p, q are positive integers, then
(1) Scalar product:
αA = [αaij ]N×M is a scalar product of scalar α and matrix A.
4/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Algebra
2 Let 0 denote the zero matrix (with zero for every element).
In the algebra of real numbers, ab = 0 ⇒ a = 0 or b = 0.
In the algebra of matrices, AB = 0 ; A = 0 or B = 0. The reverse is true.
4
• e.g. A = 3 1 3
, B = 3 , AB = 0.
1 2 2
−5
5/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Algebra
3 tr (A + B) = tr (A) + tr (B)
4 tr (AB) = tr (BA)
6/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Definition
A linear system is called
consistent if there is at least one solution;
inconsistent if it has no solution;
overdetermined if it has more equations than unknowns;
underdetermined if it has fewer equations than unknowns;
exactly determined if it has the same number of equations and unknowns.
7/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
where we have 5 equations for 3 variables. The system is inconsistent, and hence has
no solution. (Return to this page later ) If we write the system as Ax = b, what is the
rank of A? What is the rank of [A|b]?
8/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
is inconsistent, even though we have the same number of equations and variables
(N = M).
In this case, it is obvious the system is inconsistent because we are trying to make
x + 2y − 3z equals to 1 and 2 simultaneously. Sometimes, such inconsistencies are not
immediately apparent. For instance, the linear system
1 2 −3 x 1
2 1 −2 y = 2 ,
1 −1 1 z 0
is also inconsistent. The second equation of this linear system is obtained by adding
the second and third equations of the previous linear system.
9/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
10/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
11/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Gauss-Jordan Elimination
Formally, we introduce the following two ways to solve for linear systems:
Gaussian elimination
• row echelon method
• elementary row operations
• backward substitution
Gauss-Jordon elimination
• reduced row echelon method
• elementary row operations
12/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Gauss-Jordan Elimination
An N × M-matrix satisfying properties (a), (b), & (c) is said to be in row echelon form.
Example
Left: reduced row echelon form Right: row echelon form
1 2 0 0 1 1 2 3 6 10
0 0 1 2 3 0 0 1 2 3
0 0 0 0 0 0 0 0 0 0
13/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Gauss-Jordan Elimination
Rank
Definition (Rank)
The rank of a N × M-matrix A, rank(A), is the maximum number of linearly
independent columns of A. This is also the number of linearly independent rows of A.
Because
• Row operations do not change the row space, hence do not change the row rank;
and
• each matrix has a unique corresponding reduced row echelon form matrix (a
theorem),
rank(A) =the number of nonzero rows in the unique reduced row echelon form of A.
14/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Gauss-Jordan Elimination
Gauss-Jordan elimination
Step 2. Obtain a reduced row echelon form [C|d].
• If A is invertible, then C = I.
Step 3. For each nonzero row of the matrix [C|d], solve the
corresponding equation for the unknown associated
with the leading one in that row.
In Step 3, The rows consisting entirely of zeros can be ignored, because the
corresponding equation will be satisfied for any values of the unknowns.
15/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Gauss-Jordan Elimination
x + y + 2z − 5w = 3
2x + 5y − z − 9w = −3
2x + y − z + 3w = −11
x − 3y + 2z + 7w = −5
16/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Inverse
Definition (Matrix inverse)
A−1 is the matrix inverse of the N × N square matrix A if it satisfies the conditions
AA−1 = A−1 A = I,
Find the matrix inverse (if exists): [A|I] → · · · Gauss–Jordan Elimination · · · → [I|A−1 ]
Properties:
• (A−1 )> = (A> )−1
• (AB)−1 = B−1 A−1
• Woodbury formula (A + UCV)−1 = A−1 − A−1 U(C−1 + VA−1 U)−1 VA−1
17/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Matrix Solution
Theorem
Let A be a square N × N matrix. The following statements are equivalent:
• A is invertible (or nonsingular or nondegenerate), that is A has an inverse.
• I can be obtained by applying a finite sequence of elementary row operations to A.
• det(A) 6= 0.
• rank(A) = N.
Formally, if A is a square matrix and its inverse exists, the previous Gauss-Jordan
elimination method
is equivalent to computing the matrix inverse, so that the linear system Ax = b can be
solved as
x = A−1 b.
18/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
The matrix inverse of a 2 × 2 matrix is easy to compute, because its determinant and
cofactors are easy to compute. There is a method to solve linear equations involving
N × N matrices, called Cramer’s rule, that involved the computation of determinants
and cofactors. This method is described in greater details in
[Link]
···
a11 a12 a1N
a21 a22 ··· a2N
A= . .. .
.. ..
.. . . .
aN1 aN2 ··· aNN
The Cramer’s rule is only applicable for the linear systems with square matrix A having
non-zero determinant (or equivalently invertible or nonsingular).
19/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Determinant Computation
The determinant of A can be written as a Laplace expansion (formula):
= a11 a22 .
.
.
.
.
.
.
.
.
.
.
.
+ · · · + (−1)N+2 a2N .
.
.
.
.
.
.
.
.
.
.
.
aN3 aN4 ··· aNN aN2 aN3 ··· aN,N−1
2 The det(A) = 0 if
• all elements of one row (or one column) are zero; or
• two rows (or two columns) are identical; or
• two rows (or two columns) are proportional.
3 If we interchange two rows (or two columns) of matrix A to get matrix A0 , then
det(A0 )=-det(A).
4 If we multiply each element in one row (or one column) of a matrix A by a
constant k to get a matrix A0 , then det(A0 )=k det(A).
5 If we add to each element of i-th row, k times the corresponding element of j-th
row, to obtain a matrix A0 , then det(A0 )=det(A).
6 det(A> )=det(A).
7 det(A−1 )=1/det(A) if A is non-singular.
8 det(AB) =det(A)det(B). (but, det(A + B) 6=det(A)+det(B) in general)
9 det(A1 · · · An ) =det(Ai1 · · · Ain ) =det(A1 ) · · · det(An ).
21/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Cramer’s Rule
Remark: This method is rarely used nowadays, because for large matrices, it is
computationally less efficient compared to Gauss-Jordan elimination.
22/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Eigenvalue Problem
Definition
A matrix eigenvalue problem has the structure
Ax = λx
Ax = λx =⇒ A(cx) = λ(cx).
In practice, to regulate the solution, we consider only the solutions that have unit
length, i.e.
√ q
kxk = xT x = x12 + x22 + · · · + xN2 = 1.
The solution of unit length is unique up to a change of sign, since if x is a solution of
unit length then so is −x.
24/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Definition
We call λi an eigenvalue of A. The set of eigenvalues {λi } is frequently referred to as
the spectrum of A. We call xi an eigenvector of A, corresponding to the eigenvalue λi .
25/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Remark: f (λ) is a polynomial of degree N and thus it has N roots (counting repeats).
Abel’s Impossibility Theorem tells us that there are in general no closed-form solutions
for the roots of polynomial equations with degree greater or equal to 5. We can still
solve for the real roots of such characteristic equations using numerical methods.
26/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Theorem
An N × N matrix A is invertible if and only if λ = 0 is not an eigenvalue of A.
Theorem
The eigenvalues of A are the roots of the characteristic polynomial of A.
The procedure for finding the eigenvalues and associated eigenvectors of a matrix is as
follows:
Step 1 Determine the roots of the characteristic polynomial
f (λ) = det(A − λI). These are eigenvalues of A.
Step 2 For each eigenvalue λ, find all the nontrivial solutions to the
homogeneous system (A − λI)x = 0. These are the eigenvectors of A
associated with the eigenvalue λ.
27/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Qn
6 det(A) = i=1 λi .
• If any eigenvalue λi = 0, then det(A) = 0, and so A is singular.
• If every λi 6= 0, then det(A) 6= 0, and so A is invertible.
Pn
7 tr (A) = i=1 λi .
28/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
(Polynomial of λ of degree 2)
29/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
v1 + 2v2 = 2v1
−v1 + 4v2 = 2v2
Try λ2 = 3 by yourself!
30/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Digonalization
Digonalization
Definition
A matrix B is said to be similar to a matrix A if there is a nonsingular (or an
invertible) matrix P such that
B = P−1 AP.
Definition
We shall say that the matrix A is diagonalizable if it is similar to a diagonal matrix. In
this case, we also say that A can be diagonalized. Otherwise, A is called defective.
Theorem
• Similar matrices have the same eigenvalues.
• A is diagonalizable if and only if A has N linearly independent eigenvectors.
Digonalization
32/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Digonalization
Theorem
If A is symmetric N × N matrix, then there exists an orthogonal matrix P such that
P−1 AP = D, a diagonal matrix. The eigenvalues of A lie on the main diagonal of D.
Theorem
An N × N matrix A is orthogonally diagonalizable if and only if A is symmetric.
Theorem
If A is diagonalizable with P−1 AP = D, then for any integers k,
Ak = PDk P−1 .
Remark: Further, if A is invertible, then A−1 can be written as A−1 = PD−1 P−1 .
33/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Digonalization
Diagonalization
Example (Diagonalization)
Diagonalize
1 2 0 0
2 1 0 0
A=
0
.
0 1 2
0 0 2 1
34/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
where σ1 ≥ σ2 ≥ · · · ≥ σr > 0 are the first r singular values of A, and there exist an
M × M orthogonal matrix U and an N × N orthogonal matrix V such that
A = UΣV> .
• The singular values of A are square roots of the eigenvalues of AA> (or A> A).
• The columns of U (resp. V) are eigenvectors of AA> (resp. A> A). They are also
called left (resp. right) singular vectors of A.
35/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
• The matrices U and V are not unique, but the diagonal entries of Σ are
necessarily the singular values of A.
• Any factorization A = UΣV> , with U and V orthogonal and Σ as presented
before, is called a singular value decomposition (SVD) of A.
36/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
6 A = UΣV> .
37/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
• Quadratic Forms
Let AN×N be a square matrix, then x> Ax is called a quadratic form of x, where x
is N × 1 vector.
• e.g. A = 1 2
, x> Ax = [x1 , x2 ]
1 2 x1
= x12 + 5x1 x2 + 4x22 .
3 4 3 4 x2
• Positive-definite Matrices
Let AN×N be symmetric. If for any xN×1 6= 0, it has
x> Ax > 0,
38/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
(i) A symmetric matrix AN×N is positive-definite if and only if all eigenvalues of A are
positive.
(iv) Suppose BN×M be any matrix, then B> B and BB> are both positive semi-definite.
39/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng
Matrix Algebra Linear Sys. Sol. Elimination Inverse and det Eigendecomposition Digonalization SVD Quad. Forms
Verification: A−1/2 A−1/2 = (UΛ−1/2 U> )(UΛ−1/2 U> ) = UΛ−1 U> = A−1 .
40/ 40 Day 2: Linear Algebra SPMS MSc Preparatory Module PUN Chi Seng