**Greetings!**Some links on this site are affiliate links. That means that, if you choose to make a purchase, The Click Reader may earn a small commission

*at no extra cost to you*. We greatly appreciate your support!

A matrix is a 2-dimensional array made up of rows ($n$) and columns ($m$). When discussing matrix dimensionality, the standard convention is to specify the number of rows before the number of columns.

For example, if we have a matrix $X =

\begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & 6

\end{bmatrix}$.

The matrix has 2 rows (horizontal) and 3 columns (vertical), and the matrix is said to be a 2 $\times$ 3 matrix with 6 elements. Here, 2 $\times$ 3 is known as the order or the dimension of the matrix. Now that we have a basic idea of what matrices are, let us learn about some of the matrix operations.

## Matrix Addition and Subtraction

Addition and subtraction are one of the most fundamental numerical matrix operations. Matrices can be added and subtracted from one another, provided each matrix has an identical number of rows and columns, i.e., the matrices have the same dimension. When adding/subtracting matrices, each element of each matrix is added/subtracted to/from the corresponding elements of the other matrix.

For example, if we have two matrices $A =

\begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & 6 \\

7 & 8 & 9 \\

\end{bmatrix}$ and $B =

\begin{bmatrix}

7 & 8 & 9 \\

1 & 2 & 3 \\

4 & 5 & 6 \\

\end{bmatrix}$.

Then, the matrix addition of $A$ and $B$ is obtained as,

$$A + B =

\begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & 6 \\

7 & 8 & 9 \\

\end{bmatrix} +

\begin{bmatrix}

7 & 8 & 9 \\

1 & 2 & 3 \\

4 & 5 & 6 \\

\end{bmatrix} =

\begin{bmatrix}

1 + 7 & 2 + 8 & 3 +9 \\

4 + 1 & 5 + 2 & 6 + 3 \\

7 + 4 & 8 + 5 & 9 + 6 \\

\end{bmatrix} =

\begin{bmatrix}

8 & 10 & 12 \\

5 & 7 & 9 \\

11 & 13 & 15 \\

\end{bmatrix}$$

Similarly, the matrix subtraction of $A$ and $B$ is given as,

$$A – B =

\begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & 6 \\

7 & 8 & 9 \\

\end{bmatrix} –

\begin{bmatrix}

7 & 8 & 9 \\

1 & 2 & 3 \\

4 & 5 & 6 \\

\end{bmatrix} =

\begin{bmatrix}

1 – 7 & 2 – 8 & 3 -9 \\

4 – 1 & 5 -2 & 6 – 3 \\

7 – 4 & 8 – 5 & 9 – 6 \\

\end{bmatrix} =

\begin{bmatrix}

-6 & -6 & -6 \\

3 & 3 & 3 \\

3 & 3 & 3 \\

\end{bmatrix}$$

Matrix addition and subtraction follow a property known as **commutativity**. The result of matrix addition and subtraction is commutative, which means that the order in which we conduct the operations does not matter. We will end up with the same result regardless of the order, i.e., $A + B \equiv B + A$ and $A – B \equiv -B + A$. We will see an example of matrix multiplication, where this property does not apply in the next lesson of this course.

## Scalar multiplication of matrices

A scalar value is a value with zero dimensions. In simple words, it is a number. For some scalar $\lambda$, the result of $\lambda$ multiplied by some matrix $A$ is a matrix populated by the elements of $A$ multiplied by $\lambda$.

For example, if we take $\lambda = 3$ and multiply it with a matrix $A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}$, then the result $\lambda \times A$ is obtained as,

$$\lambda A = 3 \times \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix} = \begin{bmatrix} 3 \times 1 & 3 \times 2 & 3 \times 3 \\ 3 \times 4 & 3 \times 5 & 3 \times 6 \\ 3 \times 7 & 3 \times 8 & 3 \times 9 \\ \end{bmatrix} = \begin{bmatrix} 3 & 6 & 9 \\ 12 & 15 & 18 \\ 21 & 24 & 27 \\ \end{bmatrix}$$

In this lesson, we discussed the fundamental idea of matrices and some of the primary operations of matrices. Head onto the next lesson on ‘Dot Products and Matrix Multiplication‘ to discuss some of the more complex matrix operations such as the dot product and matrix multiplication.