## Introduction

In this article we talk about **matrices **in mathematics, **how they are defined**, what **types of matrices** there are and we are going to see some **examples**.

A matrix is an **ordered array of numbers**, consisting of a series of rows and columns, such that **each element occupies a position** and can be identified by its row and column number.

Given two matrices we can perform certain operations between them as long as they meet certain conditions.

One of the most useful applications of matrices is the **resolution of systems of equations**. For example, if we have a system of two equations with two variables, we can represent this system with a 2×2 square matrix (let’s call it **A**), multiplied by a **column vector** of variables (**vector x**) and that product equals the column **vector of independent terms** (let’s say **B**). This system would be represented as follows:

**A.x = B**

This is very reminiscent of a simple linear equation in which we have an unknown (**x**) that is multiplied by a coefficient (**A**) and this is equal to a value (**B**), to solve this linear equation it is enough to divide both members by the coefficient A and in this way we would find the unknown x. It is not possible to make divisions with matrices but we can use an analogous operation which is to multiply both members by the inverse matrix of **A** (as long as the inverse matrix of **A** exists), with this the unknown vector can be found.

**x = A ^{-1}.B **

## Definition of a Matrix in Mathematics

A matrix is represented by a letter of the alphabet in uppercase (for example A, B, C…), then we can make its elements explicit, for this we will write its numbers in a table that will contain a certain number of rows and columns.

In figure 1 we see an example of a generic matrix A of * m* rows and

**columns, we see that on the right of the equality the matrix has been made explicit by writing its elements a**

*n*_{ij}.

The matrix in figure 1 refers to **any matrix**, it is often used for matrix **definitions **and **properties**.

## Examples of matrices with values

We are going to see examples of matrices that have particular characteristics either by their size or by the way in which their elements are distributed.

### Square Matrix

A square matrix is a matrix in which **the number of rows matches the number of columns**. In figure 2 we see an example of a matrix B with 3 rows and 3 columns.

In a square matrix we have a **main diagonal** that are the elements **b _{ij}** for which

**i=j**, in the case of figure 2 are the elements b

_{11}, b

_{22}and b

_{33}whose values are 1, 0 and 2 respectively.

**The main diagonal divides the matrix into two parts**, an upper triangle and a lower triangle.

### Diagonal Matrix

A **diagonal matrix** is a matrix in which all its** non-zero elements** are located on the **main diagonal** and the rest of the elements are 0. In figures 3 and 4 we see examples of diagonal matrices, in particular the matrix in figure 4 is known as the **identity matrix**.

### Triangular Matrix

A **triangular matrix** is a matrix that has **all its non-zero elements on one side of the main diagonal** and the rest of the elements are 0. We can have **upper triangular matrices** and **lower triangular matrices**, as shown in figures 5 and 6 respectively.

## Conclusion

A matrix in mathematics is an **array of ordered numbers **in a fixed number of rows and columns.

**Square matrices** are matrices in which **the number of rows matches the number of columns**. In a square matrix we have a **main diagonal** which is the element in which **the row number coincides with the column number**.

A **diagonal matrix** is a square matrix in which **all its non-zero elements are on the main diagonal**. Particularly the identity matrix is a diagonal matrix in which all elements have a value of 1.

**Triangular matrices** are those in which **all the non-zero elements are on the main diagonal and above or below**, hence we can classify them in **upper **or **lower triangular matrix**.

**Related Articles**

**Vectors in math****Algorithm to transpose matrices – C# Unity****Algorithm to multiply matrices – C# Unity****Define a matrix in programming – C# Language****Algorithm to add and substract matrices – C# Unity**