Matrix and Vector
What is Matrix and Vector
Matrix: Rectangular array of numbers.
:一个2乘3的矩阵
Dimension of matrix: number of rows x number of clumns.
Matrix Elements(entries of matrix):
Vector: An n x 1 matrix.
n dimension vector
1-indexed vs 0-indexed
一般使用1-indexed 在机器学习中会使用0-indexed 。
Addition and Scalar Multiplication
Matrix Addition(or Subtration)
只有相同维度的矩阵可以相加。新的矩阵与原来维度相同,仅仅是对应部分的相加。
Scalar(real nmuber) Multiplication(or division)
实数和矩阵对应位置的数相乘得到新的矩阵。
Matrix-vector multiplication
mn matrix multiply n1 matrix equals a m-dimensional vector
To get , multiply A's row with elemets of vector x, and add them up.
We can use matrix and vector to calculate prediction at the same time or with only one line code.
Matrix-Matrix multiplication
mn matrix multiply no equals a mo matrix.
The column of the matrixC is obtained by multiplying A with the column of B.
Matrix multiplication properties
- not commutative(不满足交换律)
- associative(结合律)
Identity Matrix:
Denoted I(or ).
= =
Informally:
对角线上都是1,其他位置都是0
For any matrix A:
Inverse and Transpose
Not all number have an inverse.
Matrix inverse: If A is an mm matrix, and if it has an inverse,
Square matrix: mm matrix.
A matirx which have inverse must be a square matrix.
Matrix that don't have an inverse are "singular"(奇异矩阵) or "degenerate"(退化矩阵).
Matrix Transpose:Let A be an matrix, and let . Then B is an matrix, and .