inv(): invert a square matrix
inv(A) returns the inverse of a square matrix A when it exists. Multiplying A by its inverse yields the identity matrix, making inversion a way to solve matrix equations.
Example and meaning
If A × x = b, then x = inv(A) × b when A is invertible. In practice, a linear solver is often more stable and efficient than explicitly forming an inverse.
Related linear algebra
Check whether inversion is possible using det(): a zero determinant means no inverse. Use lsolve() for systems, multiply() to verify a result, and transpose() in related transformations. identity() creates the target product.
Important caveat
A must be square and non-singular. Nearly singular floating-point matrices can produce unreliable results; scale data and prefer a solver for numerical applications.