# Identity Matrix

• Identity matrix is always square (DxD).
• The D-dimensional identity matrix is the matrix that has 0s in every cell except the diagonal.
• $$I^T = I$$
• $$IA = AI = A$$

# Zero Matrix

• Zero matrix is the matrix of all 0s.
• $$0^T = 0$$
• $$0A = A0 = 0$$

# Matrix Properties

• Matrix A is diagonal if all of its off-diagonal elements are zero. That is to say, Identity matrix and zero matrix are both diagonal.
• Trace of matrix (tr(A)): $$tr(A) = \sum^D_{d=1} A_{d,d}$$
• Determinant: $$det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad – bc$$
• Rank: The column rank of A is the dimension of the column space of A, while the row rank of A is the dimension of the row space of A. The rank number is the number of linearly independent rows or columns.

# Matrix Transpose

• $$(A^T)^T = A$$
• $$(A+B)^T = A^T + B^T$$
• $$(AB)^T = B^TA^T$$
• $$(A^T)^{-1} = (A^{-1})^T$$

# Matrix Inverse

• Non-square matrices (m-by-n matrices for which m ≠ n) do not have an inverse. That is to say, all invertible matrix is square matrix.
• Commutativity: $$A^{-1}A = AA^{-1} = I$$
• Scalar multiplication: $$(aA)^{-1} = a^{-1}A^{-1}$$
• Transposition: $$(A^T)^{-1} = (A^{-1})^T$$
• Product: $$(AB)^{-1}=B^{-1}A^{-1}$$
• Some matrices are square but not invertible. They are singular matrix and its determinant is zero.

### example

There is a way to obtain the inverse matrix thru determinant. Using this, we can find out there is matrix that is square but not invertible.

And it makes sense … look at the numbers: the second row is just double the first row, and does not add any new information.

# Vector

Suppose we have $$u = \begin{bmatrix}1 \\ 2 \\ 3 \end{bmatrix}$$ and $$v = \begin{bmatrix}4 \\ 5 \\ 6 \end{bmatrix}$$, the vector inner product is:

$$u^Tv= \begin{bmatrix}1 & 2 & 3 \end{bmatrix}\begin{bmatrix}4 \\ 5 \\ 6 \end{bmatrix} = 1*4 + 2*5 + 3*6 = 32$$

# Matrix Multiplication

• You can multiply two matrices if, and only if, the number of columns in the first matrix equals the number of rows in the second matrix.

• matrix multiplication is not commutative(ie. AB != BA)
• Given the rules of matrix multiplication, we cannot multiply two vectors when they are both viewed as column matrices. If we try to multiply an n×1 matrix with another n×1 matrix, this product is not defined. To rectify this problem, we can take the transpose of the first vector, turning it into a 1×n row matrix. The interesting part is $$x^{T}y = x \cdot y$$

Use demo/demo public access