# Linear Algebra

Linear equations, eigenvalues, singular values, decomposition, matrix operations, matrix structure

Linear algebra functions in MATLAB® provide fast, numerically robust matrix calculations. Capabilities include a variety of matrix factorizations, linear equation solving, computation of eigenvalues or singular values, and more. For an introduction, see Matrices in the MATLAB Environment.

## Functions

expand all

 `mldivide` Solve systems of linear equations Ax = B for x `mrdivide` Solve systems of linear equations xA = B for x `pagemldivide` Page-wise left matrix divide `pagemrdivide` Page-wise right matrix divide `decomposition` Matrix decomposition for solving linear systems `lsqminnorm` Minimum norm least-squares solution to linear equation `linsolve` Solve linear system of equations `inv` Matrix inverse `pageinv` Page-wise matrix inverse `pinv` Moore-Penrose pseudoinverse `lscov` Least-squares solution in presence of known covariance `lsqnonneg` Solve nonnegative linear least-squares problem `sylvester` Solve Sylvester equation AX + XB = C for X
 `eig` Eigenvalues and eigenvectors `eigs` Subset of eigenvalues and eigenvectors `balance` Diagonal scaling to improve eigenvalue accuracy `svd` Singular value decomposition `pagesvd` Page-wise singular value decomposition `svds` Subset of singular values and vectors `svdsketch` Compute SVD of low-rank matrix sketch `gsvd` Generalized singular value decomposition `ordeig` Eigenvalues of quasitriangular matrices `ordqz` Reorder eigenvalues in QZ factorization `ordschur` Reorder eigenvalues in Schur factorization `polyeig` Polynomial eigenvalue problem `qz` QZ factorization for generalized eigenvalues `hess` Hessenberg form of matrix `schur` Schur decomposition `rsf2csf` Convert real Schur form to complex Schur form `cdf2rdf` Convert complex diagonal form to real block diagonal form
 `lu` LU matrix factorization `ldl` Block LDL' factorization for Hermitian indefinite matrices `chol` Cholesky factorization `cholupdate` Rank 1 update to Cholesky factorization `qr` QR decomposition `qrdelete` Remove column or row from QR factorization `qrinsert` Insert column or row into QR factorization `qrupdate` Rank 1 update to QR factorization `planerot` Givens plane rotation
 `transpose` Transpose vector or matrix `ctranspose` Complex conjugate transpose `pagetranspose` Page-wise transpose `pagectranspose` Page-wise complex conjugate transpose `mtimes` Matrix multiplication `pagemtimes` Page-wise matrix multiplication `mpower` Matrix power `sqrtm` Matrix square root `expm` Matrix exponential `logm` Matrix logarithm `funm` Evaluate general matrix function `kron` Kronecker tensor product `cross` Cross product `dot` Dot product
 `bandwidth` Lower and upper matrix bandwidth `tril` Lower triangular part of matrix `triu` Upper triangular part of matrix `isbanded` Determine if matrix is within specific bandwidth `isdiag` Determine if matrix is diagonal `ishermitian` Determine if matrix is Hermitian or skew-Hermitian `issymmetric` Determine if matrix is symmetric or skew-symmetric `istril` Determine if matrix is lower triangular `istriu` Determine if matrix is upper triangular
 `norm` Vector and matrix norms `normest` 2-norm estimate `vecnorm` Vector-wise norm `cond` Condition number for inversion `condest` 1-norm condition number estimate `rcond` Reciprocal condition number `condeig` Condition number with respect to eigenvalues `det` Matrix determinant `null` Null space of matrix `orth` Orthonormal basis for range of matrix `rank` Rank of matrix `rref` Reduced row echelon form (Gauss-Jordan elimination) `trace` Sum of diagonal elements `subspace` Angle between two subspaces