Skip to main content
Engineering LibreTexts

18.2: The MATLAB Inverse Function - inv

  • Page ID
    55687
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    This section is short. Given a non-singular square matrix \(A, \mathrm{~A}\) in MATLAB, we can find \(A^{-1}\) in MATLAB as inv (A) (which of course may also be assigned to a new matrix, as in Ainv \(=\operatorname{inv}(A)\) ). To within round-off error we can anticipate that \(\operatorname{inv}(A) * A\) and \(A * \operatorname{inv}(A)\) should both evaluate to the identity matrix. (In finite-precision arithmetic, of course we will not obtain exactly an identity

    \({ }^{2}\) In fact, the array transpose and the matrix transpose are different: the array transpose is given by . ’ and switches rows and columns; the matrix transpose is given by ’ and effects the conjugate, or Hermitian transpose, in which \(A_{i j}^{\mathrm{H}}=\bar{A}_{i j}\) and - refers to the complex conjugate. The Hermitian transpose (superscript H) is the correct generalization from real matrices to complex matrices in order to ensure that all our linear algebra concepts (e.g., norm) extend correctly to the complex case. We will encounter complex variables in Unit IV related to eigenvalues. Note that for real matrices we can use either ’ (array) or . ’ (matrix) to effect the (Hermitian) matrix transpose since the complex conjugate of a real number is simply the real number. matrix; however, for "well-conditioned" matrices we should obtain a matrix which differs from the identity by roughly machine precision.)

    As we have already discussed, and as will be demonstrated in Unit \(\mathrm{V}\), the inv operation is quite expensive, and in most cases there are better ways to achieve any desired end than through a call to inv. Nevertheless for small systems, and in cases in which we do explicitly require the inverse for some reason, the inv function is very convenient.


    This page titled 18.2: The MATLAB Inverse Function - inv is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Masayuki Yano, James Douglass Penn, George Konidaris, & Anthony T Patera (MIT OpenCourseWare) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.