Linear Algebra and Optimization for Machine
Learning
1st Edition by Charu Aggarwal. Chapters 1 – 11
vii
,Contents
1 Linear Algebra and Optimization: An Introduction
B I B I B I B I B I 1
2 Linear Transformations and Linear Systems
BI BI BI BI 17
3 Diagonalizable Matrices and Eigenvectors
BI BI BI 35
4 Optimization Basics: A Machine Learning View
BI BI BI BI BI 47
5 Optimization Challenges and Advanced Solutions
BI BI BI BI 57
6 Lagrangian Relaxation and Duality
B I B I B I 63
7 Singular Value Decomposition
B I B I 71
8 Matrix Factorization
B I 81
9 The Linear Algebra of Similarity
B I B I B I B I 89
10 The Linear Algebra of Graphs
B I B I B I B I 95
11 Optimization in Computational Graphs
B I B I B I 101
viii
,Chapter 1 B I
Linear Algebra and Optimization: An Introduction
BI BI BI BI BI
1. For any two vectors x and y, which are each of length a, show that
B I B I B I B I B I B I B I B I B I B I B I B I B I B I
(i) x − y is orthogonal to x + y, and (ii) the dot product of x − 3y and x
B I B I BI BI B I BI BI BI BI BI BI BI BI BI BI BI BI BI BI B I BI
+ 3y is negative.
BI BI B I BI
(i) The first is simply
BI · −x x y y using the distributive property of matri
BI BI BI B I BI BB I B I B I BI BI BI BI BI BI
x multiplication. The
BI
· dot product of a vector with itself is its squared le BI
I
BI BI BI BI BI BI BI BI BI BI BI
ngth. Since both vectors are of the same length, it follows that the resul
BI BI BI BI BI BI BI BI BI BI BI BI BI
t is 0. (ii) In the second case, one can use a similar argument to show tha
BI BI BI BI BI BI BI BI BI BI BI BI BI BI BI BI
t the result is a2 − 9a2, which is negative.
BI BI BI BI BI BI BI BI BI
2. Consider a situation in which you have three matrices A, B, and C, of si
BI BI BI BI BI BI BI BI BI BI BI BI BI BI
zes 10 × 2, 2 × 10, and 10 × 10, respectively.
BI BI BI BI BI BI BI BI BI BI BI
(a) Suppose you had to compute the matrix product ABC. From an efficien
BI BI BI BI BI BI BI BI BI BI BI
cy per- BI
spective, would it computationally make more sense to compute (AB)C or
BI BI BI BI BI BI BI BI BI BI BI BI
would it make more sense to compute A(BC)?
BI BI BI BI BI BI BI
(b) If you had to compute the matrix product CAB, would it make more se
BI BI BI BI BI BI BI BI BI BI BI BI BI
nse to compute (CA)B or C(AB)?
BI BI B I B I B I
The main point is to keep the size of the intermediate matrix as smal
BI BI BI BI BI BI BI BI BI BI BI BI BI
l as possible in order to reduce both computational and space require
BI BI B I BI BI BI BI BI BI BI BI
ments. In the case of ABC, it makes sense to compute BC first. In the
BI BI BI BI BI BI BI BI BI BI BI BI BI BI BI
case of CAB it makes sense to compute CA first. This type of associati
BI BI BI BI BI BI BI BI BI BI BI BI BI
vity property is used frequently in machine learning in order to reduc
BI BI BI BI BI BI BI BI BI BI BI
e computational requirements.
BI BI
3. — A =
Show that if a matrix A satisfiesB I B I B I B I B I B I B I B I
AT , then all the diagonal elements of BI B I BI BI BI BI BI
the matrix are 0.
BI BI BI BI
Note that A + AT = 0. However, this matrix also contains twice the dia
BI BI BI BI BI BI BI BI BI BI BI BI BI BI
gonal elements of A on its diagonal. Therefore, the diagonal element
BI BI BI BI BI BI BI BI BI BI
s of A must be 0.
BI BI BI BI BI
4. Show that if we have a matrix satisfying
BI— A= BI BI BI BI BI BI BI BI
1
, AT , then for any column vector x,
BI BI BI BI BI BI BI BI
we have x Ax = 0.
BI B I
T
BI BI BI
Note that the transpose of the scalar xT Ax remains unchanged. Therefo
B I B I B I B I B I B I B I BI B I B I B I
re, we have
B I B I
xT Ax = (xT Ax)T = xT AT x = −xT Ax. Therefore, we have 2xT Ax = 0.
BI BI BI BI B I BI BI BI BI BI BI BI BI BI BI BI BI BI
2