# Square matrix

The diagonal of a square matrix from the top right to the bottom left corner is called *antidiagonal* or *counterdiagonal*.

By the spectral theorem, real symmetric (or complex Hermitian) matrices have an orthogonal (or unitary) eigenbasis; i.e., every vector is expressible as a linear combination of eigenvectors. In both cases, all eigenvalues are real.^{[3]}

takes only positive values (respectively only negative values; both some negative and some positive values).^{[4]} If the quadratic form takes only non-negative (respectively only non-positive) values, the symmetric matrix is called positive-semidefinite (respectively negative-semidefinite); hence the matrix is indefinite precisely when it is neither positive-semidefinite nor negative-semidefinite.

A symmetric matrix is positive-definite if and only if all its eigenvalues are positive.^{[5]} The table at the right shows two possibilities for 2×2 matrices.

Allowing as input two different vectors instead yields the bilinear form associated to *A*:

An *orthogonal matrix* is a square matrix with real entries whose columns and rows are orthogonal unit vectors (i.e., orthonormal vectors). Equivalently, a matrix *A* is orthogonal if its transpose is equal to its inverse:

The trace, tr(*A*) of a square matrix *A* is the sum of its diagonal entries. While matrix multiplication is not commutative, the trace of the product of two matrices is independent of the order of the factors:

The determinant of 3×3 matrices involves 6 terms (rule of Sarrus). The more lengthy Leibniz formula generalizes these two formulae to all dimensions.^{[8]}

The determinant of a product of square matrices equals the product of their determinants:^{[9]}

Adding a multiple of any row to another row, or a multiple of any column to another column, does not change the determinant. Interchanging two rows or two columns affects the determinant by multiplying it by −1.^{[10]} Using these operations, any matrix can be transformed to a lower (or upper) triangular matrix, and for such matrices the determinant equals the product of the entries on the main diagonal; this provides a method to calculate the determinant of any matrix. Finally, the Laplace expansion expresses the determinant in terms of minors, i.e., determinants of smaller matrices.^{[11]} This expansion can be used for a recursive definition of determinants (taking as starting case the determinant of a 1×1 matrix, which is its unique entry, or even the determinant of a 0×0 matrix, which is 1), that can be seen to be equivalent to the Leibniz formula. Determinants can be used to solve linear systems using Cramer's rule, where the division of the determinants of two related square matrices equates to the value of each of the system's variables.^{[12]}

The polynomial *p*_{A} in an indeterminate *X* given by evaluation of the determinant det(*XI*_{n} − *A*) is called the characteristic polynomial of *A*. It is a monic polynomial of degree *n*. Therefore the polynomial equation *p*_{A}(λ) = 0 has at most *n* different solutions, i.e., eigenvalues of the matrix.^{[16]} They may be complex even if the entries of *A* are real. According to the Cayley–Hamilton theorem, *p*_{A}(*A*) = 0, that is, the result of substituting the matrix itself into its own characteristic polynomial yields the zero matrix.