# Algebra of Matrices

The algebra of matrices includes

2. Subtraction of Matrices
3. Multiplication of a Matrix by Scalar
4. Multiplication of Matrices

Two matrices $A$ and $B$ can be added only if the order of matrix $A$ is equal to the order of matrix $B$.

Then, addition $(A + B)$ of matrices $A$ and $B$ can be obtained by adding the corresponding elements $A$ and $B$. The order of $(A + B)$ is the same as the order of $A$ the order of $B$.

Suppose $A = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \end{array}} \right],\,\,\,B = \left[ {\begin{array}{*{20}{c}} {{b_{11}}}&{{b_{12}}}&{{b_{13}}} \\ {{b_{21}}}&{{b_{22}}}&{{b_{23}}} \end{array}} \right]$
Then $\begin{gathered} A + B = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \end{array}} \right] + \left[ {\begin{array}{*{20}{c}} {{b_{11}}}&{{b_{12}}}&{{b_{13}}} \\ {{b_{21}}}&{{b_{22}}}&{{b_{23}}} \end{array}} \right] \\ A + B = \left[ {\begin{array}{*{20}{c}} {{a_{11}} + {b_{11}}}&{{a_{12}} + {b_{12}}}&{{a_{13}} + {b_{13}}} \\ {{a_{21}} + {b_{21}}}&{{a_{22}} + {b_{22}}}&{{a_{23}} + {b_{23}}} \end{array}} \right] \\ \end{gathered}$

Example:
Let $A = \left[ {\begin{array}{*{20}{c}} 2&0&0 \\ 3&1&1 \\ 1&4&3 \end{array}} \right],\,\,\,\,B = \left[ {\begin{array}{*{20}{c}} { – 4}&1&4 \\ 3&0&5 \\ 6&{ – 9}&1 \end{array}} \right]$

Then $\begin{gathered} A + B = \left[ {\begin{array}{*{20}{c}} 2&0&0 \\ 3&1&1 \\ 1&4&3 \end{array}} \right] + \left[ {\begin{array}{*{20}{c}} { – 4}&1&4 \\ 3&0&5 \\ 6&{ – 9}&1 \end{array}} \right] \\ A + B = \left[ {\begin{array}{*{20}{c}} {2 + ( – 4)}&{0 + 1}&{0 + 4} \\ {3 + 3}&{1 + 0}&{1 + 5} \\ {1 + 6}&{4 + ( – 9)}&{3 + 1} \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} { – 2}&1&4 \\ 6&1&6 \\ 7&{ – 5}&4 \end{array}} \right] \\ \end{gathered}$

Subtraction of Matrices:
Subtraction of two matrices is similar to the addition of two matrices. Two matrices $A$ and $B$ are said to be conformable to subtraction $A – B$ if both $A$ and $B$ have the same order.

Subtraction can be done by taking the differences of the corresponding elements of matrices $A$ and $B$. The order of $A – B$ is the same as the order of $A$ and order of $B$.

Suppose $A = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \end{array}} \right],\,\,\,B = \left[ {\begin{array}{*{20}{c}} {{b_{11}}}&{{b_{12}}}&{{b_{13}}} \\ {{b_{21}}}&{{b_{22}}}&{{b_{23}}} \end{array}} \right]$
Then $\begin{gathered} A – B = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \end{array}} \right] – \left[ {\begin{array}{*{20}{c}} {{b_{11}}}&{{b_{12}}}&{{b_{13}}} \\ {{b_{21}}}&{{b_{22}}}&{{b_{23}}} \end{array}} \right] \\ A – B = \left[ {\begin{array}{*{20}{c}} {{a_{11}} – {b_{11}}}&{{a_{12}} – {b_{12}}}&{{a_{13}} – {b_{13}}} \\ {{a_{21}} – {b_{21}}}&{{a_{22}} – {b_{22}}}&{{a_{23}} – {b_{23}}} \end{array}} \right] \\ \end{gathered}$

Example:
Let $A = \left[ {\begin{array}{*{20}{c}} 2&0&0 \\ 3&1&1 \\ 1&4&3 \end{array}} \right],\,\,\,B = \left[ {\begin{array}{*{20}{c}} { – 4}&1&4 \\ 3&0&5 \\ 6&{ – 9}&1 \end{array}} \right]$

Then $\begin{gathered} A – B = \left[ {\begin{array}{*{20}{c}} 2&0&0 \\ 3&1&1 \\ 1&4&3 \end{array}} \right] – \left[ {\begin{array}{*{20}{c}} { – 4}&1&4 \\ 3&0&5 \\ 6&{ – 9}&1 \end{array}} \right] \\ A – B = \left[ {\begin{array}{*{20}{c}} {2 – ( – 4)}&{0 – 1}&{0 – 4} \\ {3 – 3}&{1 – 0}&{1 – 5} \\ {1 – 6}&{4 – ( – 9)}&{3 – 1} \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 6&{ – 1}&{ – 4} \\ 0&1&{ – 4} \\ { – 5}&{13}&2 \end{array}} \right] \\ \end{gathered}$

Multiplication of a Matrix by Scalar:
Let $A$ be any given matrix and let $k$ be any real number (scalar), then multiplication $kA$, of the matrix $A$ with the real number $k$ is obtained by multiplying each element of the matrix $A$ by $k$.

Suppose $A = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \end{array}} \right]$
Then $kA = \left[ {\begin{array}{*{20}{c}} {k{a_{11}}}&{k{a_{12}}}&{k{a_{13}}} \\ {k{a_{21}}}&{k{a_{22}}}&{k{a_{23}}} \end{array}} \right]$

Example:
Let $A = \left[ {\begin{array}{*{20}{c}} 4&1&2 \\ 3&0&5 \\ 6&4&{ – 1} \end{array}} \right]\,and\,k = 2$
Then $2A = \left[ {\begin{array}{*{20}{c}} {2(4)}&{2(1)}&{2(2)} \\ {2(3)}&{2(0)}&{2(5)} \\ {2(6)}&{2(4)}&{2( – 1)} \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 8&2&4 \\ 6&0&{10} \\ {12}&8&{ – 2} \end{array}} \right]$

Multiplication of Matrices:
Let $A$ and $B$ be any two given matrices, then the multiplication $AB$ can be possible only if the number of columns of matrix $A$ is equal to the number of rows of matrix $B$. Then multiplication $AB$ can be obtained by the following method.

The element (1,1) position of $AB$ is obtained by adding the products of the corresponding elements of the 1st row of $A$ and the 1st column of $B$. Similarly, the element (1,2) position of $AB$ is obtained by adding the products of the corresponding elements of the 2nd row of $A$ and the 2nd column of $B$ and so on.

Suppose $A = \left[ {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{12}}}&{{a_{13}}} \\ {{a_{21}}}&{{a_{22}}}&{{a_{23}}} \\ {{a_{31}}}&{{a_{32}}}&{{a_{33}}} \end{array}} \right],\,\,\,B = \left[ {\begin{array}{*{20}{c}} {{b_{11}}}&{{b_{12}}} \\ {{b_{21}}}&{{b_{22}}} \\ {{b_{31}}}&{{b_{32}}} \end{array}} \right]$

$AB = \left[ {\begin{array}{*{20}{c}} {{a_{11}}{b_{11}} + {a_{12}}{b_{21}} + {a_{13}}{b_{31}}}&{{a_{11}}{b_{12}} + {a_{12}}{b_{22}} + {a_{13}}{b_{32}}} \\ {{a_{21}}{b_{11}} + {a_{22}}{b_{21}} + {a_{23}}{b_{31}}}&{{a_{21}}{b_{12}} + {a_{22}}{b_{22}} + {a_{23}}{b_{32}}} \\ {{a_{31}}{b_{11}} + {a_{32}}{b_{21}} + {a_{33}}{b_{31}}}&{{a_{31}}{b_{12}} + {a_{32}}{b_{22}} + {a_{33}}{b_{32}}} \end{array}} \right]$

Example:
Let $A = \left[ {\begin{array}{*{20}{c}} 1&2&3 \\ 4&5&6 \end{array}} \right],\,\,\,B = \left[ {\begin{array}{*{20}{c}} 7&1 \\ 8&2 \\ 9&3 \end{array}} \right]$
Since number of columns of $A$ is 3 and number of rows of $B$ is also 3,  $AB$ can be found.

i.e.
$\begin{gathered} AB = \left[ {\begin{array}{*{20}{c}} 1&2&3 \\ 4&5&6 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} 7&1 \\ 8&2 \\ 9&3 \end{array}} \right] \\ AB = \left[ {\begin{array}{*{20}{c}} {(1)(7) + (2)(8) + (3)(9)}&{(1)(1) + (2)(2) + (3)(3)} \\ {(4)(7) + (5)(8) + (6)(9)}&{(4)(1) + (5)(2) + (6)(3)} \end{array}} \right] \\ AB = \left[ {\begin{array}{*{20}{c}} {7 + 16 + 27}&{1 + 4 + 9} \\ {28 + 40 + 54}&{4 + 10 + 18} \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {50}&{14} \\ {122}&{32} \end{array}} \right] \\ \end{gathered}$