# Matrix

A **matrix** is best thought of as a grid, composed of elements organized in 'p' rows and 'q' columns.$$ A : = \begin{pmatrix} a_{11} & a_{12} & \dots & a_{1j} & ... & a_{1q} \\ a_{21} & a_{22} & \dots & a_{2j} & ... & a_{2q} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ a_{i1} & a_{i2} & \dots & a_{ij} & \dots & a_{iq} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ a_{p1} & a_{p2} & \dots & a_{pj} & \dots & a_{pq} \end{pmatrix} $$

The order of the matrix, defined as the pair (p,q), signifies the number of rows and columns, respectively.

These values, p and q, are also referred to as the **dimensions** of the matrix.

**Example**. Take for instance a matrix with two rows and three columns. $$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} $$ This is an order (2,3) matrix, often called a 2x3 matrix. The dimensions, p=2 and q=3, denote the size of the matrix.

## Matrix Elements

Elements within a matrix are represented as **a _{ij}**, where 'i' denotes the row, and 'j' signifies the column of that element.

Here, 'i' signifies the row and 'j' the column of the element.

**Example**. Consider the 2x3 matrix below. The element at position (1,1) is a_{11}=1, while at position (1,2), we find a_{12}=2. $$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} $$ Following the same pattern, the rest of the elements are defined: a_{13}=3, a_{21}=4, a_{22}=5, and a_{23}=6.

The elements of the matrix are also called **coefficients**.

To indicate all elements of a matrix, we write:

$$ A=(a_{ij}) $$

## Square and Rectangular Matrices

There are two distinct categories of matrices based on their number of rows and columns.

**Square Matrices**

A matrix is referred to as a 'square' matrix when it has an equal number of rows and columns.**Example**. This matrix has two rows and two columns, and thus, it's a square matrix. $$ C= \begin{pmatrix} 1 & 3 \\ 7 & 2 \end{pmatrix} $$**Rectangular Matrices**

A matrix is termed a 'rectangular' matrix if the number of rows isn't equal to the number of columns.**Example**. This matrix has two rows and three columns, making it a rectangular matrix. $$ D = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} $$

## Families of Matrices

Matrices sharing the same number of rows (p) and columns (q) belong to the same family M(p,q) of matrices. $$ M(p,q) $$

If all elements of the matrix are real numbers, you can also denote the set of real numbers in the matrix family.

$$ M(p,q,R) $$

**Example**. Matrices A and B belong to the same matrix family M(2,2,R) because they each have two rows and two columns.