# Matrices

A matrix is an ordered arrangement of rectangular arrays of numbers or functions. The numbers (or functions) are written in between square brackets.

For example:

$\begin{bmatrix} 2 & 5 & 1\\ 7 & 9 & 3\\ -4 & 5 & 6 \end{bmatrix}$

The horizontal lines consisting elements are said to be rows of a matrix and the vertical lines are said to be column of a matrix.

## Order of a Matrix:

A matrix having m rows and n columns is called a matrix of order $m \times n$ or matrix $m \times n$.

The above matrix has 3 rows and 3 columns, therefore the order of the above matrix is $3 \times 3$.

The general form of $m \times n$ matrix has following rectangular arrangement of array:

$A = [a_{ij}]_{m \times n} = \begin{bmatrix} a_{11} & a_{12} & … & a_{1n}\\ a_{21} & a_{22} & … & a_{2n}\\ .& .& … &. \\ .& . & … &. \\ a_{m1} & a_{m2} & … & a_{mn} \end{bmatrix} _{m \times n}$

where $1 \leq i \leq m, 1 \leq j \leq n, \;\; i,j \in N$

### Types of Matrices:

Let us now have a look over different types of matrices

 S.no Types of matrices Example 1 Row Matrix $\begin{bmatrix} 2 & 5 & 3 \end{bmatrix}$ 2 Column Matrix $\begin{bmatrix} 1\\ 5 \end{bmatrix}$ 3 Square Matrix $\begin{bmatrix} 4 & 2\\ 1 & 7 \end{bmatrix}$ 4 Diagonal Matrix $\begin{bmatrix} 4 & 0 & 0\\ 0 & 7 & 0 \\ 0 & 0 & 5\\ \end{bmatrix}$ 5 Scalar Matrix $\begin{bmatrix} 3 & 0 & 0\\ 0 & 3 & 0 \\ 0 & 0 & 3\\ \end{bmatrix}$ 6 Identity Matrix $\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 1\\ \end{bmatrix}$ 7 Zero Matrix $\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0 \\ 0 & 0 & 0\\ \end{bmatrix}$

### Addition and Subtraction of Matrices:

Two matrices can be added if they are of the same order.

Addition: If two matrix A and B have the same order, then the sum can be found by simply adding the corresponding elements $a_{ij} + b_{ij}$.

Eg:

$\begin{bmatrix} 8 & 12 & 6 & 2\\ 0 & 9 & 7 & 1\\ 15 & 11 & 3 & 5\\ 20 & 9 & 0 & 4 \end{bmatrix} + \begin{bmatrix} 2 & -8 & 0 & 5\\ 14 & -5 & 3 & -4\\ 1 & -8 & 6 & -4\\ -15 & 1 & 11 & -7 \end{bmatrix} = \begin{bmatrix} 10 & 4 & 6 & 7\\ 14 & 4 & 10 & -3\\ 16 & 6 & 9 & 1\\ 5 & 10 & 11 & -3 \end{bmatrix}$

Subtraction: If two matrix A and B have the same order, then the subtraction can be found by subtracting the corresponding element $a_{ij} – b_{ij}$.

Eg:

$\begin{bmatrix} 4 & 7 \\ -3 & 12 \end{bmatrix} – \begin{bmatrix} 3 & -3 \\ 17 & 9 \end{bmatrix} = \begin{bmatrix} 1 & 10 \\ -20 & 3 \end{bmatrix}$

### Multiplication of Matrices:

Matrix multiplication is of two types-

(i) Scalar Multiplication: If A = $[a_{ij}]_{m \times n}$ is a matrix and k is a scalar quantity, then kA is another matrix which is obtained by multiplying each element in A by the scalar quantity k, i.e. $kA = [k\;a_{ij}]_{m \times n}$.

Eg: $4\begin{bmatrix} 2 & 3\\ 7 & 6 \end{bmatrix} = \begin{bmatrix} 8 & 12\\ 28 & 24 \end{bmatrix}$

(ii) Vector Multiplication: Two matrices A and B can be multiplied if and only if the number of column of matrix A is equal to the number of rows of matrix B.

Consider matrix A = $[a_{ij}]_{m \times n}$ and matrix B = $[b_{ij}]_{p \times q}$, the multiplication of matrices is possible if and only if n = p.

Note: The order of multiplication of above matrices is ${m \times q}$.

i.e. $A_{m \times n} \times B_{p \times q} = M_{m \times q}$

where M is the resultant matrix formed by multiplication of matrices.

Let us now look at the rules for multiplication of matrices:

• Check if the multiplication between the two matrices is possible by the rule stated above.
• The first element of the first row by multiplication of matrices results in the summation of the following elements.
1. Multiply the first element of the first row (of Matrix A) to the first element of the first column (of Matrix B).
2. Multiply the second element of the first row (of Matrix A) to the second element of the first column ( of Matrix B) and so on.
3. Calculate and enter the result in as the first element of the first row of the result matrix.
• The second element in the first row of the multiplication of matrices result by the summation of the following elements:
1. Multiply the first element of the second row (of Matrix A) to the first element of the first column (of Matrix B).
2. Multiply the second element of the second row (of Matrix A) to the second element of the first column ( of Matrix B) and so on.
3. Calculate and enter the result in as the second element of the first row of the result matrix.
• Now repeat the same steps with the next row elements of the first matrix and keep entering the answers in the result matrix.
• Repeat for other rows and columns.

Let us understand through an example:

$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{bmatrix}_{3 \times 3} \times \begin{bmatrix} b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23}\\ b_{31} & b_{32} & b_{33} \end{bmatrix}_{3 \times 3} = \begin{bmatrix} (a_{11}\times b_{11} + a_{12}\times b_{21}+ a_{13}\times b_{31}) & (a_{11}\times b_{12} + a_{12}\times b_{22}+ a_{13}\times b_{32}) & (a_{11}\times b_{13} + a_{12}\times b_{23}+ a_{13}\times b_{33}) \\ (a_{21}\times b_{11} + a_{22}\times b_{21}+ a_{23}\times b_{31}) & (a_{21}\times b_{12} + a_{22}\times b_{22}+ a_{23}\times b_{32}) & (a_{21}\times b_{13} + a_{22}\times b_{23}+ a_{23}\times b_{33})\\ (a_{31}\times b_{11} + a_{32}\times b_{21}+ a_{33}\times b_{31}) & (a_{31}\times b_{12} + a_{32}\times b_{22}+ a_{33}\times b_{32}) & (a_{31}\times b_{13} + a_{32}\times b_{23}+ a_{33}\times b_{33}) \end{bmatrix}_{3 \times 3}$

 Example: Multiply the following matrix $\begin{bmatrix} 1 & 4\\ 2 & 9\\ 6 & 11 \end{bmatrix}_{3 \times 2} \times \begin{bmatrix} 2 & 5\\ 7 & 16\\ 9 & 17 \end{bmatrix}_{3 \times 2}$ Solution: As the number of column of first matrix is not equal to the number of rows of the second matrix. Therefore, the matrix multiplication is not possible. Example: Given: $A = \begin{bmatrix} 5 & 8 & 1\\ 3 & 6 & 11 \end{bmatrix}_{2 \times 3}$ $B = \begin{bmatrix} 2 & 9\\ 3 & 7\\ 0 & 1 \end{bmatrix}_{3 \times 2}$ Find the resultant matrix formed by multiplication of vectors $A \times B$ Solution: $A \times B = \begin{bmatrix} 5 & 8 & 1\\ 3 & 6 & 11 \end{bmatrix}_{2 \times 3} \times \begin{bmatrix} 2 & 9\\ 3 & 7\\ 0 & 1 \end{bmatrix}_{3 \times 2}$ $\Rightarrow A \times B = \begin{bmatrix} (5 \times 2 + 8 \times 3 + 1 \times 0) & (5 \times 9 + 8 \times 7 + 1 \times 1)\\ (3 \times 2 + 6 \times 3 + 11\times 0) & (3 \times 9 + 6 \times 7 + 11 \times 1) \end{bmatrix}_{2 \times 2}$ $\Rightarrow A \times B = \begin{bmatrix} (10 + 24 +0) & (45 + 56 + 1)\\ (6 + 18 + 0) & (27 + 42 + 1) \end{bmatrix}_{2 \times 2}$ $\Rightarrow A \times B = \begin{bmatrix} 34 & 102\\ 24 & 70 \end{bmatrix}_{2 \times 2}$<