407 493 6601

# Algebra 2 - Matrix Operations

## Introduction

• A matrix is an arrangement of numbers in a rectangular array (in rows and columns).
• Generally, a matrix of the order $m×n$ is symbolically represented as ${\left[\begin{array}{c}{A}_{ij}\end{array}\right]}_{m×n}$ ,where $m$ and $n$ denotes the number of rows and columns.
• $\left[\begin{array}{ccc}1& 5& -2\\ -2& 3& 7\end{array}\right]$ is an example of a matrix of order $2×3$ because it has two rows and three columns.
• $\left[\begin{array}{ccc}2& -1& 5\\ 7& 0& 3\\ -3& 8& 6\\ 1& 4& -1\end{array}\right]$ is another example of a matrix of order $4×3$ because it has four rows and three columns.
• The individual items in a matrix are called its elements.

## Types of Matrices

Some important types of matrices worth remembering are explained below.

1. Column Matrix

• a matrix with only one column
• Example: ${\left[\begin{array}{c}3\\ 1\\ -2\end{array}\right]}_{3×1}$ is a column matrix of order $3×1$ i.e. 3 rows and 1 column.

2. Row Matrix

• a matrix with only one row
• Example: ${\left[\begin{array}{cccc}3& -1& 0& 5\end{array}\right]}_{1×4}$ is a row matrix of order $1×4$ i.e. 1 row and 4 columns.

3. Square Matrix

• a matrix with the same number of rows and columns
• Example: ${\left[\begin{array}{ccc}-1& 0& 2\\ 3& 6& 1\\ 7& -5& 1\end{array}\right]}_{3×3}$ is a square matrix of order $3×3$ i.e. 3 rows and 3 columns.

4. Diagonal Matrix

• a type of square matrix with all its non-diagonal elements as zero
• Example: ${\left[\begin{array}{cccc}-2& 0& 0& 0\\ 0& 5& 0& 0\\ 0& 0& -1& 0\\ 0& 0& 0& 9\end{array}\right]}_{4×4}$ is a diagonal matrix of order $4×4$ i.e. 4 rows and 4 columns in which all of its non-diagonal elements are zero.

5. Identity Matrix

• a type of square matrix in which all the diagonal elements are 1 and all the non-diagonal elements are zero.
• Example: ${\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]}_{3×3}$ is an identity matrix of order $3×3$  i.e. 3 rows and 3 columns.

## Equality of Matrices

• Two matrices X & Y can be said to be equal only if -
1. they are of the same order
2. each element of matrix X is equal to the corresponding element of matrix Y

## Operations on Matrices

Operations on matrices include:

• Addition and Subtraction of matrices
• Multiplication of a matrix by
• a  number (scalar multiplication)
• another matrix
• Transpose of a matrix

Note: A matrix can be divided by a scalar (number), but there is no defined rule for dividing a matrix by another matrix.

## Addition and Subtraction of Matrices

• Two matrices can be added or subtracted only if they have the same dimension i.e. they must have the same number of rows and columns.
• To add two matrices, we simply add the corresponding elements of both matrices.
• Matrix addition is commutative i.e. $A+B=B+A$, where A and B are matrices of the same order.
• Matrix addition is associative i.e. $\left(A+B\right)+C=A+\left(B+C\right)$, where A, B, and C are matrices of the same order.

SUBTRACTION OF MATRICES

• Similarly to subtract two matrices, we simply subtract the elements of one matrix from the corresponding elements of the other matrix.
• Matrix subtraction is non-commutative i.e. $A-B\ne B-A$, where A and B are matrices of the same order.
• Matrix subtraction is non-associative i.e. $\left(A-B\right)-C\ne A-\left(B-C\right)$, where A, B, and C are matrices of the same order.

## Multiplying a Matrix with a number [Scalar Multiplication]

• When we multiply a matrix by a number, we simply multiply each element of the matrix by that same number. This operation produces a new matrix, which is called a scalar multiple.
• In other words, if matrix A is represented by ${\left[{a}_{ij}\right]}_{m×n}$,then $kA={\left[k·{a}_{ij}\right]}_{m×n}$ where $k$ is a scalar (number).

## Multiplying a Matrix by another Matrix [Matrix Multiplication]

• Two matrices A and B can only be multiplied if the number of columns in A is equal to the number of rows in B otherwise not.

• If a matrix $A={\left[{a}_{ij}\right]}_{m×n}$ is multiplied by another matrix $B={\left[{b}_{ij}\right]}_{n×p}$, then the resultant matrix will be $C={\left[{c}_{ik}\right]}_{m×p}$, where ${c}_{ik}=\underset{j=1}{\overset{n}{\sum {a}_{ij}·{b}_{jk}}}$.
• If $AB$ and $BA$ are defined, it is not necessary that they are equal as the orders of $AB$ and $BA$ may be different.
• In order to understand the concept of matrix multiplication, refer to Example 7.

## Transpose of a Matrix

• The transpose of a matrix $A$ is deonted by ${A}^{T}$ or $A\text{'}$.
• If we interchange the rows and columns of a matrix $A={\left[{a}_{ij}\right]}_{m×n}$ then, the resultant matrix obtained ${A}^{T}={\left[{a}_{ji}\right]}_{n×m}$ is called the transpose of matrix A.
• If $A$ is a $m×n$ matrix, then ${A}^{T}$ will be a $n×m$ matrix.
• The transpose of a row matrix is a column matrix and vice versa.

## Solved Examples

Example 1: Add the matrices A and B, where $A=\left[\begin{array}{ccc}1& 0& 5\\ -2& 3& -1\\ 8& 6& 4\end{array}\right]$ and $B=\left[\begin{array}{ccc}3& 9& -1\\ 10& 2& 3\\ 7& -4& 2\end{array}\right]$

Solution: $A+B=\left[\begin{array}{ccc}1& 0& 5\\ -2& 3& -1\\ 8& 6& 4\end{array}\right]+\left[\begin{array}{ccc}3& 9& -1\\ 10& 2& 3\\ 7& -4& 2\end{array}\right]=\left[\begin{array}{ccc}\left(1+3\right)& \left(0+9\right)& \left(5-1\right)\\ \left(-2+10\right)& \left(3+2\right)& \left(-1+3\right)\\ \left(8+7\right)& \left(6-4\right)& \left(4+2\right)\end{array}\right]=\left[\begin{array}{ccc}4& 9& 4\\ 8& 5& 2\\ 15& 2& 6\end{array}\right]$

Example 2: Find the sum of the matrices A and B, where $A={\left[\begin{array}{cc}2& -1\\ 5& 3\end{array}\right]}_{2×2}$ and $A={\left[\begin{array}{ccc}5& 1& 3\\ 9& -1& 7\end{array}\right]}_{2×3}$

Solution: The addition of given matrices can't be evaluated as they don't have the same dimensions. Matrix A is of the order $2×2$ whereas matrix B is of the order $2×3$.

Example 3: Subtract matrix B from matrix A, where $A={\left[\begin{array}{cc}-3& 1\\ 5& 2\end{array}\right]}_{2×2}$ and $B={\left[\begin{array}{cc}7& -2\\ 6& 1\end{array}\right]}_{2×2}$

Solution: $A-B={\left[\begin{array}{cc}-3& 1\\ 5& 2\end{array}\right]}_{2×2}-{\left[\begin{array}{cc}7& -2\\ 6& 1\end{array}\right]}_{2×2}={\left[\begin{array}{cc}\left(-3-7\right)& \left(1+2\right)\\ \left(5-6\right)& \left(2-1\right)\end{array}\right]}_{2×2}={\left[\begin{array}{cc}-10& 3\\ -1& 1\end{array}\right]}_{2×2}$

Example 4: If $A={\left[\begin{array}{cc}4& 3\\ 5& -1\end{array}\right]}_{2×2}$, then evaluate $7A$.

Solution: $7A={\left[\begin{array}{cc}4×\left(7\right)& 3×\left(7\right)\\ 5×\left(7\right)& -1×\left(7\right)\end{array}\right]}_{2×2}={\left[\begin{array}{cc}28& 21\\ 35& -7\end{array}\right]}_{2×2}$. In this example, every element of matrix A is multiplied by 7 to produce the scalar multiple.

Example 5: If $X={\left[\begin{array}{ccc}2& -7& 3\\ 8& 5& 1\end{array}\right]}_{2×3}$, then find the value of $kX$ where $k=-1$.

Solution: $kX={\left[\begin{array}{ccc}\left(2\right)×\left(-1\right)& \left(-7\right)×\left(-1\right)& \left(3\right)×\left(-1\right)\\ \left(8\right)×\left(-1\right)& \left(5\right)×\left(-1\right)& \left(1\right)×\left(-1\right)\end{array}\right]}_{2×3}={\left[\begin{array}{ccc}-2& 7& -3\\ -8& -5& -1\end{array}\right]}_{2×3}$

In the example above, where $k=-1$, the resulting matrix obtained after scalar multiplication is called the negative of the given matrix.

Example 6: Find the product of two matrices X and Y, where $X={\left[\begin{array}{cc}2& -1\\ 5& 7\\ -3& 4\end{array}\right]}_{3×2}$ and $Y={\left[\begin{array}{cc}1& 6\\ 4& 2\\ 5& -1\end{array}\right]}_{3×2}$.

Solution: The product can't be evaluated since the number of columns in X (2 here) is NOT equal to the number of rows in Y (3 here).

Example 7: Find the product of two matrices A and B where $A={\left[\begin{array}{cc}2& -1\\ 5& 7\\ -3& 4\end{array}\right]}_{3×2}$ and $B={\left[\begin{array}{ccc}1& 5& 6\\ 3& 4& -2\end{array}\right]}_{2×3}$.

Solution: In this case, the number of columns in A (2 here) is equal to the number of rows in B (2 here), and hence product can be evaluated.

$AB={\left[\begin{array}{cc}2& -1\\ 5& 7\\ -3& 4\end{array}\right]}_{3×2}×{\left[\begin{array}{ccc}1& 5& 6\\ 3& 4& -2\end{array}\right]}_{2×3}$

$=\left[\begin{array}{ccc}\left(2\right)×\left(1\right)+\left(-1\right)×\left(3\right)& \left(2\right)×\left(5\right)+\left(-1\right)×\left(4\right)& \left(2\right)×\left(6\right)+\left(-1\right)×\left(-2\right)\\ \left(5\right)×\left(1\right)+\left(7\right)×\left(3\right)& \left(5\right)×\left(5\right)+\left(7\right)×\left(4\right)& \left(5\right)×\left(6\right)+\left(7\right)×\left(-2\right)\\ \left(-3\right)×\left(1\right)+\left(4\right)×\left(3\right)& \left(-3\right)×\left(5\right)+\left(4\right)×\left(4\right)& \left(-3\right)×\left(6\right)+\left(4\right)×\left(-2\right)\end{array}\right]$

$=\left[\begin{array}{ccc}2-3& 10-4& 12+2\\ 5+21& 25+28& 30-14\\ -3+12& -15+16& -18-8\end{array}\right]$

$=\left[\begin{array}{ccc}-1& 6& 14\\ 26& 53& 16\\ 9& 1& -26\end{array}\right]$

Example 8: Find the transpose of a matrix $A={\left[\begin{array}{ccc}2& -3& 1\\ 4& -5& 6\end{array}\right]}_{2×3}$

Solution: ${A}^{T}={\left[\begin{array}{cc}2& 4\\ -3& -5\\ 1& 6\end{array}\right]}_{3×2}$. It should be noted that the order of $A$ is $2×3$ while the order of ${A}^{T}$ is $3×2$.

Example 9: If $A=\left[\begin{array}{cc}9& -11\\ -2& 6\end{array}\right]$ and $B=\left[\begin{array}{cc}1& -6\\ 8& 5\end{array}\right]$, then find the value of ${\left(A+2B\right)}^{T}$.

Solution: ${\left(A+2B\right)}^{T}={A}^{T}+2{B}^{T}$$=\left[\begin{array}{cc}9& -2\\ -11& 6\end{array}\right]+\left[\begin{array}{cc}2& 16\\ -12& 10\end{array}\right]=\left[\begin{array}{cc}11& 14\\ -23& 16\end{array}\right]$

## Cheat Sheet

• Two matrices to be added must be of the same order (size).
• Each element of one matrix is added to the corresponding elements of the other matrix.
• It follows commutative as well as associative laws.

Matrix Subtraction:

• Two matrices to be subtracted must be of the same order (size).
•  Each element of one matrix is subtracted from the corresponding parts of the other matrix.
• It does not obey commutative and associative laws.

Scalar Multiplication:

• Each matrix element is multiplied by the same scalar (number) to obtain a scalar multiple.

Matrix multiplication (multiplying a matrix by another matrix):

• The product of two matrices, A and B, is only possible when the number of columns of A is equal to the number of rows of B; otherwise, not.
• In general, it is not commutative.
• It obeys associative and distributive laws.

Transpose of a Matrix:

• It is the matrix obtained after interchanging the rows and columns of a given matrix.
• Any square matrix can be represented as the sum of a symmetric and a skew-symmetric matrix.

## Blunder Areas

• If the product of two matrices AB is defined, then BA need not be defined.
• If AB and BA are defined, then it is not necessarily true that $AB=BA$.
• It should be kept in mind that ${\left(AB\right)}^{T}={B}^{T}{A}^{T}$.