TA WEEK 3 Copy
TA WEEK 3 Copy
TA WEEK 3 Copy
1 / 27
Matrix Definition and Operations
2 / 27
Matrix Definition and Operations - Solutions
3 / 27
Matrix Multiplication
and
2 0
B=
1 3
Exercise (Harder): What is the inverse of the matrix A?
4 / 27
Matrix Multiplication - Solutions
where:
a b
A=
c d
So for matrix A:
det(A) = (1 × 4) − (2 × 3) = −2
Using the formula for the inverse of a 2x2 matrix:
1 4 −2
A−1 =
−2 −3 1
−2 1
A−1 =
1.5 −0.5
5 / 27
Eigenvalues and Eigenvectors (Part 1)
Av = λv
Exercise (Easy): Find the eigenvalue of:
2 0
0 3
6 / 27
Eigenvalues and Eigenvectors - Solutions (Part 1)
Av = λv
Exercise (Easy): Find the eigenvalue for:
3 1
1 3
8 / 27
Eigenvalues and Eigenvectors - Solutions (Part 2)
3−λ 1
=0
1 3−λ
9 / 27
Vector Space
10 / 27
Vector Space - Solutions
Solution (Easy): 1. Matrix addition and scalar multiplication are defined for
2 × 2 matrices. 2. These matrices satisfy all the axioms of a vector space.
Conclusion: Yes, the set of all 2 × 2 matrices forms a vector space.
Solution (Harder): 1. Consider two symmetric 2 × 2 matrices A and B. Their
sum A + B is also symmetric. 2. For any scalar c, the matrix cA is symmetric.
Conclusion: Yes, the set of all symmetric 2 × 2 matrices forms a vector space.
11 / 27
Projection: Introduction
12 / 27
Projection Formula
projv (u)
13 / 27
Orthogonality
Vectors are orthogonal if they are perpendicular to each other. This means
their dot product is zero.
u·v =0
u
14 / 27
Projection Orthogonality
u − projv (u)
15 / 27
Matrix Rank
Definition: The rank of a matrix A is the dimension of the column space (or
equivalently, row space) of A. It gives the number of linearly independent
columns (or rows).
Properties:
▶ rank(A) ≤ min(m, n) where m and n are the number of rows and
columns of A, respectively.
▶ rank(AB) ≤ min(rank(A), rank(B))
▶ If A is invertible, then rank(A) = n (full rank).
16 / 27
Matrix Trace
Definition: The trace of a square matrix A is the sum of its diagonal elements.
n
X
tr(A) = aii
i=1
Properties:
▶ tr(A + B) = tr(A) + tr(B)
▶ tr(kA) = ktr(A) for any scalar k.
▶ tr(AB) = tr(BA)
▶ The trace is the sum of the eigenvalues of the matrix.
17 / 27
Derivatives Related to Vectors
The gradient is a vector containing all the first order partial derivatives of a
function.
∂f
∂x1
∂f
∂x
2
∇f = .
.
.
∂f
∂xn
18 / 27
Derivatives Related to Vectors - Solutions
19 / 27
Introduction to Vector Derivatives
Definition:
For a scalar-valued function f (v) with v ∈ Rn , the gradient is a vector of all
its first-order partial derivatives. Given by:
T
∂f ∂f ∂f
∇f (v) = , ,...,
∂v1 ∂v2 ∂vn
20 / 27
Linearity of Derivatives
Property 1:
Given scalar-valued functions f (v) and g(v), the derivative of their sum is the
sum of their derivatives:
∇(f + g) = ∇f + ∇g
Proof:
Using the linearity of differentiation:
∂(f + g) ∂f ∂g
= +
∂vi ∂vi ∂vi
21 / 27
Derivative of a Dot Product
Property 2:
For vectors v and w in Rn , the derivative of their dot product with respect to
v is:
∂(vT w)
=w
∂v
Proof:
Given h(v) = vT w
∂h ∂
= (v1 w1 + v2 w2 + · · · + vi wi + . . . )
∂vi ∂vi
∂vi wi
=
∂vi
= wi
∂(vT w)
Thus, ∂v
= w.
22 / 27
Derivative of a Vector Norm
Property 3:
The derivative of the squared norm of vector v is:
∂(vT v)
= 2v
∂v
Proof:
Expanding the squared norm:
vT v = v12 + v22 + . . . + vn
2
∂(v12 + v22 + . . .)
= 2vi
∂vi
23 / 27
Derivatives Related to Matrices
24 / 27
Derivatives Related to Matrices - Solutions
∂tr(AT A) ∂f
Solution (Easy): 1. Use the property: ∂A
= 2A. Thus, ∂A = 2A.
∂tr(AB) T . Hence, ∂f
Solution (Harder): 1. Use the property: ∂A
= B ∂A
= BT .
25 / 27
Given matrix
2 1
A=
1 3
1. Compute A2 .
2. Determine if A is diagonalizable.
3. Find the eigenvalues and eigenvectors of A.
4. Compute the determinant of A.
5. For the function f (v) = Av, compute the derivative with respect to v.
6. Define the vector space spanned by the eigenvectors of A.
26 / 27
Solutions for Question 1
2 1 2 1 5 5
1. A2 = × = .
1 3 1 3 5 10
2. Eigenvalues of A are λ1 = 1 and λ2 = 4, since both are distinct, A is
diagonalizable.
1
3. Eigenvalue λ1 = 1 has eigenvector v1 = and eigenvalue λ2 = 4 has
−1
1
eigenvector v2 = .
1
4. det(A) = 2 × 3 − 1 × 1 = 5.
∂f
5. ∂v
= A.
6. Vector space spanned by v1 and v2 is R2 .
27 / 27