Skip to content

inv

Matrix inverse.

Y = inv(X)

Returns the inverse of the square matrix X. X must be square and non-singular; numerically singular inputs return an Inf-filled result and trigger a warning.

For solving the linear system A*X = B, prefer linsolve or the \ operator over inv(A)*B — they are faster and more numerically accurate.

A = [1 2; 3 4];
B = inv(A) % [-2 1; 1.5 -0.5]
A * B % I (within eps)
  • linsolve — Solve a linear system with optional structure hints.
  • det — Determinant of a square matrix.
  • rcond — Reciprocal condition number estimate (1-norm).