### Theory:

In this section, let us discuss different types of matrices.
1. Row matrix
A matrix is a row matrix when it is made up of just one row and '$$n$$' number of columns. Row matrices are also called row vectors.
For a matrix $$A = \begin{bmatrix} a_{11} & a_{12} & a_{13} & … & a_{1n} \end{bmatrix}$$, the order of the matrix is $$1$$ $$\times$$ $$n$$.
Example:
Let us look at a few row matrices.

1. $$A = \begin{bmatrix} \sqrt{2} & \frac{\sqrt 7}{2} & 12 \end{bmatrix}$$, where the order of the matrix is $$1$$ $$\times$$ $$3$$.

2. $$A = \begin{bmatrix} 7 & 14 & 21 & 28 & 35 & 42 & 49 \end{bmatrix}$$, where the order of the matrix is $$1$$ $$\times$$ $$7$$.
2. Column matrix
A matrix is a column matrix when it is made up of 'm' number of rows and just one column. Column matrices are also called column vectors.
For a matrix $$A = \begin{bmatrix} a_{11}\\ a_{21}\\ a_{31}\\ \vdots\\ a_{m1} \end{bmatrix}$$, the order of the matrix is $$m$$ $$\times$$ $$1$$.
Example:
Let us look at a few column matrices.

1. $$A = \begin{bmatrix} 2x\\ 3x\\ x \end{bmatrix}$$, where the order of the matrix is $$3$$ $$\times$$ $$1$$.

2. $$A = \begin{bmatrix} 4\\ 8\\ 12\\ 16\\ 20 \end{bmatrix}$$, where the order of the matrix is $$5$$ $$\times$$ $$1$$.
3. Square matrix
A matrix is a square matrix when the number of rows equals the number of columns. In other words, $$m$$ $$=$$ $$n$$.
The order of a square matrix is $$m$$.
Example:
Let us look at a few square matrices.

1. $$A = \begin{bmatrix} 1 & 2\\ 3 & 4 \end{bmatrix}$$, where the order of the matrix is $$2$$ $$\times$$ $$2$$.

2. $$A = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix}$$, where the order of the matrix is $$3$$ $$\times$$ $$3$$.
Leading diagonal of a square matrix:
In a square matrix, the entries $$a_{ij}$$ where $$i$$ $$=$$ $$j$$ form the leading diagonal of a matrix.
Example:
Let us consider the matrix given below.

$$A = \begin{bmatrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{bmatrix}$$

Here, the elements $$a_{11}$$, $$a_{22}$$ and $$a_{33}$$ form the elements of the leading diagonal.
4. Diagonal matrix
In a square matrix, when all the entries except the leading diagonal is zero, then it is called a diagonal matrix. In other words, $$a_{ij}$$ $$=$$ $$0$$ for $$i$$ $$\neq$$ $$j$$.
Example:
Let us look at a few diagonal matrices.

1. $$A = \begin{bmatrix} 1 & 0\\ 0 & 4 \end{bmatrix}$$

2. $$A = \begin{bmatrix} 1 & 0 & 0\\ 0 & 5 & 0\\ 0 & 0 & 9 \end{bmatrix}$$
5. Scalar matrix
In a square matrix, when all the elements of the leading diagonal is the same, then it is a scalar matrix
The general representation of a scalar matrix $$A$$ $$=$$ $$(a_{ij})_{m \times n}$$ is $$a_{ij} = \begin{cases} 0 & \text{ when } i \neq j \\ k & \text{ when } i = j \end{cases}$$, where $$k$$ is a constant.
Example:
Let us look at a few scalar matrices.

1. $$A = \begin{bmatrix} 7 & 0 & 0\\ 0 & 7 & 0\\ 0 & 0 & 7 \end{bmatrix}$$

2. $$A = \begin{bmatrix} \sqrt{3} & 0 & 0\\ 0 & \sqrt{3} & 0\\ 0 & 0 & \sqrt{3} \end{bmatrix}$$
6. Identity or unit matrix
In a square matrix, when all the leading diagonal elements are $$1$$, then it is an identity matrix or a unit matrix.
The general representation of a unit matrix $$A$$ $$=$$ $$(a_{ij})_{m \times n}$$ is $$a_{ij} = \begin{cases} 0 & \text{ when } i \neq j \\ 1 & \text{ when } i = j \end{cases}$$.
Example:
Let us look at a few identity matrices.

1. $$\begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix}$$

2. $$\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}$$
7. Zero matrix or null matrix
A matrix is a zero matrix or a null matrix when all the matrix elements are zero.
Example:
Let us look at a few null matrices.

1. $$\begin{bmatrix} 0 & 0\\ 0 & 0 \end{bmatrix}$$

2. $$\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}$$
8. Transpose of a matrix
The transpose of a matrix is obtained by interchanging the elements in the rows and columns. The transpose of a matrix is denoted by $$A^T$$, and $$A^T$$ is read as '$$A$$ $$\text{transpose}$$'.
If the order of matrix $$A$$ is $$m \times n$$, then the order of $$A^T$$ is $$n \times m$$.
Example:
Let us now look at a few examples.

1. If $$A = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix}$$, then $$A^T = \begin{bmatrix} 1 & 4 & 7\\ 2 & 5 & 8\\ 3 & 6 & 9 \end{bmatrix}$$.

2. If $$B = \begin{bmatrix} 1 & 2 & 3 & 4\\ 5 & 6 & 7 & 8\\ 9 & 10 & 11 & 12 \end{bmatrix}$$, then $$B^T = \begin{bmatrix} 1 & 5 & 9\\ 2 & 6 & 10\\ 3 & 7 & 11\\ 4 & 8 & 12 \end{bmatrix}$$.
9. Triangular matrix
If all the entries above the leading diagonal are zero in a square matrix, then it is a lower triangular matrix. If all the entries below the leading diagonal are zero, then it is an upper triangular matrix.
A matrix $$A$$ is a upper triangular matrix if $$a_{ij}$$ $$=$$ $$0$$ for $$i$$ $$>$$ $$j$$. Similarly, matrix $$A$$ is a lower triangular matrix if $$a_{ij}$$ $$=$$ $$0$$ for $$i$$ $$<$$ $$j$$.
Example:
Let us look at a few examples.

Upper triangular matrices:

$$A = \begin{bmatrix} 1 & 0 & 0\\ 2 & 3 & 0\\ 4 & 5 & 6 \end{bmatrix}$$,   $$B = \begin{bmatrix} 7 & 0 & 0\\ 8 & 9 & 0\\ 10 & 11 & 12 \end{bmatrix}$$

Lower triangular matrices:

$$C = \begin{bmatrix} 1 & 2 & 3\\ 0 & 4 & 5\\ 0 & 0 & 6 \end{bmatrix}$$,   $$D = \begin{bmatrix} 7 & 8 & 9\\ 0 & 10 & 11\\ 0 & 0 & 12 \end{bmatrix}$$