Matrix Formulas and Notes

Adding and Subtracting Matrices

Matrices can only be added or subtracted if they have the same dimension.
Addition or subtraction is achieved by adding or subtracting corresponding elements.

Example
A = \left(\begin{matrix} 8 & 5 \\ 6 & 7 \end{matrix}\right) B = \left(\begin{matrix} 3 & 1 \\ 7 & 2 \end{matrix}\right)

A + B = \left(\begin{matrix} 8+3 & 5+1 \\ 6+7 & 7+2 \end{matrix}\right)
= \left(\begin{matrix} 11 & 6 \\ 13 & 9 \end{matrix}\right)

A - B = \left(\begin{matrix} 8-3 & 5-1 \\ 6-7 & 7-2 \end{matrix}\right)
= \left(\begin{matrix} 5 & 4 \\ -1 & 5 \end{matrix}\right)

Scalar Multiplication

Every element of the matrix is multiplied by a value.

Example
A = \left(\begin{matrix} 8 & 5 \\ 6 & 7 \end{matrix}\right)
4A = 4 \left(\begin{matrix} 8 & 5 \\ 6 & 7 \end{matrix}\right)
= \left(\begin{matrix} 4 \cdot 8 & 4 \cdot 5 \\ 4 \cdot 6 & 4 \cdot 7 \end{matrix}\right)

= \left(\begin{matrix} 32 & 20 \\ 24 & 28 \end{matrix}\right)

Matrix by Matrix Multiplication

Given matrices A and B. You can multiply A and B only if the number of columns of matrix A are equal to the number of rows of matrix B.
Multiply each value of each row of matrix A with corresponding values in the columns of matrix B.
\left(\begin{matrix} a & b & c \\ d & e & f \end{matrix}\right) \left(\begin{matrix} u & v \\ w & x \\ y & z \end{matrix}\right) = \left(\begin{matrix} au+bw+cy & av+bx+cz \\ du+ew+fy & dv+ex+fz \end{matrix}\right)
Example
AB = \left(\begin{matrix} 2 & -3 & 9 \\ 5 & 4 & 7 \end{matrix}\right) \left(\begin{matrix} 8 & 10 \\ 2 & 3 \\ 1 & 2 \end{matrix}\right)
= \left(\begin{matrix} 2 \cdot 8 + -3 \cdot 2 + 9 \cdot 1 & 2 \cdot 10 + -3 \cdot 3 + 9 \cdot 2 \\ 5 \cdot 8 + 4 \cdot 2 + 7 \cdot 1 & 5 \cdot 10 + 4 \cdot 3 + 7 \cdot 2 \end{matrix}\right)
= \left(\begin{matrix} 19 & 29 \\ 55 & 76 \end{matrix}\right)

Please Note
AB \ne BA
Example
\left(\begin{matrix} 0 & 1 \\ 0 & 0 \end{matrix}\right) \left(\begin{matrix} 0 & 0 \\ 1 & 0 \end{matrix}\right) = \left(\begin{matrix} 1 & 0 \\ 0 & 0 \end{matrix}\right)
and
\left(\begin{matrix} 0 & 0 \\ 1 & 0 \end{matrix}\right) \left(\begin{matrix} 0 & 1 \\ 0 & 0 \end{matrix}\right) = \left(\begin{matrix} 0 & 0 \\ 0 & 1 \end{matrix}\right)

Transpose of a Matrix

A^{T}, the transpose of matrix A is a matrix which is formed by interchanging rows and columns of matrix A.
Example
A = \left(\begin{matrix} 5 & 3 & 9 \\ 2 & 1 & 8 \end{matrix}\right)
A is a 2×3 matrix.
A^{T} is a 2×3 matrix.
Interchange rows and columns to get the transpose.
A^{T} = \left(\begin{matrix} 5 & 2 \\ 3 & 1 \\ 9 & 8 \end{matrix}\right)

Powers of a Matrix

A^{n}, is defined as n copies of matrix A.
Example
A = \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right)
A^{2} = \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right)
A^{3} = \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right)
A^{4} = \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right) \left(\begin{matrix} 5 & 2 \\ 3 & 1 \end{matrix}\right)

Determinant of a Matrix

|A| is a used to symbolize the determinant of matrix A.
Only a square matrix can have a determinant.

Finding the determinant

2×2 Matrix
A = \left(\begin{matrix} a & b \\ c & d \end{matrix}\right)
|A| = ad-bc
Example
A = \left(\begin{matrix} 5 & 3 \\ 2 & 8 \end{matrix}\right)
|A| = (5)(8)-(3)(2) = 34

3×3 Matrix
A = \left(\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}\right)
|A| = a(ei - fh) - b(di-fg) + c(dh-eg)
The image below shows how this formula is calculated.

Example
A = \left(\begin{matrix} 5 & 3 & 4 \\ 7 & 2 & 6 \\ 2 & 1 & 9 \end{matrix}\right)
|A| = 5((2)(9)-(6)(1)) - 3((7)(9)-(6)(2)) + 4((7)(1)-(2)(2)) = -81

4×4 Matrix
A = \left(\begin{matrix} a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ m & n & o & p \end{matrix}\right)
|A| = a \left|\begin{matrix} f & g & h \\ j & k & l \\ n & o & p \end{matrix}\right| - b \left|\begin{matrix} e & g & h \\ i & k & l \\ m & o & p \end{matrix}\right| + c \left|\begin{matrix} e & f & h \\ i & j & l \\ m & n & p \end{matrix}\right| - d \left|\begin{matrix} e & f & g \\ i & j & k \\ m & n & o \end{matrix}\right|

Inverse of a Matrix

The inverse of a matrix A is a matrix A^{-1} such that AA^{-1}=I . I is the identity matrix.
Please Note
1. Only square matrices can have an inverse. 2. If the determinant of a matrix is 0, that matrix has no inverse.

Finding the Inverse of a Matrix

One method of finding the inverse is to use Gauss-Jordan elimination to transform [A|I] to [I|A^{-1}]
Example
A = \left(\begin{matrix} 8 & 5 \\ 6 & 4 \end{matrix}\right)
Find inverse of A.
\left[ \begin{array}{cc|cc} 8 & 5 & 1 & 0 \\ 6 & 4 & 0 & 1 \end{array} \right]
R_{1} \rightarrow \frac{1}{8}R_{1}
\left[ \begin{array}{cc|cc} 1 & \frac{5}{8} & \frac{1}{8} & 0 \\ 6 & 4 & 0 & 1 \end{array} \right]
R_{2} \rightarrow R_{2}- 6R_{1}
\left[ \begin{array}{cc|cc} 1 & \frac{5}{8} & \frac{1}{8} & 0 \\ 0 & \frac{1}{4} & -\frac{3}{4} & 1 \end{array} \right]
R_{2} \rightarrow 4R_{2}
\left[ \begin{array}{cc|cc} 1 & \frac{5}{8} & \frac{1}{8} & 0 \\ 0 & 1 & -3 & 4 \end{array} \right]
R_{1} \rightarrow R_{2} - \frac{5}{8}R_{1}
\left[ \begin{array}{cc|cc} 1 & 0 & 2 & - \frac{5}{2} \\ 0 & 1 & -3 & 4 \end{array} \right]
A^{-1} = \left(\begin{matrix} 2 & - \frac{5}{2} \\ -3 & 4 \end{matrix}\right)