Mathematics

Matrices and determinants

Types of matrices, operations, calculation of rank, order, dimension, determinants, and inverse matrix.

A matrix is a set of numbers arranged in rows and columns. Example:
A=(251310240274)A = \begin{pmatrix} 2 & 5 & 1 & -3 \\ 1 & 0 & -2 & 4 \\ 0 & 2 & 7 & -4 \end{pmatrix}

Row matrix: Has only one row.
A=(251)A = \begin{pmatrix} 2 & 5 & 1 \end{pmatrix}

Column matrix: Has only 1 column.
A=(212)A = \begin{pmatrix} 2 \\ 1 \\ -2 \end{pmatrix}

Square matrix: Has the same number of rows as columns.
A=(251102027)A = \begin{pmatrix} 2 & 5 & 1 \\ 1 & 0 & -2 \\ 0 & 2 & 7 \end{pmatrix}

Zero matrix: All elements are 0.
A=(000000000)A = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}

Triangular matrix: The elements above or below its main diagonal are 0.
A=(251032007)A = \begin{pmatrix} 2 & 5 & 1 \\ 0 & 3 & -2 \\ 0 & 0 & 7 \end{pmatrix}

Diagonal matrix: The elements above and below its main diagonal are 0. It must be a square matrix.
A=(200030007)A = \begin{pmatrix} 2 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 7 \end{pmatrix}

Identity or unit matrix: A diagonal matrix where all the elements of its main diagonal are 1.
A=(100010001)A = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}

Transpose matrix: Given a matrix AA, the transpose is the matrix ATA^T obtained by swapping rows and columns.
A=(251102027)AT=(210502127)A = \begin{pmatrix} 2 & 5 & 1 \\ 1 & 0 & -2 \\ 0 & 2 & 7 \end{pmatrix} \qquad A^T = \begin{pmatrix} 2 & 1 & 0 \\ 5 & 0 & 2 \\ 1 & -2 & 7 \end{pmatrix}

Symmetric matrix: A square matrix equal to its transpose:
A=ATA = A^T
It is denoted by rank A. It is the number of linearly independent lines (rows or columns), or also:
It is the dimension of the largest non-zero minor.
For a matrix A with dimensions m×nm \times n, its rank cannot be greater than the smallest dimension of A.
Calculating the rank by the Gauss-Jordan method.
In general, it consists of making the maximum number of lines zero by applying elementary row operations, and the rank will be the number of non-zero rows:
Elementary operations are:
  • Multiplying a row by a non-zero number.
  • Adding (or subtracting) to a row the multiple of another row.
  • Swapping the order of the rows.
Calculating the rank using determinants.
It consists of finding non-zero minors of the highest possible order, meaning, starting with the "largest" minors of A, and reducing the size until finding one that is non-zero.
The order or dimension of a matrix indicates the number of rows and number of columns. It is denoted as m×nm \times n (mm being the number of rows, and nn the number of columns). E.g.:
A3×4=(252110721329)A_{3\times 4} = \begin{pmatrix} 2 & 5 & 2 & 1 \\ 1 & 0 & 7 & -2 \\ -1 & 3 & 2 & 9 \end{pmatrix}
If the matrix is square, it can be called a square matrix of order nn, where nn is the number of rows and columns.
Matrix addition: They must have the same dimensions. It is obtained by adding the elements in the same position (element-wise addition).
(1325)+(4022)=(3307)\begin{pmatrix} 1 & 3 \\ -2 & 5 \end{pmatrix} + \begin{pmatrix} -4 & 0 \\ 2 & 2 \end{pmatrix} = \begin{pmatrix} -3 & 3 \\ 0 & 7 \end{pmatrix}
Product of a real number and a matrix: A matrix of the same order is obtained, in which each element is multiplied by said real number.
5(1325)=(5151025)5 \cdot \begin{pmatrix} 1 & 3 \\ -2 & 5 \end{pmatrix} = \begin{pmatrix} 5 & 15 \\ -10 & 25 \end{pmatrix}
Matrix multiplication: Two matrices A and B can be multiplied if the number of columns in A equals the number of rows in B. We obtain a matrix that has the same number of rows as A and the same number of columns as B. The element cijc_{ij} of the product matrix is obtained by multiplying each element of row ii of matrix A by its corresponding element of column jj of matrix B and adding them. Example:
(234010)(4101)=(24+3021+3144+0041+0114+0011+01)=(8516441)\begin{pmatrix} 2 & 3 \\ 4 & 0 \\ -1 & 0 \end{pmatrix} \cdot \begin{pmatrix} 4 & 1 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 2\cdot 4 + 3\cdot 0 & 2\cdot 1 + 3\cdot 1 \\ 4\cdot 4 + 0\cdot 0 & 4\cdot 1 + 0\cdot 1 \\ -1\cdot 4 + 0\cdot 0 & -1\cdot 1 + 0\cdot 1 \end{pmatrix} = \begin{pmatrix} 8 & 5 \\ 16 & 4 \\ -4 & -1 \end{pmatrix}
Matrix multiplication is not commutative:
ABBAA \cdot B \neq B \cdot A
Definition: Let A be a square matrix. The inverse matrix of A, denoted by A1A^{-1}, satisfies:
AA1=IA \cdot A^{-1} = I
Where II is the identity matrix of the same dimension as A.
Matrices that have an inverse are called regular or invertible. Otherwise, they are called singular or degenerate.
A matrix is invertible if its determinant is non-zero.

Properties of the inverse matrix:
(AB)1=B1A1(A1)1=A(kA)1=k1A1=1kA1(AT)1=(A1)TA1=1A\begin{aligned} (A \cdot B)^{-1} &= B^{-1} \cdot A^{-1} \\ (A^{-1})^{-1} &= A \\ (k \cdot A)^{-1} &= k^{-1} \cdot A^{-1} = \frac{1}{k} A^{-1} \\ (A^T)^{-1} &= (A^{-1})^T \\ |A^{-1}| &= \frac{1}{|A|} \end{aligned}
Every square matrix is associated with a real number called its determinant, and it is denoted by detA=A\det A = |A|

Determinant of a 2 x 2 matrix
2x2 Determinant

Determinant of a 3 x 3 matrix:
We expand it by copying the first two columns and adding them at the end. We perform the calculation indicated in the figure:
Sarrus rule 3x3

Determinant of a 4 x 4 matrix:
Choose a row or column with the greatest possible number of zeros. We multiply each element by its cofactor.
Ex.: finding the determinant by cofactors of the 2nd column
1033210402111031=0+1(1)2+2133011131+2(1)3+2133204131+0=26\begin{vmatrix} 1 & 0 & 3 & 3 \\ 2 & 1 & 0 & 4 \\ 0 & 2 & 1 & 1 \\ 1 & 0 & 3 & 1 \end{vmatrix} = 0 + 1 \cdot (-1)^{2+2} \begin{vmatrix} 1 & 3 & 3 \\ 0 & 1 & 1 \\ 1 & 3 & 1 \end{vmatrix} + 2 \cdot (-1)^{3+2} \begin{vmatrix} 1 & 3 & 3 \\ 2 & 0 & 4 \\ 1 & 3 & 1 \end{vmatrix} + 0 = -26
  • A determinant is zero, A=0|A| = 0 if:
    • It has two equal or proportional rows or columns.
    • All elements of a row or column are 0.
    • The elements of a row or column are a linear combination of the others.
  • The determinant of a matrix and that of its transpose are equal:
    A=AT\displaystyle |A| = |A^T|
  • A triangular determinant is equal to the product of the elements of its main diagonal.
  • If two rows or two columns are swapped in a determinant, its value changes sign.
  • If the elements of one row or column are added to another row or column multiplied by a real number, the value does not change.
  • If a determinant is multiplied by a real number, any row (or any column) is multiplied by that number, but only one.
    21324=213224\displaystyle 2 \cdot \begin{vmatrix} 1 & 3 \\ 2 & 4 \end{vmatrix} = \begin{vmatrix} 2\cdot 1 & 3 \\ 2\cdot 2 & 4 \end{vmatrix}
    From which it follows: kA=knA|k \cdot A| = k^n |A| Where nn is the order of the determinant.
  • If all elements of a row (or column) consist of two terms, that determinant can be decomposed into the sum of two determinants in which the other rows (or columns) remain invariant.
    1+23+457=1357+2457\displaystyle \begin{vmatrix} 1+2 & 3+4 \\ 5 & 7 \end{vmatrix} = \begin{vmatrix} 1 & 3 \\ 5 & 7 \end{vmatrix} + \begin{vmatrix} 2 & 4 \\ 5 & 7 \end{vmatrix}
  • The product is commutative: AB=BA|A| \cdot |B| = |B| \cdot |A|
  • The determinant of the product of two matrices is equal to the product of their determinants: AB=AB|A \cdot B| = |A| \cdot |B|
The Minor of a matrix is the determinant of any k×kk \times k submatrix.

The Cofactor of an element aija_{ij} is the value of the determinant of order n1n-1 obtained by deleting row ii and column jj from the matrix.
Cofactor

The Cofactor (with sign) of an element aija_{ij} of a matrix is its minor multiplied by (1)i+j(-1)^{i+j}.
The adjugate matrix, AA^*, or matrix of cofactors, is the one in which each element is replaced by its cofactor.
A=Adj(251102027)=(022712071002512721072502510221122510)=(472331441055)A^* = Adj \begin{pmatrix} 2 & 5 & 1 \\ 1 & 0 & -2 \\ 0 & 2 & 7 \end{pmatrix} = \begin{pmatrix} \begin{vmatrix} 0 & -2 \\ 2 & 7 \end{vmatrix} & -\begin{vmatrix} 1 & -2 \\ 0 & 7 \end{vmatrix} & \begin{vmatrix} 1 & 0 \\ 0 & 2 \end{vmatrix} \\ -\begin{vmatrix} 5 & 1 \\ 2 & 7 \end{vmatrix} & \begin{vmatrix} 2 & 1 \\ 0 & 7 \end{vmatrix} & -\begin{vmatrix} 2 & 5 \\ 0 & 2 \end{vmatrix} \\ \begin{vmatrix} 5 & 1 \\ 0 & -2 \end{vmatrix} & -\begin{vmatrix} 2 & 1 \\ 1 & -2 \end{vmatrix} & \begin{vmatrix} 2 & 5 \\ 1 & 0 \end{vmatrix} \end{pmatrix} = \begin{pmatrix} 4 & -7 & 2 \\ -33 & 14 & -4 \\ -10 & 5 & -5 \end{pmatrix}
Calculation by the definition of the inverse matrix:
AA1=IA \cdot A^{-1} = I

Gauss method for calculating the inverse matrix
Steps to follow:
  • We write a double matrix, containing matrix A on the left and the identity matrix on the right.
    (12103101)\displaystyle \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 3 & -1 & 0 & 1 \end{array}\right)
  • We perform elementary operations (Linear combinations) on the left matrix until it is transformed into the identity matrix, performing the same operations on the right.
    (12103101)R23R1(12100731)7R1+2R2(70120731)×1/7R1,×1/7R2(101/72/7013/71/7)\displaystyle \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 3 & -1 & 0 & 1 \end{array}\right) \xrightarrow{R_2 - 3R_1} \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & -7 & -3 & 1 \end{array}\right) \xrightarrow{7R_1 + 2R_2} \left(\begin{array}{cc|cc} 7 & 0 & 1 & 2 \\ 0 & -7 & -3 & 1 \end{array}\right) \xrightarrow{\times 1/7 R_1, \times -1/7 R_2} \left(\begin{array}{cc|cc} 1 & 0 & 1/7 & 2/7 \\ 0 & 1 & 3/7 & -1/7 \end{array}\right)
    The matrix obtained on the right is the inverse we are looking for.

Calculation using the adjugate matrix:
A1=(A)TAA^{-1} = \frac{(A^*)^T}{|A|}

Inverse of a 2 x 2 Matrix A 2 x 2 matrix has an easy-to-remember inverse according to the following formula:
A=(abcd)    A1=1A(dbca)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \implies A^{-1} = \frac{1}{|A|} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}