Matrices

Definition and Terminology

Definition

A matrix is an array of mathematical objects. It could contain real numbers, complex numbers, functions even other matrices. For our purposes we will focus on real numbers. We usually name a matrix with a upper case letter and name its entries with the corresponding lower case letter.

(1)
\begin{align} A= \left [ \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \cdots & \cdots & \cdots & \cdots \\ a_{m1} & a_{m2} & \cdots & a_{mn}\\ \end{array} \right ] \end{align}

The entry $a_{ij}$ refers to the entry in matrix $A$ in the ith row and jth column. For brevity we do not put a comma between the i and j values unless the number of columns or rows exceeds 9.

Dimension

The dimension of a matrix refers to the number of columns a matrix has. A matrix with m rows and n columns is said to have dimension $m \times n$. The notation $A_{m \times n}$ is used to idicate a matrix named $A$ that has dimension $m \times n$.
A matrix that has the same number of rows as columns or in other words has dimension $n \times n$ is called a square matrix. The name refers to the fact that the matrix is square in shape.

Operations

Addition/Subtraction

In order to add or subtract two matrices with the same dimension we add or subtract the corresponding entries. That is to say,

(2)
\begin{align} A\pm B=\{ a_{ij}\pm b_{ij} \} \end{align}

It is important that both matrices have the same dimension so that there is a corresponding entry to add or subtract. Otherwise the operation is said to be undefined.

Scalar Multiplication

In order to multiply a matrix by a scalar we multiply every entry in the matrix by the scalar. That is to say,

(3)
\begin{align} kA=\{ ka_{ij} \} \end{align}

Matrix Multiplication

In order to multiply two matrices we take the dot product of each row in the first matrix with each column in the second matrix. IN other words,

(4)
\begin{align} AB=\{c_{ij}\} \mbox{ where } c_{ij}=(\mbox{Row i of matrix A}) \cdot (\mbox{Row j of matrix B}) \end{align}

Example

(5)
\begin{align} \left [ \begin{array}{cc} 1 & 5\\ 2 & 8\\ \end{array} \right ] \left [ \begin{array}{cc} 3 & -7\\ 4 & 0\\ \end{array} \right ] = \left [ \begin{array}{cc} (1)(3)+(5)(4) & (1)(-7)+(5)(0)\\ (2)(3)+(8)(4) & (2)(-7)+(8)(0)\\ \end{array} \right ] \left [ \begin{array}{cc} 23 & -7\\ 38 & -14\\ \end{array} \right ] \end{align}

Note that in order for each row in matrix $A$ to be the same length as each column in matrix $B$, we must have their inner dimensions match. In other words $A_{p \times q}$ and $B_{q \times r}$. If that inner dimension $q$ does not match the operation is undefined.

Transpose

The transpose $(A^T)$ of a matrix $A$ is one in which each row in the original matrix becomes a column in the resulting matrix.

Example

(6)
\begin{align} A= \left [ \begin{array}{ccc} 2 & 6 & 8\\ -4 & 3 & 10\\ \end{array} \right ] \hskip 1in A^T= \left [ \begin{array}{cc} 2 & -4\\ 6 & 3\\ 8 & 10\\ \end{array} \right ] \end{align}

Determinant

The determinant of a matrix is related to the content of the space spanned by the vectors that make up the matrix. It has many other uses as we have already seen in the calculation of the cross product. The definition of the determinant is recursive. The 3D determinant is based on the 2D determinant, the 4D determinant is based on the 3D determinant and so on. For our purposed we will just focus on 1D, 2D and 3D determinants.

1D

(7)
\begin{equation} |a|=a \end{equation}

2D

(8)
\begin{align} \left [ \begin{array}{cc} a & b\\ c & d\\ \end{array} \right ] =ad-bc \end{align}

3D

(9)
\begin{align} \left | \begin{array}{ccc} a & b & c\\ d & e & f\\ g & h & i\\ \end{array} \right | =a \left | \begin{array}{cc} e & f\\ h & i\\ \end{array} \right | -b \left | \begin{array}{cc} d & f\\ g & i\\ \end{array} \right | +c \left | \begin{array}{cc} d & e\\ g & h\\ \end{array} \right | \end{align}

Note that the determinant is only defined for square matrices.

Example

(10)
\begin{align} \left | \begin{array}{ccc} 1 & 4 & -2\\ 3 & 0 & 6\\ -7 & 8 & 5\\ \end{array} \right | =1 \left | \begin{array}{cc} 0 & 6\\ 8 & 5\\ \end{array} \right | -4 \left | \begin{array}{cc} 3 & 6\\ -7 & 5\\ \end{array} \right | +(-2) \left | \begin{array}{cc} 3 & 0\\ -7 & 8\\ \end{array} \right | =1(0-48)-4(15+42)-2(24-0)=-48-228-48=-324 \end{align}

Exercises

1) Given the matrices

(11)
\begin{align} A=\left [ \begin{array}{cc} 1 & 4 \\ -3 & 8 \\ \end{array} \right ] \mbox{ and } B= \left [ \begin{array}{cc} 6 & 2 \\ 0 & -5 \\ \end{array} \right ] \end{align}

a) Find $2A-3B$
b) Find $AB$
c) Find $BA$
d) Find $A^T$

2) Find $|A|$ for the matrix

(12)
\begin{align} A=\left [ \begin{array}{ccc} 5 & 8 & 16 \\ -2 & -9 & -11 \\ 0 & 4 & 1 \\ \end{array} \right ] \end{align}

3) Given two n-dimensional vectors $\vec{u}$ and $\vec{v}$, say we represent them as two $n \times 1$ matrices $U$ and $V$. How would we calculate the dot product of $\vec{u}$ and $\vec{v}$, using matrix operations on $U$ and $V$.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License