← LibraryThe Inverse of a Matrix | KEVOS® MathematicsProject Delivery · Project ManagementLesson 165/189← PrevNext →
ArticlePublished 8 Aug 202622 min readBy Kevin Jogin
Skip to content

Engineering/Mathematics/Matrices

The Inverse of a Matrix

A square matrix A is invertible when some matrix B satisfies AB=In and BA=In; that matrix is written A1. Its value is structural: it converts the equation Ax=b into the explicit formula x=A1b, valid for every right-hand side at once.

  • Core level
  • Stream: matrix-algebra
  • Reading time 13 min
  • Ref KVS-ENG-MATH-0042
Taxonomy
Engineering / Mathematics
Prerequisite
Matrix multiplication and the identity matrix
Defining condition
AB=In and BA=In
Applies to
Square matrices only
Key property
When it exists, the inverse is unique
Pays off when
Many right-hand sides share one coefficient matrix

Overview

Scalar algebra disposes of the equation 3x=12 by multiplying both sides by the reciprocal 31. The move works because every non-zero real number has a multiplicative inverse and because multiplication is commutative, so it does not matter which side the reciprocal is applied from. Matrix algebra supports the same manoeuvre, but neither of those two conveniences survives intact: matrix multiplication does not commute, and a square matrix may fail to have an inverse even though it is nowhere near being the zero matrix.

The definition therefore demands the condition on both sides. A matrix B is the inverse of A only when AB=In and BA=In. With that in hand the identity matrix can be inserted in front of an unknown vector and immediately re-expressed, which turns Ax=b into x=A1b. The derivation is short, but its consequence is strong: the solution is forced, so a system with an invertible coefficient matrix has exactly one solution and there is a closed formula for it.

Two boundaries matter. First, only square matrices are candidates — for a rectangular A the products AB and BA have different sizes and cannot both be identity matrices. Second, being square is not enough. A square matrix whose columns are linearly dependent can be paired with a vector of constants that produces an inconsistent system, and an inconsistent system contradicts the formula x=A1b, which would manufacture a solution out of thin air. Such a matrix has no inverse, and the term for it is singular.

In engineering practice the explicit inverse earns its place when its entries carry meaning rather than when it is used to solve a single system. The inverse of a stiffness matrix is a flexibility matrix whose column j is the deflected shape produced by a unit load at degree of freedom j. The inverse of a nodal admittance matrix is an impedance matrix whose entries are driving-point and transfer impedances. Read that way, A1 is a complete sensitivity table for the system, not merely a computational device.

Definition

Matrix Inverse

MI

Let A and B be square matrices of the same size n. If AB=In and BA=In, then A is invertible and B is the inverse of A, written B=A1. The relation is symmetric: under the same hypotheses B is invertible and A=B1, so A and B are inverses of each other.

A square matrix that is not invertible is called singular. Rectangular matrices are excluded outright, because AB and BA cannot both be square of the same size unless A is square.

Identity Matrix

IM

The n×n matrix In with 1 in every diagonal position and 0 elsewhere. It is the multiplicative unit for square matrices of size n: AIn=InA=A for every such A, and Inx=x for every xn. That neutrality is what makes it worth inserting in front of an unknown.

Nonsingular Matrix

NM

A square matrix A for which the homogeneous system Ax=0 has only the trivial solution x=0; equivalently, N(A)={0}. Invertibility and nonsingularity turn out to be the same condition for square matrices, though establishing that equivalence takes further work.

Concepts

Why an inverse solves the system

Suppose BA=In and x is any solution of Ax=b. Then x=Inx=(BA)x=B(Ax)=Bb, using only associativity of matrix multiplication and the neutrality of the identity. Every step is an equality, so the argument does not merely produce a solution — it proves that no other vector can be a solution. Uniqueness of the solution therefore falls out of the same three lines that produce the formula.

Both sides are required by the definition

Nothing in the definition allows AB=In alone to be called an inverse. For general rings of objects a one-sided inverse need not be two-sided, and the asymmetry is real: the products AB and BA are different computations because matrix multiplication does not commute. For square matrices over the two conditions do turn out to be equivalent, so verifying one product suffices in practice, but that is a theorem to be proved rather than a licence granted by the definition.

Exhibiting a matrix with no inverse

To show a specific square matrix A is not invertible, assume an inverse B exists and find a vector b for which the system Ax=b is inconsistent — row-reduce the augmented matrix [Ab] and locate a leading one in the final column. The assumed inverse would give the solution x=Bb, so the system would be both consistent and inconsistent. The contradiction kills the assumption. Choosing a suitable b is not guesswork: any vector outside the column space of A will do.

The inverse is unique

Suppose B and C both satisfy the definition for the same A. Then B=BIn=B(AC)=(BA)C=InC=C. Only associativity and the identity property are used. This licenses the definite article and the notation A1: there is no question of which inverse is meant, and any matrix that behaves like an inverse is the inverse. It also means a candidate inverse produced by any method — row reduction, a cofactor formula, a library call — must agree with every other method exactly.

Where the scalar analogy breaks

Among real numbers only 0 lacks a reciprocal, and ab=1 implies ba=1 automatically. Among matrices the singular set is much larger than {0}: it is a hypersurface, the zero set of the determinant, and it contains matrices with no zero entries at all. Matrices also admit zero divisors, so AB=O does not imply that A or B is the zero matrix. Reasoning transferred uncritically from scalar algebra — cancelling a common factor, dividing through, assuming order is immaterial — is the most common source of error in matrix manipulation.

The inverse as a table of influence coefficients

Write A1=[c1c2cn]. Since Acj=ej, column j of A1 is the unique response of the system to the j-th standard unit input. In a structural model that is the deflected shape under a unit load; in a network model it is the vector of node potentials under a unit injected current; in a linear economic model it is the total production required by a unit of final demand. Entry [A1]ij is therefore a sensitivity: the response at i per unit of excitation at j.

Decision path: does this matrix have an inverse?

Is A square?If A is m×n with mn, no inverse exists — the two products cannot both be identity matrices. Consider a pseudoinverse instead.
Row-reduce AReduce A alone to reduced row-echelon form and compare with In.
Does A reduce to In?If yes, A is nonsingular and an inverse exists. If a zero row appears, A is singular and no inverse exists.
Construct the candidate BReduce the augmented array [AIn]; the right-hand block of the reduced array is the candidate inverse.
Verify both productsConfirm AB=In and BA=In before recording B=A1. Uniqueness then guarantees no other candidate exists.

Equations

Defining condition for the matrix inverse

EQ-MI-01
AB=InandBA=InB=A1

Both products are part of the definition. A and B must be square of the same size n.

Solution of a system by the inverse

EQ-MI-02
Ax=bx=A1b

Valid whenever A is invertible. The right-hand side is a formula in b, so one inverse answers every load case.

Derivation of the solution formula

EQ-MI-03
x=Inx=(A1A)x=A1(Ax)=A1b

A chain of equalities, so the solution is forced. Uniqueness of the solution follows from the same argument.

Entries of the identity matrix

EQ-MI-04
[In]ij={1i=j0ij

Uniqueness of the inverse

EQ-MI-05
B=BIn=B(AC)=(BA)C=InC=C

If B and C are both inverses of A they coincide, so the notation A1 is unambiguous.

Columns of the inverse as unit-input responses

EQ-MI-06
A[A1]j=ej,j=1,2,,n

Column j of A1 is the unique solution of Ax=ej. This reading turns the inverse into a table of influence coefficients.

Stiffness and flexibility as an inverse pair

EQ-MI-07
K=[210121011],K1=[111122123]

A three-degree-of-freedom spring chain fixed at one end, in units where each spring has unit stiffness. The inverse is the flexibility matrix.

Variable Definitions

Symbols used on this page
SymbolNameMeaningDomain / type
ASquare matrixThe matrix whose invertibility is in questionn x n complex matrix
A1Inverse of AThe unique matrix satisfying both AA1=In and A1A=Inn x n complex matrix
BCandidate inverseA matrix proposed as the inverse of A, before verificationn x n complex matrix
InIdentity matrix of size nMultiplicative unit for square matrices of size nn x n matrix
nSizeCommon number of rows and columns of A and A1positive integer
xUnknown vectorVector of unknowns in the system Ax=bC^n
bVector of constantsRight-hand side of the system; the excitation or load vectorC^n
ejStandard unit vectorColumn j of In; a unit input applied at coordinate j aloneC^n
N(A)Null space of ASet of solutions of Ax=0; trivial exactly when A is nonsingularsubspace of C^n

Worked Numerical Example

Problem statement

A chain of three identical linear springs is anchored at one end, with masses at three successive nodes. The assembled stiffness matrix K is known. Confirm that a proposed matrix is K1, then use it to obtain nodal deflections for three separate load cases without re-solving the system.

  1. Assemble the stiffness matrix

    Nodes 1, 2 and 3 run outward from the anchor, each pair joined by a spring of unit stiffness. Node 1 is connected to the anchor and to node 2; node 3 is at the free end and is connected only to node 2. Equilibrium gives Ku=f with

    K=[210121011]
  2. State the candidate inverse

    The proposed flexibility matrix is F. Physically its column j should be the deflected shape under a unit load applied at node j alone.

    F=[111122123]
  3. Verify the first product

    Row 1 of K against the columns of F gives 2(1)1(1)+0=1, 2(1)1(2)+0=0 and 2(1)1(2)+0=0. Row 2 gives 1+21=0, 1+42=1 and 1+43=0. Row 3 gives 01+1=0, 02+2=0 and 02+3=1.

    KF=[100010001]=I3
  4. Verify the second product

    The definition requires both orders. Row 1 of F against the columns of K gives 21+0=1, 1+21=0 and 01+1=0; rows 2 and 3 complete the pattern in the same way. Since FK=I3 as well, F satisfies the definition and K1=F.

    FK=I3K1=F
  5. Load case one: unit tip load

    A unit load at the free end is f=e3. The deflections are simply column 3 of K1, with no further computation:

    u=K1e3=[123]
  6. Load case two: uniform load

    For f=(1,1,1), sum the rows of K1: 1+1+1=3, 1+2+2=5, 1+2+3=6.

    u=K1[111]=[356]
  7. Load case three: mixed load

    For f=(2,0,3) the products are 2+0+3=5, 2+0+6=8 and 2+0+9=11. Each additional load case costs one matrix-vector product, roughly n2 multiplications, rather than a fresh reduction.

    u=K1[203]=[5811]
  8. Check one answer against the original equations

    Substituting u=(5,8,11) into Ku gives 2(5)8=2, 5+1611=0 and 8+11=3, recovering f=(2,0,3). Verifying against the original matrix, not the reduced one, is what catches an arithmetic slip made during the inversion.

Result

The flexibility matrix is confirmed as K1, and three load cases are resolved by three matrix-vector products. The monotone increase along each column of K1 has a direct physical reading: a load applied further from the anchor deflects every node more, and the free tip always moves most. Because K is nonsingular, each load case has exactly one equilibrium configuration.

Applications & Industry Use

Structural engineering

Flexibility matrices and influence lines

Inverting an assembled stiffness matrix yields the flexibility matrix, whose column j is the deflected shape produced by a unit load at degree of freedom j. Designers read influence coefficients straight off it, which is why the explicit inverse is retained in influence-line work even though single load cases would be solved more cheaply by factorisation.

Electrical power systems

Bus impedance from bus admittance

Network analysis assembles a sparse nodal admittance matrix Y. Its inverse, the bus impedance matrix Z=Y1, has entries that are driving-point and transfer impedances, and short-circuit current at a bus follows directly from a single diagonal entry. The inverse is dense where Y is sparse, so large studies compute only the columns actually required.

Robotics and mechatronics

Resolved-rate joint velocity control

The manipulator Jacobian relates joint rates to end-effector velocity. For a non-redundant arm away from singular configurations the Jacobian is square and invertible, and the commanded joint rates are its inverse applied to the desired tool velocity. Loss of invertibility at a singular configuration is precisely the condition that must be detected and avoided in the trajectory planner.

Surveying and geodesy

Covariance of adjusted coordinates

A least-squares network adjustment forms normal equations with a symmetric positive definite coefficient matrix. Its inverse is the cofactor matrix of the adjusted coordinates: diagonal entries give variances and off-diagonal entries give correlations, from which error ellipses are drawn. Here the inverse is wanted for its entries, not to obtain the coordinates.

Economics and industrial planning

Leontief inverse in input-output analysis

With A the matrix of direct technical coefficients, total output required by a final demand vector d is (IA)1d. Entry (i,j) of the inverse is the total output of sector i — direct plus all indirect rounds — needed per unit of final demand for sector j, which is exactly the multiplier that planners quote.

Computer graphics

Inverse transformations and ray casting

An affine object-to-world transformation is stored with its inverse so that world-space rays can be mapped back into object space, where intersection tests are cheap. Because the same transformation is applied to millions of rays, the explicit inverse is the right trade: it is formed once and reused indefinitely.

Design Considerations

Do not form the inverse to solve a single system

Computing A1 and then multiplying by b costs roughly three times as much arithmetic as an LU factorisation followed by triangular solves, and it is less accurate because it accumulates rounding through an extra layer of products. The idiom x = solve(A, b) should be preferred to x = inv(A) @ b as a matter of routine.

Reach for the explicit inverse when the entries are the deliverable

The calculus reverses when the inverse itself is the answer: covariance matrices, flexibility matrices, bus impedance matrices and Leontief multipliers are all read entry by entry. If downstream users will interrogate individual coefficients, form the inverse and store it.

Existence is a yes-or-no property, conditioning is not

A matrix either has an inverse or does not; there is no partial credit. Numerically, however, a matrix can be invertible in exact arithmetic yet so ill-conditioned that the computed inverse is meaningless. Quote a condition number alongside any inverse used in production, and treat a large condition number as a modelling signal rather than a numerical nuisance.

Order matters everywhere

Because matrix multiplication does not commute, A1B and BA1 are different matrices. Any derivation that multiplies an equation by an inverse must apply it to the same side of every term. This single discipline eliminates a large fraction of algebraic errors in matrix manipulation.

The inverse of a sparse matrix is dense

Finite element and network matrices are typically very sparse, but their inverses generally have no zero entries at all. Forming the inverse of a matrix with 106 rows is not merely slow, it is impossible to store. Work with a sparse factorisation and solve for the specific columns of the inverse that are genuinely needed.

Verify both products on first use

The definition requires AB=In and BA=In. Even though one product implies the other for square matrices, computing both is a cheap and decisive check on a hand computation or a newly written routine. In floating point, check that the residual norm ABIn is small relative to AB rather than expecting exact zeros.

Standards & Codes

Notation, interchange and numerical standards that govern how this material is written down, stored and computed in production systems.

Applicable standards, conventions and reference implementations
ReferenceTitleRelevance to this topic
ISO 80000-2Quantities and units — Part 2: MathematicsFixes the notation used here: A1 for the inverse, In or E for the identity matrix, upright symbols for operators and italic for matrix and scalar variables.
IEEE 754-2019IEEE Standard for Floating-Point ArithmeticDefines the binary64 arithmetic in which computed inverses are formed, and the rounding model behind the residual bound ABIn that replaces an exact identity test.
LAPACK / BLAS referenceLinear Algebra PACKage reference implementationProvides xGETRF for the LU factorisation and xGETRI for explicit inversion, deliberately separated so that callers must opt in to the more expensive explicit inverse.
ISO/IEC 40314Mathematical Markup Language (MathML) Version 3.0Encodes the matrix expressions on this page as structured markup, so superscript 1 is exposed as an exponent rather than as a picture of one.
IEC 60909Short-circuit currents in three-phase a.c. systemsUnderpins the power-system calculation that consumes the bus impedance matrix Z=Y1, in which fault levels are read from individual diagonal entries of the inverse.

Material Selection

For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.

Representation and precision selection
RepresentationSelect whenTrade-off
Exact rational arithmeticSmall matrices where the inverse is to be reported symbolically or used in a proof, and where a structural conclusion must not depend on rounding.Guarantees the entries are correct and the invertibility decision is definitive, but the fractions grow rapidly and cost rises sharply with size.
Integer entries with unit determinantConstructed or teaching examples, lattice bases and unimodular changes of variable.The inverse is exactly representable in integers, which makes verification trivial, but such matrices are a measure-zero special case that never arises from measured data.
IEEE 754 binary64 (double precision)Default choice for engineering matrices assembled from measured or simulated data.Roughly sixteen significant digits absorbs conditioning up to about 1010; beyond that the computed inverse loses all significance without any error being raised.
IEEE 754 binary32 (single precision)GPU-accelerated graphics pipelines where transformation matrices are well conditioned by construction.Halves memory and doubles throughput but leaves only about seven digits, which is unsafe for anything worse than mildly conditioned.
Modular arithmetic over a finite fieldHill-type ciphers, error-correcting codes and exact rank certification by modular reduction.Exact, fast and free of growth in operand size, but invertibility depends on the modulus — a matrix invertible over the rationals can be singular modulo an unlucky prime.
Interval or affine arithmeticSafety-critical work requiring a certified enclosure of the inverse rather than a point estimate.Delivers rigorous bounds on every entry at several times the cost, with intervals that can widen uselessly for poorly conditioned matrices.

Manufacturing Notes

Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.

Cost of the inverse against the cost of a solve

An LU factorisation of an n×n matrix costs about 23n3 floating-point operations, and each subsequent triangular solve costs about 2n2. Forming the explicit inverse costs roughly 2n3 in total. The inverse only becomes competitive when the number of right-hand sides is comparable to n itself, and even then a stored factorisation is usually the better engineering choice.

Library interfaces and their intent

NumPy exposes both numpy.linalg.inv and numpy.linalg.solve; MATLAB documents the backslash operator as the preferred alternative to inv; Eigen provides .inverse() but its documentation steers users to a decomposition object. The consistent message across libraries is that an explicit inverse should be a deliberate choice, not a default.

Verification by residual, not by equality

In floating point the product AB will not equal In exactly. The meaningful test compares the residual against machine precision and the problem size, for example checking that ABIn is of order nεAB. A residual that is orders of magnitude larger indicates either a coding error or severe ill-conditioning.

Special structure reduces the work

A diagonal matrix inverts entrywise; a triangular matrix inverts by back-substitution at about 13n3 operations; an orthogonal or unitary matrix inverts by conjugate transposition at no arithmetic cost at all. Detecting and exploiting structure before calling a general routine is normally the single largest available saving.

Blocked inversion for large dense problems

High-performance implementations invert in blocks so that the inner work becomes matrix-matrix multiplication, a BLAS Level 3 operation with good cache behaviour. The operation count is unchanged but achieved throughput improves by an order of magnitude relative to an unblocked scalar loop.

Failure Modes & Common Mistakes

Failure modes, root causes and prevention
Failure mode / mistakeImpactRoot causePrevention & detection
Attempting to invert a rectangular matrixhighApplying the inverse formula to an m×n matrix with mn, often after an overdetermined least-squares model is mistaken for a square system.Check the shape first. For non-square problems use the Moore-Penrose pseudoinverse or a least-squares solver, and state which one the model intends.
Assuming every square matrix is invertiblehighCarrying over the scalar intuition that only zero lacks a reciprocal.Test invertibility explicitly by row reduction to In, or by a rank or condition-number check, before writing A1 anywhere in a derivation.
Cancelling on the wrong sidehighWriting AB=CB=CA1 instead of B=A1C, by analogy with scalar division.Apply the inverse to the same side of every term. Left-multiplying and right-multiplying are distinct operations and must be labelled as such in the working.
Verifying only one product on a new implementationmediumChecking AB=In and declaring success, without confirming BA=In.For a hand computation or a first test of new code, compute both products. The equivalence of the two conditions is a theorem about exact arithmetic, not a guarantee that the code is correct.
Exact equality test against the identitymediumTesting A @ B == I in floating point, where rounding leaves entries such as 1016 off the diagonal.Compare a norm of the residual ABIn against a tolerance scaled by machine epsilon, the matrix size and the matrix norms.
Inverting a sparse matrix in placehighCalling a dense inversion routine on a large finite element or network matrix, whose inverse is fully dense.Keep a sparse factorisation and solve for individual columns of the inverse only where genuinely required; never materialise the inverse of a very large sparse matrix.
Trusting an inverse of an ill-conditioned matrixhighIgnoring conditioning because the routine returned without warning; a near-singular matrix still produces a numeric answer.Compute and report the condition number. Treat a value near the reciprocal of machine epsilon as a signal that the underlying model is degenerate.
Confusing the inverse with the transposelowOver-generalising the orthogonal case, where Q1=Qt, to arbitrary matrices.The identity A1=At holds only for real orthogonal matrices. Verify AtA=In before using it.

FAQs

Why must the definition require both AB=In and BA=In?

Because matrix multiplication does not commute, so the two products are genuinely different computations and neither implies the other by definition. For square matrices over the complex numbers the two conditions are in fact equivalent, but that equivalence is a theorem with a real proof, not an assumption built into the definition.

Can a rectangular matrix have an inverse?

No. If A is m×n with mn then AB and BA have different sizes, so they cannot both be the same identity matrix. Rectangular matrices can have one-sided inverses when they have full row or full column rank, and they always have a Moore-Penrose pseudoinverse, but neither object satisfies the definition of an inverse.

How can I tell quickly whether a square matrix has an inverse?

Row-reduce it. If the reduced row-echelon form is the identity matrix the inverse exists; if a zero row appears it does not. For a 2×2 matrix the test collapses to checking whether adbc is non-zero. Numerically, a condition number estimate is more informative than a binary answer.

If two people compute an inverse by different methods, can they get different answers?

Not in exact arithmetic. The inverse is unique, so cofactor expansion, Gauss-Jordan reduction and a library call must all produce the same matrix. In floating point the results will differ in the last few digits, and a large discrepancy is evidence of ill-conditioning rather than of a second valid answer.

Is (A+B)1 equal to A1+B1?

No, and the failure is easy to see: take A=B=I2. Then A+B=2I2, whose inverse is 12I2, whereas A1+B1=2I2. Inversion does not distribute over addition, and the sum of two invertible matrices need not be invertible at all.

What does an entry of A1 actually mean physically?

Entry [A1]ij is the response of the system at coordinate i to a unit excitation applied at coordinate j alone, because column j of A1 solves Ax=ej. That is why the inverse of a stiffness matrix is a flexibility matrix and the inverse of an admittance matrix is an impedance matrix.

Why do numerical texts warn against computing the inverse?

Because for solving Ax=b the inverse is both slower and less accurate than a factorisation followed by triangular solves, and because forming it destroys sparsity. The warning is about that specific misuse; when the entries of the inverse are themselves the required output, computing it is entirely appropriate.

References

  1. Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section MISLE, Subsection IM. Licensed under the GNU Free Documentation License v1.2.
  2. ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
  3. Golub, G. H. and Van Loan, C. F. Matrix Computations, 4th edition. Johns Hopkins University Press, 2013.
  4. Higham, N. J. Accuracy and Stability of Numerical Algorithms, 2nd edition. Society for Industrial and Applied Mathematics, 2002.
  5. Anderson, E. et al. LAPACK Users' Guide, 3rd edition. Society for Industrial and Applied Mathematics, 1999.
  6. IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic. Institute of Electrical and Electronics Engineers.

AI Suggested Questions

  • Construct a 3×3 matrix with no zero entries that is singular, and show the vector of constants that makes its system inconsistent.
  • Compare the floating-point accuracy of solving a system by explicit inversion against LU factorisation for a matrix with condition number 108.
  • Explain why the inverse of a tridiagonal matrix is generally full, and what that implies for storing the inverse of a finite element stiffness matrix.
  • Show how the columns of a flexibility matrix can be interpreted as influence lines for a simple beam model.
  • Give an example of square matrices with AB=O where neither A nor B is the zero matrix, and explain why this rules out cancellation.
  • Under what conditions does an integer matrix have an inverse that is also an integer matrix?

Related Calculators

Continue learning

Algebraic and Geometric Multiplicities of Eigenvalues | KEVOS® MathematicsArticle · Project ManagementAmitsur’s Theorem on the Radical of a Polynomial Ring | KEVOS®Article · Project ManagementAmitsur’s Theorem on the Radical of an Algebra of Small Dimension | KEVOS®Article · Project ManagementArchetypes: Reference Catalogue of Worked Systems | KEVOS® MathematicsArticle · Project Management