# CSEC Mathematics: Operations with Matrices- Addition, Subtraction and Multiplication

Updated: Apr 27, 2020

**In this lesson, we will cover:**

explaining basic concepts associated with matrices;

solving problems involving matrix operations;

A **matrix **is an **ordered, rectangular array** of numbers (not featuring Keanu Reeves). The numbers are arranged in **rows** and **columns** between brackets. The numbers that appear in the **rows** and **columns **of a matrix are called** elements** of the matrix.

We can't talk about matrices without first defining **order.** The** order of a matrix** is found based on the number of rows and columns in the matrix. For example:

The matrix *C *has 2 rows and 3 columns, giving it an order of **2 x 3. **So, to find the order of a matrix, simply write the number of rows followed by the number of columns in a matrix.

Here are some other terms that you must know before moving on:

A matrix with a single row is called a **row vector.**

A matrix with a single column is a **column vector.**

A matrix with the same number of rows and columns is called a **square vector.**

An **identity matrix **is a square matrix where all the main diagonal elements are 1's and all other elements are 0's. Identity Matrix is denoted with the letter “**I **n×n”, where *n×n *represents the order of the matrix.

Since an identity matrix is **always square, **we can refer to identity matrices using *I *and then subscript n, n being the number of columns or rows (which are the same).

The special thing about an identity matrix is that if you multiply a matrix by an identity matrix, the original matrix will be unchanged in the product.

**Matrix Addition and Subtraction**

Two matrices can only be added or subtracted if they have the **same order. **

If the two matrices have the same order, then you add or subtract them by adding or subtracting the corresponding elements.

**Subtracting**

**Adding**

**Scalar Matrix Multiplication**

Scalar multiplication is the multiplication of a matrix by a scalar value, which is usually a whole number such as 2. You simply multiply each element in the matrix by the scalar to get the answer:

**Matrix Multiplication**

Matrix multiplication can only be done if the **number of columns in the first matrix** is the same as the **number of rows in the second matrix. **

Note: If a matrix *A *with order **m x n** is multiplied by a matrix* B *with order **n x p**, then their product will be a matrix of order **m x p.**

When multiplying matrices, you follow a specific process:

You first check to see if the **number of columns in the first matrix** is the same as the **number of rows in the second matrix. **

These two matrices to be multiplied are able to be multiplied since the **number of columns in the first matrix** is the same as the **number of rows in the second matrix. **

Then, you divide the first matrix into **row vectors** and the second matrix into **column vectors.**

We then multiply the first term in the first row vector in the first matrix by the first term in the first column vector in the second matrix. We multiply the second term in the first row vector in the first matrix by the second term in the first column vector in the second matrix, and add the products together to get the first term in the product of the matrices. This is known as the** dot product.**

To say it more simply, we **multiply the matching elements and then add them. **For the first term in the answer, we multiply the first row and first column.

(2 x 12) + (-4 x 8) = 24 + (-32) = -8

Above, you can see that you match the first elements and multiply them, then do the same for the second elements and add them.

To find the second term, we multiply the first row and second column.

We multiply the second row and the first column for the third term:

And finally, for the fourth term, we find the dot product of the second row and second column:

Whew! Finally. You might be wondering, "why do we multiply matrices in such a terrible way? Well, it's because it makes realistic sense when applied to problems such as this one:

### The local shop sells 3 types of pies.

Apple pies cost

**$3**eachCherry pies cost

**$4**eachBlueberry pies cost

**$2**each

And this is how many they sold in 4 days:

Now consider this ... the **value of sales** for Monday is calculated this way:

**Apple pie value + Cherry pie value + Blueberry pie value**

**$3×13 + $4×8 + $2×6 = $83**

So it is, in fact, the **"dot product"** of prices and how many were sold:

**($3, $4, $2) • (13, 8, 6) = $3×13 + $4×8 + $2×6****
**** = $83**

We **match** the price to how many sold, **multiply** each, then **sum** the result.

In other words:

The sales for Monday were: Apple pies:

**$3×13=$39**, Cherry pies:**$4×8=$32**, and Blueberry pies:**$2×6=$12**. Together that is $39 + $32 + $12 =**$83**And for Tueday:

**$3×9 +****$4×7 + $2×4 =****$63**And for Wednesday:

**$3×7 +****$4×4 + $2×0 =****$37**And for Thursday:

**$3×15 +****$4×6 + $2×3 =****$75**

So it is important to **match** each price to each quantity.

Here is a useful Khan Academy Video about multiplying matrices:

*It is important to note that multiplication of matrices is non-commutative, that is, if you have two matrices A and B, A x B will give a different answer than B x A.*