Linear Algebra Review
Matrices and Vectors
Matrix: Rectangular array of numbers
Dimension of matrix: number of rows x number of columns
Refer to matrix of specific dimension:
R
2
×
3
\R^{2\times3}
R2×3
Refer to specific matrix elements of the matrix:
A
i
j
A_{ij}
Aij?("
i
,
j
i,j
i,j entry" in the
i
t
h
i^{th}
ith row,
j
t
h
j^{th}
jth column)
Vector: An n
×
\times
× 1 matrix
4-dimensional vector :
R
4
\R^{4}
R4
Refer elements in vector:
y
i
y_i
yi?=$i^{th} $ element
1-indexed vs 0-indexed
By conventional, use capital letters (such as A,B,C,X ) to refer matrices, and use lower cases (like a,d,c,x,y) to refer to either numbers or just raw numbers or scalars or vectors.
Addition and Scalar
Matrix addition and subtraction
Simply add or subtract each corresponding elements
The dimensions of two matrices to add or subtract must be the same
Scalar multiplication and division
Simply multiply or divide every element by the scalar value
Matrix Vector Multiplication
Details:
To get
y
i
y_i
yi?, multiply
A
′
s
A's
A′s
i
t
h
i^{th}
ith row with elements of vector
x
x
x, and add them up.
The result is a vector. The number of columns of the matrix must equal the number of rows of the vector.
An m x n matrix multiplied by an n x 1 vector results in an m x 1 vector.
prediction=DataMatrix
?
*
? parameters
Matrix Matrix Multiplication
Details:
The
i
t
h
i^{th}
ith column of the matrix
C
C
C is obtained by multiplying
A
A
A with the
i
t
h
i^{th}
ith column of
B
B
B.(for
i
i
i =1,2…o)
efficiently make prediction with lots of hypotheses
- To multiply two matrices, the number of columns of the first matrix must equal the number of rows of the second matrix.
Matrix Multiplication
Properties
-
not commutative Let
A
,
B
A,B
A,B be matrices, then in general,
A
×
B
=?
B
×
A
A\times B\not=B\times A
A×B?=B×A.(reversing the order of the matrices can change the dimension of outcome) -
enjoy associative property
A
×
B
×
C
A\times B\times C
A×B×C Let
D
=
B
×
C
D=B\times C
D=B×C. Compute
A
×
D
A\times D
A×D Let
E
=
A
×
B
E=A\times B
E=A×B. Compute
E
×
C
E\times C
E×C. all give the same answer.
Identity Matrix
Denoted
I
??
o
r
??
I
n
×
n
I\;or\;I_{n\times n}
IorIn×n?
- Has 1’s on the diagonal (upper left to lower right diagonal) and 0’s elsewhere.
When multiplied by any matrix of the same dimensions, results in the original matrix.
A
×
I
=
I
×
A
=
A
A\times I=I\times A=A
A×I=I×A=A (The
I
′
s
I's
I′s in the function above have different dimension)
The dimension of
I
I
I is implicit from the context.
Inverse and Transpose
Matrix Inverse
If
A
A
A is an m x m matrix (square matrix), and if it has an inverse,
A
A
?
1
=
A
?
1
A
=
I
AA^{-1}=A^{-1}A=I
AA?1=A?1A=I Matrices that don’t have an inverse is singular or degenerate.
Matrix Transpose
Let
A
A
A be an m x n matrix, and let
B
=
A
T
B=A^T
B=AT. Then
B
B
B is an n x m matrix, and
B
i
j
=
A
i
j
B_{ij}=A_{ij}
Bij?=Aij?
Transpose**
Let
A
A
A be an m x n matrix, and let
B
=
A
T
B=A^T
B=AT. Then
B
B
B is an n x m matrix, and
B
i
j
=
A
i
j
B_{ij}=A_{ij}
Bij?=Aij?
|