Home

Matrices

\[\quad C \\\] \[R \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}\]

Rows($R$) and columns($C$) all start at 1 and when specifying the size of a matrix it takes the form of $R$ x $C$.

Adding/Subtracting:

Example:

\[\begin{array}{} \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix}\quad + & \begin{bmatrix} 5 & 6 \\ 7 & 8 \\ \end{bmatrix}\quad = & \begin{bmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \\ \end{bmatrix}\quad = & \begin{bmatrix} 6 & 8 \\ 10 & 12 \\ \end{bmatrix} \end{array}\] \[\begin{array}{} \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix}\quad - & \begin{bmatrix} 5 & 6 \\ 7 & 8 \\ \end{bmatrix}\quad = & \begin{bmatrix} 1-5 & 2-6 \\ 3-7 & 4-8 \\ \end{bmatrix}\quad = & \begin{bmatrix} -4 & -4 \\ -4 & -4 \\ \end{bmatrix} \end{array}\]

Multiplying:

\[\text{1st matrix} * \text{2nd matrix}\] \[\begin{array}{} \text{Rows from 1st matrix} \left[ \begin{array}{c} \left. \begin{array}{c} \text{ \ row } 1 (\text{col } 1 ) \\ \text{ \ row } 1 (\text{col } 2 ) \\ \text{ \ row } 1 (\text{col } 3 ) \\ \end{array} \right] \\ \text{row } 2 (\text{col } 1) \\ \text{row } 2 (\text{col } 2) \\ \text{row } 2 (\text{col } 3) \\ \text{row } 3 (\text{col } 1) \\ \text{row } 3 (\text{col } 2) \\ \text{row } 3 (\text{col } 3) \\ \vdots \end{array} \right. \text{Columns from 2nd matrix} \end{array}\]

Example of multiplying by a constant:

\[4 * \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix}\quad = \quad \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix} * 4\quad = \quad \begin{bmatrix} 4(1) & 4(2) \\ 4(3) & 4(4) \\ \end{bmatrix}\quad = \quad \begin{bmatrix} 4 & 8 \\ 12 & 16 \\ \end{bmatrix}\]

Example of multiplying 2 matrices:

\[2\text{x}3\quad A = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ \end{bmatrix}\qquad\quad 3\text{x}4\quad B = \begin{bmatrix} 7 & 8 & 9 & 10\\ 11 & 12 & 13 & 14\\ 15 & 16 & 17 & 18\\ \end{bmatrix}\] \[A * B \ne B * A\] \[A * B = \begin{bmatrix} 1(7)+2(11)+3(15) & 1(8)+2(12)+3(16) & 1(9)+2(13)+3(17) & 1(10)+2(14)+3(18)\\ 4(7)+5(11)+6(15) & 4(8)+5(12)+6(16) & 4(9)+5(13)+6(17) & 4(10)+5(14)+6(18)\\ \end{bmatrix}\] \[\qquad\text{ \ } =\begin{bmatrix} 74 & 80 & 86 & 92\\ 173 & 188 & 203 & 218\\ \end{bmatrix}\]

Examples of scaling and rotating:

\[\qquad\text{ \ } =\begin{bmatrix} 0 & -1 \\ 1 & 0 \\ \end{bmatrix}\] \[\qquad\text{ \ } =\begin{bmatrix} 2 & 0 \\ 0 & 2 \\ \end{bmatrix}\]

Inverse:

$A^{-1} = \frac{1}{\text{determinant}(A)} * \text{adjugate}(A)$

With $A$ being the matrix and $A^{-1}$ being the inverse.

Steps:

  1. Get the adjugate:
    1. Get the matrix of minors
      1. Cross out each position’s row and column and create a matrix of matrices.
        • Ex:
\[\begin{bmatrix} \underline{1} & 0 & 1 \\ 0 & 2 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix} \rightarrow \begin{bmatrix} \cancel{1} & \cancel{0} & \cancel{1} \\ \cancel{0} & 2 & 1 \\ \cancel{1} & 1 & 1 \\ \end{bmatrix} \rightarrow \begin{bmatrix} 2 & 1 \\ 1 & 1 \\ \end{bmatrix}\] \[\begin{bmatrix} 1 & \underline{0} & 1 \\ 0 & 2 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix} \rightarrow \begin{bmatrix} \cancel{1} & \cancel{0} & \cancel{1} \\ 0 & \cancel{2} & 1 \\ 1 & \cancel{1} & 1 \\ \end{bmatrix} \rightarrow \begin{bmatrix} 0 & 1 \\ 1 & 1 \\ \end{bmatrix}\] \[\downarrow\] \[\begin{bmatrix} \begin{bmatrix} 2 & 1 \\ 1 & 1 \\ \end{bmatrix} & \begin{bmatrix} 0 & 1 \\ 1 & 1 \\ \end{bmatrix} & \dots \\ \dots & \dots & \dots \\ \dots & \dots & \dots \\ \end{bmatrix}\]
      1. Repeat recursively until you are left with only a 2×2 matrices.
      2. Take the determinant of the 2×2 matrices.
        • The left diagonal multiplied together minus the right diagonal multiplied together.
\[\text{Left diagonal} = \begin{bmatrix} \underline{\space\space} & \space\space \\ \space\space & \underline{\space\space} \\ \end{bmatrix} \qquad \text{Right diagonal} = \begin{bmatrix} \space\space & \underline{\space\space} \\ \underline{\space\space} & \space\space \\ \end{bmatrix}\] \[\begin{bmatrix} 3 & 5 \\ -7 & 2 \\ \end{bmatrix}\] \[(3 * 2) - (5 * -7) = 41\]
    1. Get the matrix of cofactors
\[\begin{bmatrix} + & - \\ - & + \\ \end{bmatrix} \begin{bmatrix} + & - & + \\ - & + & - \\ + & - & + \\ \end{bmatrix} \begin{bmatrix} + & - & + & - \\ - & + & - & + \\ + & - & + & - \\ - & + & - & + \\ \end{bmatrix} \dots\] \[\begin{bmatrix} 2 & 1 \\ 1 & 1 \\ \end{bmatrix} * \begin{bmatrix} + & - \\ - & + \\ \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ -1 & 1 \\ \end{bmatrix}\]
    1. Get the adjugate
\[\begin{bmatrix} \underline{3} & 5 & -7 \\ 2 & \underline{1} & 2 \\ 3 & 4 & \underline{5} \\ \end{bmatrix} \rightarrow \begin{bmatrix} 3 & 2 & 3 \\ 5 & 1 & 4 \\ -7 & 2 & 5 \\ \end{bmatrix}\]
  1. Get the determinant:
\[A = \begin{bmatrix} 1 & 1 & 3 \\ 2 & 3 & 4 \\ 7 & 4 & 5 \\ \end{bmatrix} \qquad \text{adj} = \begin{bmatrix} -1 & 7 & -5 \\ 18 & -16 & 2 \\ -13 & 3 & 1 \\ \end{bmatrix}\] \[(1 * -1) + (1 * 7) + (3 * -5) = -9\]
  1. Plug determinant and adjugate into the equation.

Example:

\[A = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 2 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}\] \[\begin{bmatrix} \begin{bmatrix} 2 & 1 \\ 1 & 1 \\ \end{bmatrix} & \begin{bmatrix} 0 & 1 \\ 1 & 1 \\ \end{bmatrix} & \begin{bmatrix} 0 & 2 \\ 1 & 1 \\ \end{bmatrix} \\ \begin{bmatrix} 0 & 1 \\ 1 & 1 \\ \end{bmatrix} & \begin{bmatrix} 1 & 1 \\ 1 & 1 \\ \end{bmatrix} & \begin{bmatrix} 1 & 0 \\ 1 & 1 \\ \end{bmatrix} \\ \begin{bmatrix} 0 & 1 \\ 2 & 1 \\ \end{bmatrix} & \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ \end{bmatrix} & \begin{bmatrix} 1 & 0 \\ 0 & 2 \\ \end{bmatrix} \end{bmatrix}\] \[\text{Matrix of minors} = \begin{bmatrix} 1 & -1 & -2 \\ -1 & 0 & 1 \\ -2 & 1 & 2 \\ \end{bmatrix}\] \[\text{Matrix of cofactors} = \begin{bmatrix} 1 & -1 & -2 \\ -1 & 0 & 1 \\ -2 & 1 & 2 \\ \end{bmatrix} * \begin{bmatrix} + & - & + \\ - & + & - \\ + & - & + \\ \end{bmatrix} = \begin{bmatrix} 1 & 1 & -2 \\ 1 & 0 & -1 \\ -2 & -1 & 2 \\ \end{bmatrix}\] \[\text{adjugate} = \begin{bmatrix} 1 & 1 & -2 \\ 1 & 0 & -1 \\ -2 & -1 & 2 \\ \end{bmatrix}\] \[\text{determinant} = (1 * 1) + (0 * 1) + (1 * -2) = -1\] \[A^{-1} = \frac{1}{-1} * \begin{bmatrix} 1 & 1 & -2 \\ 1 & 0 & -1 \\ -2 & -1 & 2 \\ \end{bmatrix} = \begin{bmatrix} -1 & -1 & 2 \\ -1 & 0 & 1 \\ 2 & 1 & -2 \\ \end{bmatrix}\] \[3x-2y=1\] \[-x+4y=3\] \[\begin{bmatrix} 3 & -2 \\ -1 & 4 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ \end{bmatrix}= \begin{bmatrix} 1 \\ 3 \\ \end{bmatrix}\] \[A = \begin{bmatrix} 3 & -2 \\ -1 & 4 \\ \end{bmatrix} \rightarrow \begin{bmatrix} 4 & -1 \\ -2 & 3 \\ \end{bmatrix} * \begin{bmatrix} + & - \\ - & + \\ \end{bmatrix} = \begin{bmatrix} 4 & 1 \\ 2 & 3 \\ \end{bmatrix} \rightarrow \begin{bmatrix} 4 & 2 \\ 1 & 3 \\ \end{bmatrix}\] \[(3*4) - (-1 * -2) = 10\] \[A^{-1} = \frac{1}{10} * \begin{bmatrix} 4 & 2 \\ 1 & 3 \\ \end{bmatrix} = \begin{bmatrix} 2/5 & 1/5 \\ 1/10 & 3/10 \\ \end{bmatrix}\] \[\begin{bmatrix} 2/5 & 1/5 \\ 1/10 & 3/10 \\ \end{bmatrix} * \begin{bmatrix} 1 \\ 3 \\ \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \\ \end{bmatrix}\] \[x = 1 \qquad y = 1\]

Row Echelon Form:

Example:

\[x + y - z = -2\] \[2x - y + z = 5\] \[-x +2y +2z = 1\] \[\left[ \begin{array}{c|c} \begin{matrix} 1 & 1 & -1 \\ 2 & -1 & 1 \\ -1 & 2 & 2 \end{matrix} & \begin{matrix} -2 \\ 5 \\ 1 \end{matrix} \end{array} \right] \begin{matrix} \\ \\ \xrightarrow{R_1 + R_3}{} \end{matrix} \left[ \begin{array}{c|c} \begin{matrix} 1 & 1 & -1 \\ 2 & -1 & 1 \\ 0 & 3 & 1 \end{matrix} & \begin{matrix} -2 \\ 5 \\ -1 \end{matrix} \end{array} \right] \begin{matrix} \\ \xrightarrow{-2 R_1 + R_2}{}\\ \\ \end{matrix} \left[ \begin{array}{c|c} \begin{matrix} 1 & 1 & -1 \\ 0 & -3 & 3 \\ 0 & 3 & 1 \end{matrix} & \begin{matrix} -2 \\ 9 \\ -1 \end{matrix} \end{array} \right] \begin{matrix} \\ \\ \xrightarrow{R_2 + R_3}{} \end{matrix}\] \[\left[ \begin{array}{c|c} \begin{matrix} 1 & 1 & -1 \\ 0 & -3 & 3 \\ 0 & 0 & 4 \end{matrix} & \begin{matrix} -2 \\ 9 \\ 8 \end{matrix} \end{array} \right] \begin{matrix} \\ \xrightarrow{-1/3 * R_2}{} \\ \xrightarrow{1/4 * R_3}{} \end{matrix} \left[ \begin{array}{c|c} \begin{matrix} 1 & 1 & -1 \\ 0 & 1 & -1 \\ 0 & 0 & 1 \end{matrix} & \begin{matrix} -2 \\ -3 \\ 2 \end{matrix} \end{array} \right]\] \[x + y - z = -2\] \[y-z=-3\] \[z=2\] \[y=-1 \text{ and } x=1\]

Eigenvectors and Eigenvalues:

\[A \vec{v} = \lambda \vec{v}\]

Calculating the Eigenvectors and Eigenvalues:

\[A \vec{v} - \lambda \vec{v} = \vec{0}\] \[A \vec{v} - \lambda I \vec{v} = \vec{0}\] \[(A - \lambda I) \vec{v} = \vec{0}\] \[(A - \lambda I)^{-1} (A - \lambda I) \vec{v} = (A - \lambda I)^{-1} \vec{0}\] \[(A - \lambda I)^{-1} (A - \lambda I) = I \text{\quad and \quad} (A - \lambda I)^{-1} \vec{0} = \vec{0}\] \[I \vec{v} \ne \vec{0}\] \[\text{determinant}(A - \lambda I) = 0\]

Example:

\[.8(h_1) + .1(z_1) = h_2\] \[.2(h_1) + .9(z_1) = z_2\] \[\begin{bmatrix} .8 & .1 \\ .2 & .9 \\ \end{bmatrix}\] \[\text{determinant} \left( \begin{bmatrix} .8 & .1 \\ .2 & .9 \\ \end{bmatrix} - \lambda \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} \right) = 0\] \[\text{determinant} \left( \begin{bmatrix} .8 & .1 \\ .2 & .9 \\ \end{bmatrix} - \begin{bmatrix} \lambda & 0 \\ 0 & \lambda \\ \end{bmatrix} \right) = \text{determinant} \left( \begin{bmatrix} .8-\lambda & .1 \\ .2 & .9-\lambda \\ \end{bmatrix} \right) =\] \[((.8-\lambda)(.9-\lambda)) - (.2 * .1) = \lambda^2 - 1.7\lambda + 0.7 = 0\] \[\lambda_1 = 1 \text{\quad and \quad} \lambda_2 = .7\] \[\begin{bmatrix} .8-1 & .1 \\ .2 & .9-1 \\ \end{bmatrix} = \begin{bmatrix} -.2 & .1 \\ .2 & -.1 \\ \end{bmatrix} \begin{matrix} \\ \xrightarrow{R_1 + R_2}{} \\ \end{matrix} \begin{bmatrix} -.2 & .1 \\ 0 & 0 \\ \end{bmatrix}\] \[\begin{bmatrix} -.2 & .1 \\ 0 & 0 \\ \end{bmatrix} \begin{bmatrix} h \\ z \\ \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ \end{bmatrix}\] \[-0.2h + .1z = 0\] \[h = 1 \text{\quad and \quad} z = 2\] \[\vec{v_1} = \begin{bmatrix} 1 \\ 2 \\ \end{bmatrix}\] \[\begin{bmatrix} .8-.7 & .1 \\ .2 & .9-.7 \\ \end{bmatrix} = \begin{bmatrix} .1 & .1 \\ .2 & .2 \\ \end{bmatrix} \begin{matrix} \\ \xrightarrow{-2R_1 + R_2}{} \\ \end{matrix} \begin{bmatrix} .1 & .1 \\ 0 & 0 \\ \end{bmatrix}\] \[\begin{bmatrix} .1 & .1 \\ 0 & 0 \\ \end{bmatrix} \begin{bmatrix} h \\ z \\ \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ \end{bmatrix}\] \[.1h + .1z = 0\] \[h = 1 \text{\quad and \quad} z = -1\] \[\vec{v_2} = \begin{bmatrix} 1 \\ -1 \\ \end{bmatrix}\]

Dividing:

Dot product:

Cross product:

Kernels/Image Filters: