# Nakafa Framework: LLM

URL: /en/subject/high-school/11/mathematics/matrix/matrix-inverse
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/high-school/11/mathematics/matrix/matrix-inverse/en.mdx

Output docs content for large language models.

---

export const metadata = {
  title: "Matrix Inverse",
  description: "Learn matrix inverse formulas for 2x2 and 3x3 matrices. Master determinant calculations, adjoint methods, and solve linear equations step-by-step.",
  authors: [{ name: "Nabil Akbarazzima Fatih" }],
  date: "06/05/2025",
  subject: "Matrix",
};

## Understanding Matrix Inverse

In the set of real numbers, every non-zero number <InlineMath math="a" /> has a reciprocal, which is the number <InlineMath math="a^{-1}" />, satisfying the property <InlineMath math="a \cdot a^{-1} = a^{-1} \cdot a = 1" />. A similar concept applies to matrices.

If <InlineMath math="A" /> is a square matrix (e.g., of order <InlineMath math="n \times n" />) and <InlineMath math="I" /> is the identity matrix of the same order, then the inverse of matrix <InlineMath math="A" />, denoted as <InlineMath math="A^{-1}" />, is a matrix that satisfies the property:

<BlockMath math="A \cdot A^{-1} = A^{-1} \cdot A = I" />

The identity matrix <InlineMath math="I" /> is a square matrix where all main diagonal elements are 1 and all other elements are 0. For example, for a 2x2 order: <InlineMath math="I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}" />.

## Nonsingular and Singular Matrices

Not all square matrices have an inverse. A matrix <InlineMath math="A" /> has an inverse if and only if the determinant of the matrix is not equal to zero (<InlineMath math="\det(A) \neq 0" /> or <InlineMath math="|A| \neq 0" />).

- Matrix <InlineMath math="A" /> is called a **nonsingular matrix** if <InlineMath math="\det(A) \neq 0" />. A nonsingular matrix always has an inverse.
- Matrix <InlineMath math="A" /> is called a **singular matrix** if <InlineMath math="\det(A) = 0" />. A singular matrix does not have an inverse.

## Inverse of a 2x2 Matrix

For a 2x2 matrix <InlineMath math="A" />, let:

<BlockMath math="A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}" />

The inverse of matrix <InlineMath math="A" /> can be found using the following formula, provided that <InlineMath math="\det(A) \neq 0" />:

<BlockMath math="A^{-1} = \frac{1}{\det(A)} \text{Adj}(A)" />

Let's understand each component of this formula:

1.  **Determinant of Matrix A (<InlineMath math="\det(A)" /> or <InlineMath math="|A|" />)**:

    Calculated as:

    <BlockMath math="|A| = ad - bc" />

2.  **Adjoint of Matrix A (<InlineMath math="\text{Adj}(A)" />)**:

    Obtained by swapping the main diagonal elements and changing the sign of the other diagonal elements:

    <BlockMath math="\text{Adj}(A) = \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}" />

So, the complete formula for the inverse of a 2x2 matrix is:

<BlockMath math="A^{-1} = \frac{1}{ad-bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}" />

### Example of Inverse of a 2x2 Matrix

Find the inverse of matrix <InlineMath math="P = \begin{bmatrix} 3 & -7 \\ -1 & 2 \end{bmatrix}" />.

**Solution:**

Step 1: Identify the elements of matrix <InlineMath math="P" />.

<InlineMath math="a=3, b=-7, c=-1, d=2" />

Step 2: Calculate the determinant of matrix <InlineMath math="P" />.

<BlockMath math="\det(P) = (3)(2) - (-7)(-1) = 6 - 7 = -1" />

Since <InlineMath math="\det(P) \neq 0" />, matrix <InlineMath math="P" /> has an inverse.

Step 3: Determine the adjoint of matrix <InlineMath math="P" />.

<BlockMath math="\text{Adj}(P) = \begin{bmatrix} 2 & -(-7) \\ -(-1) & 3 \end{bmatrix} = \begin{bmatrix} 2 & 7 \\ 1 & 3 \end{bmatrix}" />

Step 4: Calculate the inverse of matrix <InlineMath math="P" />.

<div className="flex flex-col gap-4">
  <BlockMath math="P^{-1} = \frac{1}{\det(P)} \text{Adj}(P)" />
  <BlockMath math="P^{-1} = \frac{1}{-1} \begin{bmatrix} 2 & 7 \\ 1 & 3 \end{bmatrix}" />
  <BlockMath math="P^{-1} = -1 \begin{bmatrix} 2 & 7 \\ 1 & 3 \end{bmatrix}" />
  <BlockMath math="P^{-1} = \begin{bmatrix} -2 & -7 \\ -1 & -3 \end{bmatrix}" />
</div>

Thus, the inverse of matrix <InlineMath math="P" /> is <InlineMath math="P^{-1} = \begin{bmatrix} -2 & -7 \\ -1 & -3 \end{bmatrix}" />.

## Inverse of a 3x3 Matrix

The basic concept for finding the inverse of a 3x3 matrix is the same as for a 2x2 matrix, i.e., using the formula:

<BlockMath math="A^{-1} = \frac{1}{\det(A)} \text{Adj}(A)" />

However, the calculation of the determinant (<InlineMath math="\det(A)" />) and adjoint (<InlineMath math="\text{Adj}(A)" />) for a 3x3 matrix is more complex.

- **The determinant of a 3x3 matrix** can be calculated using Sarrus's rule or the cofactor expansion method.
- **The adjoint of a 3x3 matrix** is obtained from the transpose of its cofactor matrix.

An in-depth discussion on how to calculate the determinant and adjoint of a 3x3 matrix will usually be studied separately as it involves more steps.

## Properties of Matrix Inverse

One important use of the matrix inverse is to solve systems of linear equations. If a system of linear equations can be expressed in matrix multiplication form:

<BlockMath math="AX = B" />

where <InlineMath math="A" /> is the coefficient matrix, <InlineMath math="X" /> is the variable matrix, and <InlineMath math="B" /> is the constant matrix. If matrix <InlineMath math="A" /> has an inverse (<InlineMath math="A^{-1}" />), then the solution for <InlineMath math="X" /> can be found by:

<BlockMath math="X = A^{-1}B" />

This is a very useful property in various mathematical and engineering applications.

## Exercises

Given matrices <InlineMath math="X = \begin{bmatrix} 1 & -3 \\ -1 & 4 \end{bmatrix}" /> and <InlineMath math="Y = \begin{bmatrix} -4 & 2 \\ 3 & -2 \end{bmatrix}" />.

1. Determine matrices <InlineMath math="X^{-1}" /> and <InlineMath math="Y^{-1}" />.
2. Determine matrix <InlineMath math="X^{-1} + Y^{-1}" />.
3. Determine matrix <InlineMath math="(X+Y)^{-1}" />.
4. Is matrix <InlineMath math="X^{-1} + Y^{-1}" /> equal to matrix <InlineMath math="(X+Y)^{-1}" />? Explain your answer.

### Answer Key

1.  **Determining <InlineMath math="X^{-1}" />:**

    <div className="flex flex-col gap-4">
      <BlockMath math="X = \begin{bmatrix} 1 & -3 \\ -1 & 4 \end{bmatrix}" />
      <BlockMath math="\det(X) = (1)(4) - (-3)(-1) = 4 - 3 = 1" />
      <BlockMath math="\text{Adj}(X) = \begin{bmatrix} 4 & 3 \\ 1 & 1 \end{bmatrix}" />
      <BlockMath math="X^{-1} = \frac{1}{1} \begin{bmatrix} 4 & 3 \\ 1 & 1 \end{bmatrix} = \begin{bmatrix} 4 & 3 \\ 1 & 1 \end{bmatrix}" />
    </div>

    **Determining <InlineMath math="Y^{-1}" />:**

    <div className="flex flex-col gap-4">
      <BlockMath math="Y = \begin{bmatrix} -4 & 2 \\ 3 & -2 \end{bmatrix}" />
      <BlockMath math="\det(Y) = (-4)(-2) - (2)(3) = 8 - 6 = 2" />
      <BlockMath math="\text{Adj}(Y) = \begin{bmatrix} -2 & -2 \\ -3 & -4 \end{bmatrix}" />
      <BlockMath math="Y^{-1} = \frac{1}{2} \begin{bmatrix} -2 & -2 \\ -3 & -4 \end{bmatrix} = \begin{bmatrix} -1 & -1 \\ -3/2 & -2 \end{bmatrix}" />
    </div>

2.  **Determining <InlineMath math="X^{-1} + Y^{-1}" />:**

    <BlockMath math="X^{-1} + Y^{-1} = \begin{bmatrix} 4 & 3 \\ 1 & 1 \end{bmatrix} + \begin{bmatrix} -1 & -1 \\ -3/2 & -2 \end{bmatrix} = \begin{bmatrix} 4-1 & 3-1 \\ 1-3/2 & 1-2 \end{bmatrix} = \begin{bmatrix} 3 & 2 \\ -1/2 & -1 \end{bmatrix}" />

3.  **Determining <InlineMath math="(X+Y)^{-1}" />:**

    First, calculate <InlineMath math="X+Y" />:

    <BlockMath math="X+Y = \begin{bmatrix} 1 & -3 \\ -1 & 4 \end{bmatrix} + \begin{bmatrix} -4 & 2 \\ 3 & -2 \end{bmatrix} = \begin{bmatrix} 1-4 & -3+2 \\ -1+3 & 4-2 \end{bmatrix} = \begin{bmatrix} -3 & -1 \\ 2 & 2 \end{bmatrix}" />

    Let <InlineMath math="Z = X+Y = \begin{bmatrix} -3 & -1 \\ 2 & 2 \end{bmatrix}" />. Now, calculate <InlineMath math="Z^{-1}" />:

    <div className="flex flex-col gap-4">
      <BlockMath math="\det(Z) = (-3)(2) - (-1)(2) = -6 - (-2) = -6 + 2 = -4" />
      <BlockMath math="\text{Adj}(Z) = \begin{bmatrix} 2 & 1 \\ -2 & -3 \end{bmatrix}" />
      <BlockMath math="(X+Y)^{-1} = Z^{-1} = \frac{1}{-4} \begin{bmatrix} 2 & 1 \\ -2 & -3 \end{bmatrix} = \begin{bmatrix} -2/4 & -1/4 \\ 2/4 & 3/4 \end{bmatrix} = \begin{bmatrix} -1/2 & -1/4 \\ 1/2 & 3/4 \end{bmatrix}" />
    </div>

4.  **Comparison of <InlineMath math="X^{-1} + Y^{-1}" /> and <InlineMath math="(X+Y)^{-1}" />:**

    From the calculations:

    <div className="flex flex-col gap-4">
      <BlockMath math="X^{-1} + Y^{-1} = \begin{bmatrix} 3 & 2 \\ -1/2 & -1 \end{bmatrix}" />
      <BlockMath math="(X+Y)^{-1} = \begin{bmatrix} -1/2 & -1/4 \\ 1/2 & 3/4 \end{bmatrix}" />
    </div>

    Clearly, <InlineMath math="X^{-1} + Y^{-1} \neq (X+Y)^{-1}" />. This shows that the inverse of the sum of two matrices is generally not equal to the sum of their individual inverses.

    This property differs from some algebraic operations on real numbers.
