Skip to content

Matrix Operations

Ryuu Mitsuki edited this page Sep 15, 2024 · 3 revisions

Table of Contents


Matrix operations include the arithmetic operations of addition, subtraction, multiplication of matrices. Also, we can find the transpose and inverse of a matrix, which can also be included as operations on matrices. The matrix operations help in combining two or more matrices into a single matrix.
The arithmetic operations of addition, subtraction, multiplication can also be performed on matrices.

Addition

    Matrix addition is an operation performed on two matrices with the same dimensions, where each corresponding element in the matrices is added together to form a new matrix. The resulting matrix will have the same dimensions as the original matrices.

Formula of Matrix Addition:

$$\boxed{A + B = [a_{ij}]_{m \times n} + [b_{ij}]_{m \times n} = [a_{ij} + b_{ij}]_{m \times n}}$$

Example:

$$M = \begin{bmatrix} m_{1,1} & \cdots & m_{1,j} \\\ m_{2,1} & \cdots & m_{2,j} \\\ \vdots & \ddots & \vdots \\\ m_{i,1} & \cdots & m_{i,j} \end{bmatrix}_{i \times j}$$ $$N = \begin{bmatrix} n_{1,1} & \cdots & n_{1,j} \\\ n_{2,1} & \cdots & n_{2,j} \\\ \vdots & \ddots & \vdots \\\ n_{i,1} & \cdots & n_{i,j} \end{bmatrix}_{i \times j}$$ $$M + N = \begin{bmatrix} m_{1,1} + n_{1,1} & \cdots & m_{1,j} + n_{1,j} \\\ m_{2,1} + n_{2,1} & \cdots & m_{2,j} + n_{2,j} \\\ \vdots & \ddots & \vdots \\\ m_{i,1} + n_{i,1} & \cdots & m_{i,j} + n_{i,j} \end{bmatrix}_{i \times j}$$

Properties of Matrix Addition

Closure Property

    The resulting matrix will have the same dimensions as the matrices operands. The matrices can only performs the matrix addition, if and only if the order or dimensions (the number of rows and columns) of the matrices are equal. The addition for matrices with different sizes are not defined.

$$\boxed{A_{m \times n} + B_{m \times n} = C_{m \times n}}$$
Commutative Property

    If $A$ and $B$ are two matrices of the same order, such as $m \times n$, the addition of the two matrices is commutative, meaning that...

$$\boxed{A_{m \times n} + B_{m \times n} \equiv B_{m \times n} + A_{m \times n}}$$
Associative Property

    If the three matrices $A$, $B$, and $C$ are all of the same order, such as $m \times n$, then the addition of the three matrices is associative.

$$\boxed{A_{m \times n} + (B + C)_{m \times n} \equiv (A + B)_{m \times n} + C_{m \times n}}$$
Additive Identity

    There is an identity element for every matrix of size $m \times n$. As a result, if $A$ is an order matrix of size $m$ by $n$, then its additive identity will be a zero matrix of the same order, so that...

$$\boxed{A_{m \times n} + O_{m \times n} = A_{m \times n}}$$ $$\mathsf{Where} \; O \rightarrow \mathsf{zero} \: \mathsf{matrix.}$$
Additive Inverse

    If $A$ is any matrix of order $m \times n$, then $B = (-A)$ of the same order will be $A$'s additive inverse.

$$\boxed{A_{m \times n} + B_{m \times n} = O_{m \times n}}$$ $$\boxed{A_{m \times n} + \left( -A \right)_{m \times n} = O_{m \times n}}$$

Consequently, a zero matrix is produced by adding a matrix and its additive inverse.

Subtraction

    Similar to addition, two matrices can be subtracted if they have the same dimensions, and its also have the same properties with the matrix addition.
Subtraction is performed by subtracting the corresponding elements of the matrices.

Formula of Matrix Subtraction:

$$\boxed{A - B = [a_{ij}]_{m \times n} - [b_{ij}]_{m \times n} = [a_{ij} - b_{ij}]_{m \times n}}$$ $$\boxed{A - B = A + (-B)}$$

Note

($-B$) is the inverse of matrix $B$.
In other words, that matrix subtraction is an addition of the inverse of a matrix to the given matrix.

Example:

$$M = \begin{bmatrix} m_{1,1} & \cdots & m_{1,j} \\\ m_{2,1} & \cdots & m_{2,j} \\\ \vdots & \ddots & \vdots \\\ m_{i,1} & \cdots & m_{i,j} \end{bmatrix}_{i \times j}$$ $$N = \begin{bmatrix} n_{1,1} & \cdots & n_{1,j} \\\ n_{2,1} & \cdots & n_{2,j} \\\ \vdots & \ddots & \vdots \\\ n_{i,1} & \cdots & n_{i,j} \end{bmatrix}_{i \times j}$$ $$M - N = \begin{bmatrix} m_{1,1} - n_{1,1} & \cdots & m_{1,j} - n_{1,j} \\\ m_{2,1} - n_{2,1} & \cdots & m_{2,j} - n_{2,j} \\\ \vdots & \ddots & \vdots \\\ m_{i,1} - n_{i,1} & \cdots & m_{i,j} - n_{i,j} \end{bmatrix}_{i \times j}$$

Properties of Matrix Subtraction

The matrix subtraction has the same properties with matrix addition.

  • Closure Property
  • Commutative Property
  • Associative Property
  • Additive Identity
  • Additive Inverse

Multiplication

    Matrix multiplication follows certain properties and there are different types of multiplication based on the dimensions of the matrices involved. In terms of the numbers of matrices involved, there are two main types of matrix multiplication.

  Scalar Multiplication

    This type involves multiplying each element of matrix by a scalar (a single number). When a matrix is multiplied by a scalar (a single number), each element of the matrix is multiplied by that scalar. The resulting matrix has the same dimensions as the original matrix.

$$ \boxed{cA = A} $$

Note

The matrix denoted by $A$ and the scalar by $c$ (often denoted with lowercase letters).

$$A = \begin{bmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\\ \vdots & \vdots & \ddots & \vdots \\\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{bmatrix}_{m \times n}$$ $$cA = \begin{bmatrix} c(a_{1,1}) & c(a_{1,2}) & \cdots & c(a_{1,n}) \\\ c(a_{2,1}) & c(a_{2,2}) & \cdots & c(a_{2,n}) \\\ \vdots & \vdots & \ddots & \vdots \\\ c(a_{m,1}) & c(a_{m,2}) & \cdots & c(a_{m,n}) \end{bmatrix}_{m \times n}$$

Properties of Scalar Multiplication

Closure Property

    Scalar multiplication exhibits closure property, which means that when a matrix $A$ of size $m \times n$ is multiplied by a scalar $c$, the resulting matrix has the same dimensions as $A$. In other words, the product $cA$ remains in the same matrix space as $A$.

$$\boxed{cA_{m \times n} = A_{m \times n}}$$
Associative Property
$$\boxed{\left(c \cdot d \right)A \equiv c \left(d \cdot A \right)}$$

    The associative property states that when a scalar $c$ is multiplied by another scalar $d$ and the result is multiplied by matrix $A$.

$$ \boxed{\left(c \cdot d \right)A} $$

It's equivalent to first multiplying the scalar $d$ by the matrix $A$ and then multiplying the result by the scalar $c$.

$$ \boxed{c \left(d \cdot A\right)} $$

For example, let's consider the matrix $A$ with dimensions $2 \times 2$.

$$A = \begin{bmatrix} 2 & 4 \\\ 6 & 8 \end{bmatrix}_{2 \times 2}$$

If we multiply $A$ by the product of scalars $c$ and $d$, with $c = 2$ and $d = 3$, we can evaluate the following expressions:

$$(c \cdot d)A = (2 \cdot 3)A \implies 6A = \begin{bmatrix} 12 & 24 \\\ 36 & 48 \end{bmatrix}_{2 \times 2}$$

$$c(d \cdot A) = 2(3 \cdot A) = 2 \cdot 3A$$

$$ \Downarrow $$

$$2 \left( 3 \begin{bmatrix} 2 & 4 \\\ 6 & 8 \end{bmatrix} \right) = 2 \begin{bmatrix} 6 & 12 \\\ 18 & 24 \end{bmatrix} = \begin{bmatrix} 12 & 24 \\\ 36 & 48 \end{bmatrix}$$ $$\text{Therefore, } \: 2 (3 \cdot A) = \begin{bmatrix} 12 & 24 \\\ 36 & 48 \end{bmatrix}_{2 \times 2}$$

The resulting matrices are equal, demonstrating the associative property.

Distributive Property

    The distributive property states that when a scalar $c$ is multiplied by the sum of two matrices $A$ and $B$, it's equivalent to multiplying the scalar $c$ by each matrix individually and then adding the results.

$$ \boxed{c \left(A + B \right) \equiv cA + cB} $$

Example:

Let's consider matrices $A$ and $B$.

$$A = \begin{bmatrix} 2 & 4 \\\ 1 & 3 \end{bmatrix}_{2 \times 2} \qquad B = \begin{bmatrix} 5 & 2 \\\ 0 & -1 \end{bmatrix}_{2 \times 2}$$

If we multiply $A$ and $B$ by scalar $c = 2$, we can evaluate the following expressions:

Using formula $c(A +B)$ :

$$\boxed{c \left(A + B \right) = 2 \left(A + B \right)}$$

$$ \Downarrow $$

$$2 \left( \begin{bmatrix} 2 & 4 \\\ 1 & 3 \end{bmatrix} + \begin{bmatrix} 5 & 2 \\\ 0 & -1 \end{bmatrix} \right) = 2 \begin{bmatrix} 7 & 6 \\\ 1 & 2 \end{bmatrix}_{2 \times 2}$$ $$2 \begin{bmatrix} 7 & 6 \\\ 1 & 2 \end{bmatrix}_{2 \times 2} = \begin{bmatrix} 14 & 12 \\\ 2 & 4 \end{bmatrix}_{2 \times 2}$$

$$ \Downarrow $$

$$2(A + B) = \begin{bmatrix} 14 & 12 \\\ 2 & 4 \end{bmatrix}_{2 \times 2}$$

Using formula $cA + cB$ :

$$\boxed{cA + cB = 2A + 2B}$$

$$ \Downarrow $$

$$2A = 2 \begin{bmatrix} 2 & 4 \\\ 1 & 3 \end{bmatrix}_{2 \times 2} = \begin{bmatrix} 4 & 8 \\\ 2 & 6 \end{bmatrix}_{2 \times 2}$$ $$2B = 2 \begin{bmatrix} 5 & 2 \\\ 0 & -1 \end{bmatrix}_{2 \times 2} = \begin{bmatrix} 10 & 4 \\\ 0 & -2 \end{bmatrix}_{2 \times 2}$$ $$\begin{bmatrix} 4 & 8 \\\ 2 & 6 \end{bmatrix}_{2 \times 2} + \; \begin{bmatrix} 10 & 4 \\\ 0 & -2 \end{bmatrix}_{2 \times 2} = \begin{bmatrix} 14 & 12 \\\ 2 & 4 \end{bmatrix}_{2 \times 2}$$

$$ \Downarrow $$

$$2A + 2B = \begin{bmatrix} 14 & 12 \\\ 2 & 4 \end{bmatrix}_{2 \times 2}$$

The resulting matrices are equal, demonstrating the distributive property.

    Similarly, when two scalars $c$ and $d$ are added together and multiplied by matrix $A$, it's equivalent to multiplying each scalar individually by the matrix $A$ and then adding the results.

$$ \boxed{(c + d)A \equiv cA + dA} $$

Example:

Let's consider the matrix $M$ with dimensions $2 \times 3$.

$$M = \begin{bmatrix} 8 & -2 & 4 \\\ 7 & 1 & -8 \end{bmatrix}_{2 \times 3}$$

If we multiply by the sum of two scalars $c$ and $d$, with $c = 4$ and $d = 2$, we can evaluate the following expressions:

Using formula $(c + d)A$ :

$$\boxed{(c + d)A = (4 + 2)M}$$

$$ \Downarrow $$

$$(4 + 2)M = 6M \implies 6 \begin{bmatrix} 8 & -2 & 4 \\\ 7 & 1 & -8 \end{bmatrix}_{2 \times 3}$$ $$6 \begin{bmatrix} 8 & -2 & 4 \\\ 7 & 1 & -8 \end{bmatrix}_{2 \times 3} = \begin{bmatrix} 48 & -12 & 24 \\\ 42 & 6 & -48 \end{bmatrix}_{2 \times 3}$$

$$ \Downarrow $$

$$(4 + 2)M = \begin{bmatrix} 48 & -12 & 24 \\\ 42 & 6 & -48 \end{bmatrix}_{2 \times 3}$$

Using formula $cA + dA$ :

$$\boxed{cA + dA = 4M + 2M}$$

$$ \Downarrow $$

$$4M = 4 \begin{bmatrix} 8 & -2 & 4 \\\ 7 & 1 & -8 \end{bmatrix}_{2 \times 3} = \begin{bmatrix} 32 & -8 & 16 \\\ 28 & 4 & -32 \end{bmatrix}_{2 \times 3}$$ $$2M = 2 \begin{bmatrix} 8 & -2 & 4 \\\ 7 & 1 & -8 \end{bmatrix}_{2 \times 3} = \begin{bmatrix} 16 & -4 & 8 \\\ 14 & 2 & -16 \end{bmatrix}_{2 \times 3}$$

$$ \Downarrow $$

$$4M + 2M = \begin{bmatrix} 48 & -12 & 24 \\\ 42 & 6 & -48 \end{bmatrix}_{2 \times 3}$$

The resulting matrices are equal, demonstrating the distributive property.

Multiplicative Identity
$$\boxed{1A = A}$$

    The multiplicative identity in matrix operations refers to the identity matrix, which, when multiplied by any compatible matrix, leaves the original matrix unchanged. In the context of linear algebra, this concept ensures that multiplying a matrix by the identity matrix yields the matrix itself, preserving its values.

Multiplicative Zero
$$\boxed{0A = O}$$

    The multiplicative zero property in matrix operations refers to the result of multiplying any matrix by a zero matrix, which yields a zero matrix of the same dimensions. This property is analogous to the zero property in scalar multiplication, ensuring that multiplying by zero annuls the values in the matrix.

  Matrix Multiplication

    Matrix multiplication is an operation performed on two matrices, where the elements of one matrix are multiplied by the corresponding elements of the other matrix and then summed up to obtain the resulting matrix.
    This type involves multiplying two matrices together. It is more complex operation that combines the rows of the first matrix with the columns of the second matrix.
The resulting matrix has dimensions ($m \times p$), where $m$ is the number of rows in the first matrix and $p$ is the number of columns in the second matrix. The number of columns in the first matrix must be equal to the number of rows in the second matrix.

$$M = \begin{bmatrix} 2 & -4 & 8 \\\ 10 & 12 & -1 \\\ 0 & -5 & -2 \\\ 3 & 1 & 2 \end{bmatrix}$$ $$N = \begin{bmatrix} 8 & 7 & 5 & -2 \\\ 12 & -9 & -2 & 0 \\\ 2 & -5 & 6 & 3 \end{bmatrix}$$ $$M \times N = \begin{bmatrix} -16 & 10 & 66 & 20 \\\ 222 & -33 & 20 & -23 \\\ -64 & 55 & -2 & -6 \\\ 40 & 2 & 25 & 0 \end{bmatrix}$$

    Please note the matrix multiplication is not commutative, which means the order of multiplication matters. That is, for matrices $A$ and $B$, it's not true that $A \times B \equiv B \times A$ always true (which means $A \times B \ne B \times A$).
There are also special cases where $A \times B$ can be equal to $B \times A$. One such case is when $A$ and $B$ are square matrices of the same size and they commute, which means that $A \times B \equiv B \times A$.

Properties of Matrix Multiplication

Matrix multiplication follows several important properties that distinguish it from scalar multiplication. These properties are essential in understanding the behavior of matrices in linear algebra.

Associative Property

Matrix multiplication is associative, meaning that for three matrices $A$, $B$, and $C$, the product satisfies:

$$A(BC) = (AB)C$$

Example:

Let:

$$A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \: \: B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} \: \: C = \begin{bmatrix} 9 & 10 \\ 11 & 12 \end{bmatrix}$$

First, compute $BC$:

$$BC = \begin{bmatrix} (5 \cdot 9 + 6 \cdot 11) & (5 \cdot 10 + 6 \cdot 12) \\\ (7 \cdot 9 + 8 \cdot 11) & (7 \cdot 10 + 8 \cdot 12) \end{bmatrix} = \begin{bmatrix} 111 & 126 \\\ 163 & 186 \end{bmatrix}$$

Now, compute $A(BC)$ and $(AB)C$ to show they are equal.

Distributive Property

Matrix multiplication is distributive over matrix addition. This means:

$$A(B + C) = AB + AC$$

Example:

Using matrices $A$, $B$, and $C$ as before, compute $B + C$ first:

$$B + C = \begin{bmatrix} (5 + 9) & (6 + 10) \\\ (7 + 11) & (8 + 12) \end{bmatrix} = \begin{bmatrix} 14 & 16 \\\ 18 & 20 \end{bmatrix}$$

Now, calculate both sides of the distributive property equation to verify.

Non-Commutative Property

Matrix multiplication is not commutative. That is, for matrices $A$ and $B$:

$$AB \neq BA$$

Example:

Using the matrices $A$ and $B$:

$$AB = \begin{bmatrix} (1 \cdot 5 + 2 \cdot 7) & (1 \cdot 6 + 2 \cdot 8) \\\ (3 \cdot 5 + 4 \cdot 7) & (3 \cdot 6 + 4 \cdot 8) \end{bmatrix} = \begin{bmatrix} 19 & 22 \\\ 43 & 50 \end{bmatrix}$$

Now calculate $BA$ and note that $AB \neq BA$.

Multiplicative Identity Property

For any square matrix $A$ of order $n$, there exists an identity matrix $I_n$ such that:

$$AI_n = I_nA = A$$

The identity matrix does not change the matrix it multiplies.

Example:

Let:

$$I_2 = \begin{bmatrix} 1 & 0 \\\ 0 & 1 \end{bmatrix}$$

Multiplying $A$ by $I_2$:

$$AI_2 = \begin{bmatrix} (1 \cdot 1 + 2 \cdot 0) & (1 \cdot 0 + 2 \cdot 1) \\\ (3 \cdot 1 + 4 \cdot 0) & (3 \cdot 0 + 4 \cdot 1) \end{bmatrix} = \begin{bmatrix} 1 & 2 \\\ 3 & 4 \end{bmatrix}$$
Multiplication by Zero Matrix

Multiplying any matrix by a zero matrix results in a zero matrix.

Example:

Let:

$$Z = \begin{bmatrix} 0 & 0 \\\ 0 & 0 \end{bmatrix}$$

Multiplying $A$ by $Z$:

$$AZ = \begin{bmatrix} (1 \cdot 0 + 2 \cdot 0) & (1 \cdot 0 + 2 \cdot 0) \\\ (3 \cdot 0 + 4 \cdot 0) & (3 \cdot 0 + 4 \cdot 0) \end{bmatrix} = \begin{bmatrix} 0 & 0 \\\ 0 & 0 \end{bmatrix}$$

Transposition

    The transpose of a matrix is obtained by changing the rows into columns and columns into rows for a given matrix. Which means it switches row and column indices of the matrix by producing another matrix, and the transposed matrix is often denoted by $A^{T}$, $A^{t}$, or $A^{tr}$. The transpose of a matrix was introduced in 1858 by the British mathematician, Arthur Cayley.

Note

💡 Tip: Repeating the process to transposed matrix will reset their elements position to original position. And it can be denoted by $(A^{T})^{T}$.

$$M = \begin{bmatrix} 1 & 4 & 7 \\\ 6 & 8 & 5 \end{bmatrix}$$ $$M^{T} = \begin{bmatrix} 1 & 6 \\\ 4 & 8 \\\ 7 & 5 \end{bmatrix}$$

In the example above, the rows and columns indices of matrix $M$ switched from $2 \times 3$ to $3 \times 2$. If the matrix performs transposition once again, the indices back to their original position.

$$(M^{T})^{T} = \begin{bmatrix} 1 & 4 & 7 \\\ 6 & 8 & 5 \end{bmatrix}$$