## Basic Operation on Matrices

 2.2 Basic Operation on Matrices

 Addition and Subtraction of Matrices Addition and subtraction of matrices can only be performed on the matrices witht he same order. Each corresponding element is added or subtracted to obtain a single matrix with the same order. For matrix A=\begin{aligned}\begin{bmatrix} a_{11}&a_{12}\\ a_{21}&a_{22}\end{bmatrix}\end{aligned} and B=\begin{aligned}\begin{bmatrix} b_{11}&b_{12}\\ b_{21}&b_{22}\end{bmatrix}\end{aligned}, A+B=\begin{aligned}\begin{bmatrix} a_{11}+b_{11}&a_{12}+b_{12}\\ a_{21}+b_{21}&a_{22}+b_{2}\end{bmatrix}\end{aligned} and A-B=\begin{aligned}\begin{bmatrix} a_{11}-b_{11}&a_{12}-b_{12}\\ a_{21}-b_{21}&a_{22}-b_{2}\end{bmatrix}\end{aligned}.
 Example 2 It is given that C=\begin{aligned}\begin{bmatrix} 10&-8&4\\ 6&-11&7\end{bmatrix}\end{aligned}  and D=\begin{aligned}\begin{bmatrix} 14&-2&1\\ -3&5&9\end{bmatrix}\end{aligned}, calculate a) $$C+D$$ b) $$D-C$$ Solution: (a) \begin{aligned} \hspace{1mm}&C+D\\&\hspace{-2mm}=\begin{bmatrix} 10+14&-8+(-2)&4+1\\ 6+(-3)&-11+5&7+9\end{bmatrix}\\&\hspace{-2mm}=\begin{bmatrix} 24&-10&5\\ 3&-6&7+16\end{bmatrix}\end{aligned}           (b) \begin{aligned}& \hspace{1mm}D-C\\&\hspace{-2mm}=\begin{bmatrix}14-10&-2-(-8)&1-4\\ -3-6&5-(-11)&9-7\end{bmatrix}\\&\hspace{-2mm}=\begin{bmatrix} 4&6&-3\\ -9&16&2\end{bmatrix}\end{aligned}
 Multiplication of a matrix by a number Multiplication of a matrix by a number is a process of repeated addition of the matrix. If matrix $$A$$ is multiplied by a number $$n$$, then matrix $$A$$ can be added to the same matrix $$A$$ repeatedly for $$n$$ times, that is $$nA=A+A+\dots+A \hspace{1mm}(n \hspace{1mm}\text{times})$$ This formula means that each element in matrix A is added to the same element repeatedly for $$n$$ times. Therefore, to multiply a matrix by a number, multiply every element in the matrix with the number. For example: It is given that matrix A=\begin{aligned}\begin{bmatrix} a_{11}&a_{12}\\ a_{21}&a_{22}\end{bmatrix}\end{aligned} and $$n$$ is a number. Hence nA=\begin{aligned}\begin{bmatrix} n(a_{11})&n(a_{12})\\ n(a_{21})&n(a_{22})\end{bmatrix}\end{aligned}.
 Example 3 It is given that F=\begin{aligned}\begin{bmatrix} 10&-8\\ 6&-11\\5&7\end{bmatrix}\end{aligned}, calculate $$3F$$. Solution: \begin{aligned}3F&=\begin{bmatrix} 3(10)&3(-8)\\ 3(6)&3(-11)\\3(5)&3(7)\end{bmatrix}\\&=\begin{bmatrix} 30&-24\\ 18&-33\\15&21\end{bmatrix}\end{aligned}.

The laws of arithmetic operations in matrices
Reminder: $$A-B=A+(-B)$$
 Commutative Law $$A+B=B+A$$ Distributive Law $$h(A+B)=hA+hB$$ Associative Law $$(A+B)+C=A+(B+C)$$ Addition of Zero Matrix $$A+0_{matrix}=A$$

 Example 4 Given that P=\begin{aligned}\begin{bmatrix} 14&-2\\ -3&5\end{bmatrix}\end{aligned} and Q=\begin{aligned}\begin{bmatrix} 3&-5\\ 7&11\end{bmatrix}\end{aligned}, calculate $$3(P-Q)$$. Solution: \begin{aligned}3(P-Q)&=3P-3Q\\&=3\begin{bmatrix} 14&-2\\ -3&5\end{bmatrix}\\&-3\begin{bmatrix} 3&-5\\ 7&11\end{bmatrix}\\&=\begin{bmatrix} 42&-6\\ -9&15\end{bmatrix}\\&-\begin{bmatrix} 9&-15\\ 21&33\end{bmatrix}\\& =\begin{bmatrix} 33&9\\ 30&-18\end{bmatrix}\end{aligned}

 Multiplication of two matrices To multiply two matrices, $$A$$ and $$B$$, the number of columns in matrix $$A$$ must be the same with the number of rows in matrix $$B$$. The number of rows in matrix $$A$$ and the number of columns in matrix $$B$$ become the order of the product of the two matrices, $$AB$$. If matrix $$A$$ has an order of $$m\times n$$ and matrix $$B$$ has an order of $$n\times p$$, then the multiplication $$AB$$ can be performed and the order of $$AB$$ is $$m\times p$$. For example: For matrix A=\begin{aligned}\begin{bmatrix} a_{11}&a_{12}\\ a_{21}&a_{22}\end{bmatrix}\end{aligned} and B=\begin{aligned}\begin{bmatrix} b_{11}&b_{12}&b_{13}\\ b_{21}&b_{22}&b_{23}\end{bmatrix}\end{aligned}, the multiplication of $$AB$$ can be performed and the order of $$AB$$ is $$2\times 3$$. However the multiplication of $$BA$$ cannot be performed because the number of columns in matrix $$B$$ is not the same as the number of rows of matrix $$A$$.
 Example 5 Given that matrix P=\begin{aligned}\begin{bmatrix} 2\\ -3\end{bmatrix}\end{aligned} and Q=\begin{aligned}\begin{bmatrix} 3&7\\ -5&2\\6&1\end{bmatrix}\end{aligned}, Calculate $$QP$$. Solution: \begin{aligned}QP&=\begin{bmatrix} (3)(2)+7(-3)\\ (-5)(2)+2(-3)\\(6)(2)+(1)(-3)\end{bmatrix}\\&=\begin{bmatrix} 15\\ -16\\9\end{bmatrix}\end{aligned}.
 What is the characteristics of the identity matrix? Identity matrix, $$I$$, is a matrix of order $$n\times n$$ with element 1 along the main diagonal and the other elements are 0, and when is multiplied with matrix $$A$$, its product is matrix $$A$$ ($$AI=IA=A$$). \begin{aligned} I=\begin{bmatrix} 1&0&0&\dots&0\\ 0&1&0&\dots&0\\ 0&0&1&\dots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0&0&0&\dots&1 \end{bmatrix} \end{aligned}
 What is the meaning of inverse matrix? Multiplication of matrix $$A$$ and inverse matrix of $$A$$, $$A^{-1}$$, will result in identity matrix, $$I$$ $$AA^{-1}=A^{-1}A=I$$ The inverse matrix of $$2\times 2$$ matrix: \begin{aligned} A&=\begin{bmatrix} a&b\\ c&d \end{bmatrix}\\\implies A^{-1}&=\frac{1}{ad-bc} \begin{bmatrix} d&-b\\ -c&a \end{bmatrix} \end{aligned} where $$ad-bc\neq 0$$.
 How to solve simultaneous equation? Simultaneous linear equations can be solved using the matrix method as shown in the steps below.