What is a Matrix?
A matrix, in a mathematical context, is a rectangular array of numbers, symbols, or expressions that are arranged in rows and columns. Matrices are often used in scientific fields such as physics, computer graphics, probability theory, statistics, calculus, numerical analysis, and more.
Dimensions & Elements
The dimensions of a matrix, A, are typically denoted as m × n. This means that A has m rows and n columns.
When referring to a specific value in a matrix, called an element, a variable with two subscripts is often used to denote each element based on its position in the matrix. For example, given ai,j, where i = 1 and j = 3, a1,3 is the value of the element in the first row and the third column of the given matrix.
Core Operations
- Addition (A + B)Matrices must be same size
- Multiplication (AB)Cols of A = Rows of B
- Determinant det(A)Must be square matrix
- Inverse (A⁻¹)A × A⁻¹ = I (Identity)
- Transpose (Aᵀ)Rows become columns
Matrix Addition and Subtraction
Matrix addition can only be performed on matrices of the same size. This means that you can only add matrices if both matrices are m × n. For example, you can add two or more 3 × 3, 1 × 2, or 5 × 4 matrices. You cannot add a 2 × 3 and a 3 × 2 matrix, a 4 × 4 and a 3 × 3, etc. The number of rows and columns of all the matrices being added must exactly match.
If the matrices are the same size, matrix addition is performed by adding the corresponding elements in the matrices. For example, given two matrices, A and B, with elements ai,j and bi,j, the matrices are added by adding each element, then placing the result in a new matrix, C, in the corresponding position in the matrix. Subtraction works exactly the same way, but subtracting the elements instead of adding.
Matrix Multiplication
Matrix multiplication requires that the number of columns in the first matrix must equal the number of rows in the second matrix. If matrix A is an m × n matrix and matrix B is an n × p matrix, their product AB will be an m × p matrix.
Unlike regular multiplication of numbers, matrix multiplication is not commutative. That means AB does not necessarily equal BA. In fact, BA might not even be a valid operation if the dimensions do not match in that order. To multiply them, you take the dot product of the rows of the first matrix and the columns of the second matrix.
Determinant of a Matrix
The determinant is a scalar value that can be computed from the elements of a square matrix and encodes certain properties of the linear transformation described by the matrix. For a matrix A, it is denoted as det(A) or |A|.
Geometrically, it represents the scaling factor of the linear transformation described by the matrix. If the determinant is 0, the matrix cannot be inverted (it is a singular matrix), which means the transformation collapses the space into a lower dimension. For a simple 2 × 2 matrix with elements a, b in the first row and c, d in the second, the determinant is calculated as ad - bc.
Inverse of a Matrix
The inverse of a matrix A is denoted as A⁻¹. It acts similarly to the reciprocal of a number. Just as 5 × (1/5) = 1, multiplying a matrix by its inverse results in the Identity Matrix (I), which is the matrix equivalent of the number 1 (having 1s across the main diagonal and 0s elsewhere).
Note that not all matrices have inverses. A matrix must be square (same number of rows and columns) and its determinant cannot be zero. If the determinant is zero, the matrix is referred to as "singular".
Matrix Transpose
The transpose of a matrix is an operator which flips a matrix over its diagonal. In other words, it switches the row and column indices of the matrix by producing another matrix denoted as Aᵀ.
If A is an m × n matrix, then its transpose Aᵀ is an n × m matrix. The element at the i-th row and j-th column of A becomes the element at the j-th row and i-th column of Aᵀ.