Matrix has a special function called trace function. If is a square matrix then the sum of its main diagonal entry is called trace of matrix and is denoted by .

Let be a square matrix with size , then

```
The trace of matrix is
```

Let is see few examples of traces of matrices.

**Example #1**

```
Let A be a square matrix of size
The trace of matrix is
```

**Example #2**

```
Let B be a square matrix of size
The trace of matrix is
```

If the matrix A is not a square matrix, then is not defined.