# Algebra of Matrices

• Definition: Matrices can be added if they have the same dimensions (same number of rows and columns).
• Representation: If $A$and $B$ are $m×n$ matrices, their sum $C=A+B$ is obtained by adding corresponding elements.
• Example:
$A=\left[\begin{array}{cc}1& 2\\ 3& 4\end{array}\right],\phantom{\rule{1em}{0ex}}B=\left[\begin{array}{cc}5& 6\\ 7& 8\end{array}\right]$
$A+B=\left[\begin{array}{cc}1+5& 2+6\\ 3+7& 4+8\end{array}\right]=\left[\begin{array}{cc}6& 8\\ 10& 12\end{array}\right]$

### Properties:

1. Commutative: $A+B=B+A$ if $A$ and $B$ have the same dimensions.

2. Associative: $\left(A+B\right)+C=A+\left(B+C\right)$ if all matrices involved have the same dimensions.

3. Zero Matrix: $A+O=A$, where $O$ is the zero matrix. Adding a zero matrix to any matrix yields the original matrix.

4. Additive Inverse: For any matrix $A$, there exists a matrix $-A$ such that $A+\left(-A\right)=O$, where $O$ is the zero matrix.

### Subtraction of Matrices:

Matrices can be subtracted from each other if they have the same dimensions. Subtraction is performed element-wise, subtracting the corresponding elements from one matrix with the corresponding elements from another matrix.

### Representation:

Given two matrices $A$ and $B$ of the same dimensions:

• The subtraction of $A$ from $B$ is denoted as $B-A=C$, where ${C}_{ij}={B}_{ij}-{A}_{ij}$.

### Example:

Consider two matrices $A$ and $B$ as follows:

$A=\left[\begin{array}{cc}3& 2\\ 5& 4\end{array}\right]$
$B=\left[\begin{array}{cc}7& 1\\ 6& 9\end{array}\right]$

Their subtraction $B-A$ would be:

$B-A=\left[\begin{array}{cc}7& 1\\ 6& 9\end{array}\right]-\left[\begin{array}{cc}3& 2\\ 5& 4\end{array}\right]=\left[\begin{array}{cc}7-3& 1-2\\ 6-5& 9-4\end{array}\right]=\left[\begin{array}{cc}4& -1\\ 1& 5\end{array}\right]$

### Properties:

1. Commutative: $A-B=B-A$ if $A$and $B$ have the same dimensions.

2. Associative: $\left(A-B\right)-C=A-\left(B-C\right)$ if all matrices involved have the same dimensions.

3. Zero Matrix: $A-O=A$, where $O$is the zero matrix. Subtracting a zero matrix from any matrix yields the original matrix.

4. Additive Inverse: For any matrix $A$, there exists a matrix $-A$ such that $A+\left(-A\right)=O$, where $O$ is the zero matrix.

### Scalar Multiplication:

• Definition: Multiplying a matrix by a scalar multiplies each element of the matrix by that scalar.
• Representation: If $k$ is a scalar and $A$ is an $m×n$ matrix, $k\cdot A$ is obtained by multiplying each element of $A$ by $k$.
• Example:
$k=3,\phantom{\rule{1em}{0ex}}A=\left[\begin{array}{cc}2& 4\\ 1& 3\end{array}\right]$
$k\cdot A=3\cdot \left[\begin{array}{cc}2& 4\\ 1& 3\end{array}\right]=\left[\begin{array}{cc}6& 12\\ 3& 9\end{array}\right]$

### Properties:

1. Associative Property: $\left(kl\right)A=k\left(lA\right)$, where $k$ and $l$ are scalars and $A$ is a matrix.

2. Distributive Property: $k\left(A+B\right)=kA+kB$, where $A$ and $B$ are matrices and $k$ is a scalar.

3. Distributive Property with Scalars: $\left(k+l\right)A=kA+lA$, where $k$ and $l$ are scalars and $A$ is a matrix.

### Multiplication of Matrices:

• Definition: The number of columns in the first matrix must be equal to the number of rows in the second matrix.
• Representation: If $A$is an $m×n$ matrix and $B$ is an $n×p$ matrix, their product $C=A\cdot B$ will be an $m×p$ matrix.
• Example:
$A=\left[\begin{array}{cc}1& 2\\ 3& 4\end{array}\right],\phantom{\rule{1em}{0ex}}B=\left[\begin{array}{cc}5& 6\\ 7& 8\end{array}\right]$
$A\cdot B=\left[\begin{array}{cc}\left(1×5+2×7\right)& \left(1×6+2×8\right)\\ \left(3×5+4×7\right)& \left(3×6+4×8\right)\end{array}\right]=\left[\begin{array}{cc}19& 22\\ 43& 50\end{array}\right]$
1. Dimensions Compatibility Rule:

• For matrix multiplication $C=AB$, the number of columns in matrix $A$ must be equal to the number of rows in matrix $B$.
• If $A$ is an $m×n$ matrix and $B$ is an $n×p$ matrix, the resulting matrix $C=AB$ will be an $m×p$ matrix.
2. Element-wise Calculation:

• To compute the element ${c}_{ij}$ in the resulting matrix $C=AB$, the $i$th row of matrix $A$ is multiplied element-wise with the $j$th column of matrix $B$, and the products are summed.
• ${c}_{ij}={a}_{i1}×{b}_{1j}+{a}_{i2}×{b}_{2j}+\dots +{a}_{in}×{b}_{nj}$.
3. Non-Commutative Property:

• Matrix multiplication is not commutative in most cases: $AB\mathrm{\ne }BA$The order matters in matrix multiplication.

### Properties of Matrix Algebra:

• Associative Property: $\left(AB\right)C=A\left(BC\right)$
• Distributive Property: $A\left(B+C\right)=AB+AC$
• Not Commutative: In general, $AB\mathrm{\ne }BA$(matrix multiplication is not commutative).
• Identity Matrix:
• $IA=AI=A$ - Multiplying a matrix by an identity matrix leaves the matrix unchanged.

#### Inverse Matrix:

• $A×{A}^{-1}={A}^{-1}×A=I$ - The inverse of a matrix, if it exists, multiplied by the original matrix results in the identity matrix.