A matrix is a rectangular arrangement of numbers, symbols, or functions organized into rows and columns. It can store a data set, encode a system of equations, describe a geometric transformation, or represent connections in a network. The position of an entry is part of its meaning, so matrix calculations follow dimension rules rather than ordinary number rules alone.
Order, entries, and the main families of matrices
The order (m×n) states the number of rows first and columns second. Two matrices are equal only when they have the same order and every pair of corresponding entries is equal. A row matrix has one row, a column matrix has one column, and a square matrix has equally many rows and columns.
Watch a 2 × 2 matrix act on the plane
Move the entries to see how the matrix sends the basis vectors and changes area.
Diagonal matrices have zeros away from the main diagonal. A scalar matrix has equal diagonal entries, and an identity matrix is the scalar matrix whose diagonal entries are one. A zero matrix contains only zeros. A triangular matrix has zeros entirely above or below the diagonal.
These categories overlap. The identity is diagonal, scalar, square, upper triangular, and lower triangular at the same time. A matrix can also be symmetric if it equals its transpose.
Addition and scalar multiplication are entrywise
Matrices may be added or subtracted only when they have the same order. Combine entries occupying the same position. Multiplying by a scalar multiplies every entry, so the order stays unchanged. These operations obey familiar commutative and distributive rules.
A frequent mistake is to add matrices with different shapes because they contain the same total number of entries. A 2 by 3 matrix and a 3 by 2 matrix each contain six entries, but corresponding positions do not form the same rectangular structure, so their sum is undefined.
Matrix multiplication links rows to columns
The product (AB) exists when the number of columns of (A) equals the number of rows of (B). Each entry of the result is the dot product of one row of (A) with one column of (B). If (A) is (m×n) and (B) is (n×p), the result is (m×p).
The worked product shows why multiplication is generally not commutative. Even when both (AB) and (BA) exist, they may have different values. In transformations, the order also records which action happens first: in (ABx), matrix (B) acts on the vector before (A).
Determinants separate invertible from singular square matrices
Only square matrices have determinants. A nonzero determinant means the matrix has an inverse and its columns are linearly independent. A zero determinant means the transformation loses at least one dimension. The determinant is therefore a diagnostic, not another entrywise operation. See matrix determinants for Sarrus' rule and Laplace expansion.
A practical order of work
Before calculating, write each matrix's dimensions. Check equality of shapes for addition and inner dimensions for multiplication. Estimate whether the result should be a scalar, vector, or matrix, then compute one row-column pair at a time. Finally, use a structural check: the result must have the predicted order, multiplying by the identity must change nothing, and a proposed inverse must produce the identity on both sides.
Matrices can model exact algebra or measured data. With measured values, rounding every intermediate product too early can distort the result. Keep extra precision during the calculation and round only the final quantity to a precision justified by the inputs.
