# Matrix Fundamentals

A matrix is a rectangular array of either real or complex numbers. A matrix is denoted by a capital letter; its elements are denoted by the same lower case letter with row/column subscripts. Thus, the value of the element in row `i` and column `j` in matrix `A` is denoted by

. For example, a 3 by 4 matrix `a`(`i`,`j`)`A`, is written as follows:

Note that with the above notation, we assume the standard Fortran programming language convention of starting array indices at 1 rather than the C programming language convention of starting them at 0.

A matrix in which all of the elements are real numbers is called a real matrix. A matrix that contains at least one complex number is called a complex matrix. A real or complex matrix `A` with the property that `a`(`i`,`j`) = `a`(`j`,`i`), is called a symmetric matrix. A complex matrix `A` with the property that `a`(`i`,`j`) = `conj`(`a`(`j`,`i`)), is called a Hermitian matrix. Note that programs that manipulate symmetric and Hermitian matrices need only store half of the matrix values, since the values of the non-stored elements can be quickly reconstructed from the stored values.

A matrix that has the same number of rows as it has columns is referred to as a square matrix. The elements in a square matrix that have same row index and column index are called the diagonal elements of the matrix, or simply the diagonal of the matrix.

The transpose of a matrix `A` is the matrix obtained by “flipping” the elements of the array about its diagonal. That is, we exchange the elements

and `a`(`i`,`j`)

. For a complex matrix, if we both flip the elements about the diagonal and then take the complex conjugate of the element, the resulting matrix is called the Hermitian transpose or conjugate transpose of the original matrix. The transpose and Hermitian transpose of a matrix `a`(`j`,`i`)`A` are denoted by

and `A`^{T}

respectively.`A`^{H}

A column vector, or simply a vector, is a

matrix, and a row vector is a `n` × 1`1 × `

matrix. A real or complex matrix `n``A` is said to be positive definite if the vector-matrix product

is greater than zero for all non-zero vectors `x`^{T}`Ax``x`. A matrix that is not positive definite is referred to as indefinite.

An upper (or lower) triangular matrix, is a square matrix in which all elements below (or above) the diagonal are zero. A unit triangular matrix is an upper or lower triangular matrix with all 1's along the diagonal.

A matrix `P` is called a permutation matrix if, for any matrix `A`, the result of the matrix product `PA` is identical to `A` except for interchanging the rows of `A`. For a square matrix, it can be shown that if `PA` is a permutation of the rows of `A`, then `AP`^{T} is the same permutation of the columns of `A`. Additionally, it can be shown that the inverse of `P` is `P`^{T}.

In order to save space, a permutation matrix is usually stored as a linear array, called a permutation vector, rather than as an array. Specifically, if the permutation matrix maps the `i`-th row of a matrix to the `j`-th row, then the `i`-th element of the permutation vector is `j`.

A matrix with non-zero elements only on the diagonal is called a diagonal matrix. As is the case with a permutation matrix, it is usually stored as a vector of values, rather than as a matrix.

**Parent topic:**Sparse Linear Systems