# Matrices

Matrix is a set of elements arranged in a rectangular table of m rows and n columns.

` | a`_{11} a_{12} a_{13} a_{14}|
A= | a_{21} a_{22} a_{23} a_{24}|
| a_{31} a_{32} a_{33} a_{34}|
| a_{41} a_{42} a_{43} a_{44}|

## square matrix

Square matrix is a matrix with the same number of rows and columns.

## zero matrix

Zero matrix it is a matrix with all elements equal to zero.

## main diagonal

The main diagonal of a matrix is the diagonal starting from the upper left corner of the matrix.

It is also knows as primary diagonal and major diagonal.

` | `**a**_{11} a_{12} a_{13} a_{14}|
A= | a_{21} **a**_{22} a_{23} a_{24}|
| a_{31} a_{32} **a**_{33} a_{34}|
| a_{41} a_{42} a_{43} **a**_{44}|

## diagonal matrix

Diagonal matrix is a matrix in which the elements outside the main diagonal are all zero. The term usually refers to square matrices.

` | a`_{11} 0 0 0|
A= | 0 a_{22} 0 0|
| 0 0 a_{33} 0|
| 0 0 0 a_{44}|

## identity matrix

Identity matrix is a matrix whose elements along the main diagonal are equal to 1, and the rest are 0. It is usually denoted by I.

```
| 1 0 0 0|
I= | 0 1 0 0|
| 0 0 1 0|
| 0 0 0 1|
```

## trace

Trace of a square matrix is the sum of elements on the main diagonal.

## lower triangular matrix

Lower triangular matrix is a square matrix whose elements above the main diagonal are zero.

## upper triangular matrix

Upper triangular matrix is a square matrix whose elements above the main diagonal are zero.

## equality of matrices

Two matrices A and B are equal if*a*

_{ij}= b_{ij}## sum of matrices

The sum A+B of two m-by-n matrices A and B will be matrix with elements * c _{ij} = a_{ij}+b_{ij}*.

A+B = B+A

(A+B)+C = A+(B+C)

## scalar multiplication

The multiplication x*A of real number x and matrix A will be matrix with elements
*c _{ij} = a_{ij}*x*.

## transposition

The transpose of an m-by-n matrix A is the n-by-m matrix A^{T}formed by turning rows into columns and vice versa: (A

^{T})

_{i,j}= A

_{j,i}.

In other words, this is a 90 degree rotation of the matrix.

## matrix multiplication

Multiplication of two matrices is defined if and only if the number of columns of the left matrix is the same as the number of rows of the right matrix.

If A is an m-by-n matrix and B is an n-by-p matrix, then their matrix product AB is the m-by-p matrix whose entries are given by dot product of the corresponding row of A and the corresponding column of B:

*[A*B]*_{i,j} = a_{i,1}*b_{1,j} + a_{i,2}*b_{2,j} + ... + a_{i,n}*b_{n,j}
where *1 ≤ i ≤ m* and *1 ≤ j ≤ p*

## determinant

The determinant is a scalar value that can be computed from the elements of a square matrix. It is denoted as *det(A)* or *|A|*.

second-order determinant (for matrix 2x2):

` |a`_{11} a_{12}|
det |a_{21} a_{22}| = a_{11}*a_{22} - a_{21}*a_{12}

third-order determinant (for matrix 3x3):

` |a`_{11} a_{12} a_{13}|
det A = |a_{21} a_{22} a_{23}| =
|a_{31} a_{32} a_{33}|

_{11}*

`|a`_{22} a_{23}|
|a_{32} a_{33}|

_{12}*

`|a`_{21} a_{23}|
|a_{31} a_{33}|

_{13}*

`|a`_{21} a_{22}|
|a_{31} a_{32}|

_{11}a

_{22}a

_{23}+

_{12}a

_{23}a

_{31}+

_{13}a

_{21}a

_{32}-

_{13}a

_{22}a

_{31}-

_{11}a

_{23}a

_{32}-

_{12}a

_{21}a

_{33}

With this Laplace expansion method, you can compute the determinant of a square matrix of any order. Just follow the next steps:

- Choose any row or column of A.
- For each element
*a*of this row or column, compute the associated cofactor_{ij}*C*._{ij}= (-1)^{i + j}* M_{ij} - Remove row and columns that contain
*a*from matrix. This will give you an n-1 submatrix._{ij} - Calculate the determinant of this submatrix aka minor
(denoted as
*M*)._{ij} - Finally, multiply the calculated minor by
*(-1)*and you will get cofactor.^{i + j} - Multiply each cofactor by the associated matrix element
*a*._{ij} - The sum of these products is
*det A*.

## degenerate matrix

A degenerate matrix, is a square matrix whose determinant is zero.

## inverse matrix

For each non-degenerate matrix of order n, there is an inverse matrix *A ^{-1}*, such that their product is equal to the identity matrix, i.e.

*A*A*

^{-1}= IYou can use the Gauss-Jordan method, which uses elementary row operations to find the inverse matrix. There are also other methods.

## symmetric matrix

A square matrix whose transpose is equal to itself is called a symmetric matrix:

*A*

^{T}= A## orthogonal matrix

A square matrix whose transpose is equal to its inverse is called an orthogonal matrix:

*A*

^{T}= A^{-1}