Skip to content

Matrix

Matrix is a rectangular array of number arranged in rows and columns. (Pural: Matrices)

Example

  • \(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix}\)
  • This is a 2x3 matrix.
  • A matrix has \(m\) x \(n\) dimensions.

Square Matrix

A square matrix is a matrix in which the number of rows is the same as the number of columns.

Example

  • \(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}\)
  • This is a 3x3 matrix.
  • The (2,3) element is 6.
  • The \(i\)-th diagonal element is \(a_{ii}\).

Diagonal Matrix

A diagonal matrix is a square matrix in which all the elements outside the main diagonal are zero.

Example

  • \(\begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \\ \end{bmatrix}\)
  • This is a 3x3 diagonal matrix.
  • The (2,3) element is 0.

Scalar Matrix

A scalar matrix is a square matrix in which all the diagonal elements are the same.

Example

  • \(\begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2 \\ \end{bmatrix}\)
  • This is a 3x3 scalar matrix.
  • The (2,3) element is 0.

Identity Matrix

The identity matrix is a diagonal matrix in which all the diagonal elements are 1.

Example

  • \(\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\)
  • This is a 3x3 identity matrix.
  • The (2,3) element is 0.

Linear Equations and Matrices

A linear equation is an equation that can be written in the form \(Ax = b\) where \(A\) is a matrix, \(x\) is a vector and \(b\) is a vector.

Example

  • \(3x + 2y = 5\)
  • \(4x + 6y = 7\)
  • \(A = \begin{bmatrix} 3 & 2 | & 5 \\ 4 & 6 | & 7\\ \end{bmatrix}\)

Matrix Arithmetic

  • Lets take two matricies and perform arithmetic operations on them
  • \(A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix}\)
  • \(B = \begin{bmatrix} 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}\)

Note

In addition and subtration the matricies must have the same dimensions.

Properties of Matrix Arithmetic

  • \(A + B = B + A\)
  • \((AB)C = A(BC)\)
  • \(AB \neq BA\)
  • \(\lambda(A + B) = \lambda A + \lambda B\)

Addition

The sum of two matricies is the matrix obtained by adding corresponding elements of the two matricies.

Example

  • \(A + B = \begin{bmatrix} 1 + 4 & 2 + 5 & 3 + 6 \\ 4 + 7 & 5 + 8 & 6 + 9 \\ \end{bmatrix}\)
  • \(A + B = \begin{bmatrix} 5 & 7 & 9 \\ 11 & 13 & 15 \\ \end{bmatrix}\)

Subtraction

Subtration is the same as addition but with subtraction.

Example

  • \(A - B = \begin{bmatrix} 1 - 4 & 2 - 5 & 3 - 6 \\ 4 - 7 & 5 - 8 & 6 - 9 \\ \end{bmatrix}\)
  • \(A - B = \begin{bmatrix} -3 & -3 & -3 \\ -3 & -3 & -3 \\ \end{bmatrix}\)

Scalar Multiplication

The product of a matrix \(A\) with a number \(c\) is denoted by \(cA\) and the (i,j)-th entry of \(cA\) is product of (i,j)-th entry of \(A\) with the number \(c\).

Example

\(2A = \begin{bmatrix} 2 & 4 & 6 \\ 8 & 10 & 12 \\ \end{bmatrix}\)

Matrix Multiplication

The product of two matricies \(A\) and \(B\) is denoted by \(AB\) and is defined only if the number of columns of \(A\) is equal to the number of rows of \(B\).

Formula:

\[(AB)_{ij} = \sum_{k=1}^nA_{ij}\cdot B_{kj}\]

Example

  • \(A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix}\)
  • \(B = \begin{bmatrix} 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}\)
  • \(AB = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix} \begin{bmatrix} 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}\)
  • \(AB = \begin{bmatrix} 1 \times 4 + 2 \times 7 & 1 \times 5 + 2 \times 8 & 1 \times 6 + 2 \times 9 \\ 4 \times 4 + 5 \times 7 & 4 \times 5 + 5 \times 8 & 4 \times 6 + 5 \times 9 \\ \end{bmatrix}\)
  • \(AB = \begin{bmatrix} 18 & 21 & 24 \\ 45 & 54 & 63 \\ \end{bmatrix}\)

About Matrix Multiplication:

  • In matrix multiplication the number of columns of the first matrix must be equal to the number of rows of the second matrix.
  • The dimensions of the product matrix are the number of rows of the first matrix by the number of columns of the second matrix.
  • \(\text{Scalar Multiplication by } c = \text{Multiplication by scalar matrix } cI\)