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: R2×3\R^{2\times3}R2×3
Refer to specific matrix elements of the matrix: AijA_{ij}Aij("i,ji,ji,j entry" in the ithi^{th}ith row, jthj^{th}jth column)
Vector: An n×\times× 1 matrix
4-dimensional vector :R4\R^{4}R4
Refer elements in vector: yiy_iyi=$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 yiy_iyi, multiply A′sA'sA′s ithi^{th}ith row with elements of vector xxx, 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 ithi^{th}ith column of the matrix CCC is obtained by multiplying AAA with the ithi^{th}ith column of BBB.(for iii =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,BA,BA,B be matrices, then in general, A×B≠B×AA\times B\not=B\times AA×B=B×A.(reversing the order of the matrices can change the dimension of outcome)
-
enjoy associative property
A×B×CA\times B\times CA×B×C
Let D=B×CD=B\times CD=B×C. Compute A×DA\times DA×D
Let E=A×BE=A\times BE=A×B. Compute E×CE\times CE×C.
all give the same answer.
Identity Matrix
Denoted I or In×nI\;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′sI'sI′s in the function above have different dimension)
The dimension of III is implicit from the context.
Inverse and Transpose
Matrix Inverse
If AAA is an m x m matrix (square matrix), and if it has an inverse,
AA−1=A−1A=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 AAA be an m x n matrix, and let B=ATB=A^TB=AT. Then BBB is an n x m matrix, and
Bij=Aij
B_{ij}=A_{ij}
Bij=Aij
Transpose**
Let AAA be an m x n matrix, and let B=ATB=A^TB=AT. Then BBB is an n x m matrix, and
Bij=Aij
B_{ij}=A_{ij}
Bij=Aij