Matrices Notes

Matrices

Definition

  • A matrix is a rectangular arrangement of numbers into rows and columns.
  • The smallest matrix is a one by one.
  • Matrices are represented by uppercase letters (e.g., matrix A).

Dimensions (Size)

  • Determined by the number of rows and columns, in that order (rows x columns).
  • Example: A matrix with 2 rows and 3 columns has a dimension of 2x3 (said "two by three").
  • Rows by columns.

Square Matrix

  • A matrix with the same number of rows and columns.

Matrix Element

  • An entry within the matrix.
  • Identified by the row and column in which it appears.
  • Notation: lowercase letter of the matrix with subscripts indicating row and column (e.g., f11f_{11}).
    • If matrix F contains element 1 in row 1, column 1, then f11=1f_{11} = 1.

Examples of Matrix Size

  • Matrix A (2 rows, 3 columns): Size is 2x3.
  • Matrix B (2 rows, 2 columns): Size is 2x2 (a square matrix).
  • Matrix C (5 rows, 3 columns): Size is 5x3.
  • Matrix D (4 rows, 1 column): Size is 4x1.
  • A matrix must have at least one row or one column.

Element Identification by Location

  • Matrix A = [2amp;1 7amp;3 ]\begin{bmatrix} 2 & 1 \ 7 & 3 \ \end{bmatrix}
    • 2 is a11a_{11}
    • 1 is a12a_{12}
    • 7 is a21a_{21}
    • 3 is a22a_{22}

Example

  • Matrix B (3 rows, 4 columns): A 3x4 matrix.
  • Identify the element b32b_{32}.
    • In matrix B, find the element in row 3, column 2 (e.g., 10).
  • b14b_{14} means row 1, column 4 (e.g., 4).
  • b23b_{23} means row 2, column 3 (e.g., 7).
  • Finding the location of 8: b<em>24b<em>{24}. Finding the location of 9: b</em>31b</em>{31}. Finding the location of 3: b13b_{13}.

Matrix Operations

  • Addition, subtraction, and multiplication.

Matrix Addition and Subtraction

  • Matrices can be added or subtracted if they have the same dimension (same number of rows and columns).
  • This is done by adding or subtracting their corresponding elements (same row and column position).

Example A

  • Adding a 4x2 matrix to another 4x2 matrix.
  • [1amp;6 5amp;2 5amp;1 4amp;4 ]+[3amp;5 4amp;1 1amp;1 4amp;4 ]=[4amp;11 9amp;3 4amp;2 8amp;8 ]\begin{bmatrix} -1 &amp; 6 \ 5 &amp; 2 \ -5 &amp; -1 \ 4 &amp; -4 \ \end{bmatrix} + \begin{bmatrix} -3 &amp; 5 \ 4 &amp; 1 \ 1 &amp; -1 \ 4 &amp; -4 \ \end{bmatrix} = \begin{bmatrix} -4 &amp; 11 \ 9 &amp; 3 \ -4 &amp; -2 \ 8 &amp; -8 \ \end{bmatrix}

Example B

  • Adding a 2x4 matrix to another 2x4 matrix.
  • [5amp;2amp;1amp;1 3amp;5amp;6amp;2 ]+[6amp;6amp;5amp;4 0amp;2amp;2amp;4 ]=[1amp;4amp;6amp;3 3amp;3amp;8amp;6 ]\begin{bmatrix} 5 &amp; -2 &amp; -1 &amp; -1 \ -3 &amp; -5 &amp; 6 &amp; 2 \ \end{bmatrix} + \begin{bmatrix} -6 &amp; 6 &amp; -5 &amp; 4 \ 0 &amp; 2 &amp; 2 &amp; 4 \ \end{bmatrix} = \begin{bmatrix} -1 &amp; 4 &amp; -6 &amp; 3 \ -3 &amp; -3 &amp; 8 &amp; 6 \ \end{bmatrix} .

Example C

  • Adding a 3x2 matrix to a 2x3 matrix is not possible (DNE - Does Not Exist) because the dimensions do not match.

Example D

  • Subtracting a 3x3 matrix from another 3x3 matrix.
  • [5amp;4amp;3 8amp;19amp;12 6amp;1amp;8 ][2amp;3amp;9 12amp;24amp;7 1amp;5amp;7 ]=[3amp;1amp;6 20amp;5amp;19 5amp;4amp;1 ]\begin{bmatrix} 5 &amp; 4 &amp; -3 \ -8 &amp; 19 &amp; 12 \ 6 &amp; -1 &amp; 8 \ \end{bmatrix} - \begin{bmatrix} 2 &amp; 3 &amp; -9 \ 12 &amp; 24 &amp; -7 \ 1 &amp; -5 &amp; 7 \ \end{bmatrix} = \begin{bmatrix} 3 &amp; 1 &amp; 6 \ -20 &amp; -5 &amp; 19 \ 5 &amp; 4 &amp; 1 \ \end{bmatrix}

Example E

  • Subtracting a 2x4 matrix from another 2x4 matrix.
  • [2amp;4amp;1amp;2 1amp;3amp;6amp;2 ][0amp;3amp;6amp;0 3amp;1amp;2amp;3 ]=[2amp;1amp;5amp;2 4amp;2amp;8amp;1 ]\begin{bmatrix} 2 &amp; 4 &amp; -1 &amp; -2 \ -1 &amp; -3 &amp; -6 &amp; -2 \ \end{bmatrix} - \begin{bmatrix} 0 &amp; 3 &amp; -6 &amp; 0 \ 3 &amp; -1 &amp; 2 &amp; -3 \ \end{bmatrix} = \begin{bmatrix} 2 &amp; 1 &amp; 5 &amp; -2 \ -4 &amp; -2 &amp; -8 &amp; 1 \ \end{bmatrix}

Scalar Multiplication

  • Multiplying a number (scalar) by a matrix.
  • The size of the matrix does not matter.
  • Multiply the scalar by every element within the matrix.

Example F

  • -5 multiplied by a 2x2 matrix.
  • 5[2amp;3 5amp;6 ]=[10amp;15 25amp;30 ]-5 \begin{bmatrix} 2 &amp; -3 \ 5 &amp; -6 \ \end{bmatrix} = \begin{bmatrix} -10 &amp; 15 \ -25 &amp; 30 \ \end{bmatrix}

Example G

  • 1/4 multiplied by a 3x2 matrix.
  • 14[12amp;4 0amp;8 20amp;16 ]=[3amp;1 0amp;2 5amp;4 ]\frac{1}{4} \begin{bmatrix} -12 &amp; 4 \ 0 &amp; -8 \ 20 &amp; -16 \ \end{bmatrix} = \begin{bmatrix} -3 &amp; 1 \ 0 &amp; -2 \ 5 &amp; -4 \ \end{bmatrix}

Example H

  • Combining scalar multiplication with addition.
  • 2A+3B2A + 3B, where A and B are 2x2 matrices.
  • 2[1amp;4 3amp;0 ]+3[2amp;3 5amp;6 ]=[4amp;1 21amp;18 ]2\begin{bmatrix} -1 &amp; 4 \ 3 &amp; 0 \ \end{bmatrix} + 3\begin{bmatrix} 2 &amp; -3 \ 5 &amp; -6 \ \end{bmatrix} = \begin{bmatrix} 4 &amp; -1 \ 21 &amp; -18 \ \end{bmatrix}

Matrix Multiplication

  • A matrix times a matrix.
  • The columns of the first matrix must match the rows of the second matrix in order to multiply.
  • If the dimensions are (m×n)\left(m \times n\right)\ and (n×p)\left(n \times p\right), the resulting matrix size will be (m×p)\left(m \times p\right).

Algorithm

  • Row by column multiplication with addition.
  • Example: A (2x3) multiplied by B (3x2) results in a 2x2 matrix.
  • [a<em>11a</em>12amp;a<em>13 a</em>21amp;a<em>22a</em>23 ][b<em>11b</em>12 b<em>21b</em>22 b<em>31b</em>32 ]=[(a<em>11b</em>11+a<em>12b</em>21+a<em>13b</em>31)amp;(a<em>11b</em>12+a<em>12b</em>22+a<em>13b</em>32) (a<em>21b</em>11+a<em>22b</em>21+a<em>23b</em>31)amp;(a<em>21b</em>12+a<em>22b</em>22+a<em>23b</em>32) ]\begin{bmatrix} a<em>{11} & a</em>{12} &amp; a<em>{13} \ a</em>{21} &amp; a<em>{22} & a</em>{23} \ \end{bmatrix} \begin{bmatrix} b<em>{11} & b</em>{12} \ b<em>{21} & b</em>{22} \ b<em>{31} & b</em>{32} \ \end{bmatrix} = \begin{bmatrix} (a<em>{11}b</em>{11} + a<em>{12}b</em>{21} + a<em>{13}b</em>{31}) &amp; (a<em>{11}b</em>{12} + a<em>{12}b</em>{22} + a<em>{13}b</em>{32}) \ (a<em>{21}b</em>{11} + a<em>{22}b</em>{21} + a<em>{23}b</em>{31}) &amp; (a<em>{21}b</em>{12} + a<em>{22}b</em>{22} + a<em>{23}b</em>{32}) \ \end{bmatrix}

Example I

  • Multiplying a 2x2 matrix by a 2x3 matrix.

  • [2amp;5 3amp;0 ][3amp;2amp;1 2amp;1amp;6 ]=[(2)(3)+(5)(2)amp;(2)(2)+(5)(1)amp;(2)(1)+(5)(6) (3)(3)+(0)(2)amp;(3)(2)+(0)(1)amp;(3)(1)+(0)(6) ]=[4amp;1amp;32 9amp;6amp;3 ]\begin{bmatrix} -2 &amp; 5 \ 3 &amp; 0 \ \end{bmatrix} \begin{bmatrix} -3 &amp; 2 &amp; -1 \ -2 &amp; 1 &amp; 6 \ \end{bmatrix} = \begin{bmatrix} (-2)(-3) + (5)(-2) &amp; (-2)(2) + (5)(1) &amp; (-2)(-1) + (5)(6) \ (3)(-3) + (0)(-2) &amp; (3)(2) + (0)(1) &amp; (3)(-1) + (0)(6) \ \end{bmatrix} = \begin{bmatrix} -4 &amp; 1 &amp; 32 \ -9 &amp; 6 &amp; -3 \ \end{bmatrix}

Example J

  • Multiplying a 3x3 matrix by a 3x1 matrix.

  • [2amp;1amp;0 7amp;2amp;1 0amp;1amp;5 ][3 1 6 ]=[(2)(3)+(1)(1)+(0)(6) (7)(3)+(2)(1)+(1)(6) (0)(3)+(1)(1)+(5)(6) ]=[7 25 31 ]\begin{bmatrix} 2 &amp; -1 &amp; 0 \ -7 &amp; -2 &amp; 1 \ 0 &amp; 1 &amp; 5 \ \end{bmatrix} \begin{bmatrix} -3 \ 1 \ 6 \ \end{bmatrix} = \begin{bmatrix} (2)(-3) + (-1)(1) + (0)(6) \ (-7)(-3) + (-2)(1) + (1)(6) \ (0)(-3) + (1)(1) + (5)(6) \ \end{bmatrix} = \begin{bmatrix} -7 \ 25 \ 31 \ \end{bmatrix}

Example K

  • Multiplying a 3x1 matrix by a 3x3 matrix.
  • Columns of the first (1) do not match the rows of the second (3), so the operation is not possible (DNE).

Example L

  • Squaring a matrix (multiplying a matrix by itself).
  • [2amp;3 1amp;2 ]2=[2amp;3 1amp;2 ][2amp;3 1amp;2 ]=[(2)(2)+(3)(1)amp;(2)(3)+(3)(2) (1)(2)+(2)(1)amp;(1)(3)+(2)(2) ]=[1amp;12 4amp;1 ]\begin{bmatrix} 2 &amp; 3 \ -1 &amp; 2 \ \end{bmatrix}^2 = \begin{bmatrix} 2 &amp; 3 \ -1 &amp; 2 \ \end{bmatrix} \begin{bmatrix} 2 &amp; 3 \ -1 &amp; 2 \ \end{bmatrix} = \begin{bmatrix} (2)(2) + (3)(-1) &amp; (2)(3) + (3)(2) \ (-1)(2) + (2)(-1) &amp; (-1)(3) + (2)(2) \ \end{bmatrix} = \begin{bmatrix} 1 &amp; 12 \ -4 &amp; 1 \ \end{bmatrix}