Matrix
Matrix
⎡a⎤
Example: for vector v = b , length or magnitude of v can be calculated as
⎣ c⎦
∥v∥ = √a 2 + b 2 + c 2
unit vector
a vector with a magnitude (length) of 1
1
⎡1⎤ ⎡ √2 ⎤
Examples: [ ]or 0 or [ ]or 1
1 0
0 ⎣0⎦ 1 ⎣ ⎦
√2
unit circle
unit circle consists of all points (vectors) with length 1, meaning every point on the unit circle is
a unit vector.
in 2D plane, all points (x, y) are exactly 1 unit away from origin. So from Pyhtagoras’ Theorem
also: u = [ ] = [
orthogonal
x
y
⎢⎥
cosθ
sinθ
x2 + y2 = 1
orthonormal
⎡1 2 ⎤
B= 3 4
⎣5 6 ⎦
⎡1⎤ ⎡2⎤
Columns of B are: 3 and 4
⎣5⎦ ⎣6⎦
⎧⎡1⎤ ⎡2⎤⎫
Column Span of B will be Col(B) = span ⎨ 3 , 4 ⎬
⎩⎣ ⎦ ⎣ ⎦⎭
5 6
⎡1⎤ ⎡2 ⎤
This means that any vector in the column space can be written as: c 1 3 + c 2 4 for some
⎣5⎦ ⎣6 ⎦
scalars c 1 , c 2
linear dependent
A set of vectors is linearly dependent if at least one of the vectors in the set can be written as
a linear combination of the others. This means that the vectors do not add new independent
Example:
⎢⎪⎥
directions to the space they span.
⎡1 ⎤
⎣3 ⎦
⎡2⎤
v1 = 2 , v2 = 4
⎣6⎦
Since v 1 = 2.v 2 mean v 2 is just scaled version of v 1 . second column does not add a new
⎧⎡1⎤⎫
Col(A) = span ⎨ 2 ⎬
⎩⎣ ⎦⎭
3
⎡ 1 2⎤
dimension to the column space. So Column space of matrix A = 2 4 will be
⎣ 3 6⎦
linearly independent
It measures how much one vector extends in the direction of another. Results in a scalar (single
number). For two vectors a, b in R n
n
a ⋅ b = a 1 b 1 + a 2 b 2 +. . . +a n b n = ∑ a i b i
i=1
⎡1⎤ ⎡4 ⎤
Example: a = 2 and b = 5
⎣3⎦ ⎣6 ⎦
a ⋅ b = 1 ⋅ 4 + 2 ⋅ 5 + 3 ⋅ 6 = 4 + 10 + 18 = 32
Row-Echelon Form(REF)
is a simplified form of a matrix achieved through gaussian elimination. It makes solving systems
⎢⎥
of equations and computing rank easier. A matrix is in row-echelon form if:
5. All zero rows (if any) are at the bottom of the matrix.
6. Each leading (first nonzero) entry in a row is to the right of the leading entry in the row above.
7. All entries below a leading entry (pivot) are zero.
rank of matrix
is the dimension of the vector space generated (or spanned) by its columns. This also
represents number of linearly independent columns in the matrix. Rank can be calculate using
Gaussian Elimination and then, Count the number of nonzero rows after row reduction.
inner product
generalized dot product that works in higher dimensions and different vector spaces ⟨a, b⟩ = a T b
Example: a, b from above dot product example:
⎡4⎤
$⟨a, b⟩ = [1 2 3] 5 = 32
⎣6⎦
outer product
creates a matrix that represents all possible pairwise multiplications between two vectors. This
results in a transformation that captures area, projection, or tensor relationships in space
Example: a, b from above dot product example:
⎡1⎤ ⎡1 ⋅ 4 1 ⋅ 5 1 ⋅ 6⎤ ⎡ 4 5 6 ⎤
T
outer product of a,b = ab = 2 [4 5 6] = 2 ⋅ 4 2 ⋅ 5 2 ⋅ 6 = 8 10 12
⎣3⎦ ⎣3 ⋅ 4 3 ⋅ 5 3 ⋅ 6⎦ ⎣12 15 18⎦
singular matrix
Example: A = [
1
A[ ] = [
1
2(1)
3(1)
1 2
1 2
det(A) = (1 ⋅ 2) − (2 ⋅ 1) = 0
transformation matrix
]=[ ]
2
3
⎢⎥
a square matrix with a determinant of zero
] is singular matrix because it's square matrix and
square matrix
1
1
A matrix is square if it has the same number of rows and columns (n × n).
Example:
⎡1 0 0⎤
I3 = 0 1 0
⎣0 0 1⎦
symmetric matrix
A square matrix A is symmetric if it is equal to its transpose: A = A T
Example:
⎡1 2 3⎤
A= 2 5 4
⎣3 4 6⎦
diagonal matrix
transpose
⎡d 1
D= 0
⎣0
⎢⎥ 0
d2
0
0⎤
0
d3⎦
is an operation that flips the matrix over its diagonal, converting rows into columns and columns
into rows.
Example: For a matrix A of size m × n (where m is the number of rows and n is the number of
columns), the transpose of A, denoted as A T , is a matrix of size n × m, such that:
Example:
A=[
1 2
4 5
T
⎡1 4⎤
A = 2 5
⎣3 6⎦
3
6
]
8. Size: if A is m × n then A T will be n × m
9. Transpose of Transpose: (A T ) T = A
10. Transpose of Sum: (A + B) T = A T + B T
11. Transpose of Product: (AB) T = B T A T (note the reverse order)
12. Transpose of a Scalar Multiple: (cA) T = cA T
13. matrix A is symmetric if A = A T
inverse matrix
is a matrix A −1 such that when it is multiplied by the original matrix A, it yield lds the identity
matrix.
A ⋅ A −1 = A −1 ⋅ A = I
⎡1 0 . . . . 0 ⎤
0 1 .... 0
where I is n × n matrix
. . .... .
⎣0 0 . . . . 1 ⎦
invertible matrix
A matrix is invertible if there exists another matrix that "undoes" its transformation. In other
words, an invertible matrix A has an inverse matrix A −1 such that:
AA −1 = A −1 A = I
⎢⎥
A square matrix A (size n × n) is invertible (also called nonsingular) if and only if:
determinant
determinant of a matrix measures how a matrix transformation scales space. It gives a scaling
factor for areas (in 2D) and volumes (in 3D) when applying a linear transformation.
Example: A = [
a b
], det(A) = ad − bc
c d
Trivial: make v = 0
Non-trivial: (A − λI) = 0. Which mean det(A = λI) should be 0. Implies, (A − λI) is a
singular matrix.
4−λ −2
det [ ]=0
1 1−λ
(4 − λ)(1 − λ) − (−2)(1) = 0
λ 2 − 5λ + 6 = 0
Eigenvalues for A are λ 1 = 3 and λ 2 = 2
Find Eigenvectors:
For λ 1 = 3, Solve (A − 3I)x = 0 equals [ ] [ 1 ] = [ ] equals
4−3 −2 x 0
1 1 − 3 x2 0
] [ ] = [ ] solving this gives x 1 = 2x 2 . So if x 2 = k then x 1 = 2k so eigenvector is
1 −2 x 1 0
[
1 −2 x 2 0
[ ] which is scaled version of k [ ] thus v 1 = [ ]
2k 2 2
k 1 1
For λ 1 = 2, Solve (A − 2I)x = 0 solving gives v 2 = [ ]
1
1
eigenvectors
tells us Principal directions along which the transformation occurs.
An eigenvector of a matrix A is a special vector v that does not change direction when the
matrix acts on it i.e. linear transformation is applied. Instead, it only gets stretched or
compressed by a scalar factor λ (the eigenvalue)
Av = λv
This means that when you multiply A by v, the result is just a scaled version of v.
The direction of v remains the same, only its length changes
In above example eigenvectors will be:
2 1
Q=[ ]
1 1
eigenvalues
tells us how much the eigenvector is stretched or shrunk
eigendecomposed
EigenDecomposition is a method of breaking down a square matrix A into its eigenvalues and
eigenvectors. It allows us to express A in the form:
A = QΛQ −1
Diagonalization
covariance matrix
is a square matrix that captures the relationships (covariances) between multiple variables in a
dataset. It helps measure how much two or more variables change together.
For a dataset with n features (variables), the covariance matrix Σ is an n × n matrix where:
Σ ij = Cov(X i , X j )
where:
is a square matrix A that satisfies the following condition for all nonzero column vectors x:
x T Ax ≥ 0
x T Ax > 0
Spectral Theorem
if X is symmetric matrix, we can write:
X = QDQ T