e-Mathematics > Matrix Algebra

Matrix Operations

Matrix and Scalar Entries. A matrix consists of $ m$ rows and $ n$ columns, and is called an m-by-n matrix.

$\displaystyle A =
\left[\begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n...
...\vdots & & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array}\right]
$

where $a_{ij}$ is called the (i,j)-entry and associated with the value at i-th row and j-th column. For example, $ \left[\begin{array}{ccc}
1 & 2 & -1 \\
0 & -5 & 3
\end{array}\right]$ is a $ 2\times 3$ matrix, and (1,3)-entry is $-1$.

Addition and Multiplication. Given two $ m\times n$ matrices $ A$ and $ B$, we can define the sum $ A + B$ as an $ m\times n$ matrix. For example,

$\displaystyle \begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & ...
..._{13} \\
a_{21} + b_{21} & a_{22} + b_{22} & a_{23} + b_{23}
\end{bmatrix}
$

Given a matrix $ A$ of any size, we can define the scalar multiple $ c A$ with scalar $ c$. For example,

$\displaystyle c \;
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{...
...s a_{13} \\
c\times a_{21} & c\times a_{22} & c\times a_{23}
\end{bmatrix}
$

Matrix multiplication. Given $ l\times m$ matrix $A=[a_{ij}]$ and $ m\times n$ matrix $B=[b_{ij}]$, we can introduce the multiplication $ A B$ of $ l\times n$ matrix with (i,j)-entry

$\displaystyle c_{ij} = \sum_{k=1}^m a_{ik} b_{kj}
$

Suppose, for example, that we have a $ 2\times 3$ matrix $ A$ and a $ 3\times 2$ matrix $ B$. Then we can compute the multiplication $ A B$ of $ 2 \times 2$ matrix by

$\displaystyle \begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} ...
...
b_{11} & b_{12} \\
b_{21} & b_{22} \\
b_{31} & b_{32}
\end{bmatrix}
$

$\displaystyle =
\begin{bmatrix}
a_{11} b_{11} + a_{12} b_{21} + a_{13} b_{31...
...a_{23} b_{31}
& a_{21} b_{12} + a_{22} b_{22} + a_{23} b_{32}
\end{bmatrix}
$

Matlab/Octave. We can define a matrix in either of the following forms:

> A = [4 0 5; -1 3 2]

> A = [4 0 5

-1 3 2]
You can execute basic matrix operations as follows.
> 5 * A

> A + B

> A * B

EXAMPLE 1. Let $ A =
\left[\begin{array}{ccc}
4 & 0 & 5 \\
-1 & 3 & 2
\end{array}\right]$, $ B =
\left[\begin{array}{ccc}
1 & 1 & 1 \\
3 & 5 & 7
\end{array}\right]$, and $ C =
\left[\begin{array}{cc}
2 & 3 \\
0 & 1
\end{array}\right]$.

  1. Compute $ A + B$.
  2. Is the matrix sum $ A + C$ defined?
  3. Compute $ 2B$.
  4. Compute $ A - 2B$.

EXAMPLE 2. Compute $ A B$ in each of the following:

  1. $ A =
\left[\begin{array}{cc}
2 & 3 \\
1 &-5
\end{array}\right]$ and $ B =
\left[\begin{array}{ccc}
4 & 3 & 6 \\
1 &-2 & 3
\end{array}\right]$.
  2. $ A =
\left[\begin{array}{ccc}
2 & -5 & 0 \\
-1 & 3 &-4 \\
6 & -8 &-7 \\
-3 & 0 & 9
\end{array}\right]$ and $ B =
\left[\begin{array}{cc}
4 &-6 \\
7 & 1 \\
3 & 2
\end{array}\right]$.

Properties of matrix multiplication. An $ n\times n$ matrix is called a square matrix. When the square matrices $ A$ and $ B$ are of the same size, both $ A B$ and $ BA$ are defined. The matrix multiplication is associative. That is, $ (AB)C = A(BC)$ whenever $ (AB)C$ or $ A(BC)$ is defined. However, the matrix multiplication is not commutative, that is, $ A B \neq B A$ in general.

EXAMPLE 3. Let $ A =
\left[\begin{array}{cc}
5 & 1 \\
3 &-2
\end{array}\right]$ and $ B =
\left[\begin{array}{cc}
2 & 0 \\
4 & 3
\end{array}\right]$. Show that these matrices do not commute.


© TTU Mathematics