Ora

How to get the kernel of a matrix?

Published in Matrix Kernel Calculation 5 mins read

The kernel of a matrix, also known as its null space, is the set of all input vectors that a matrix transforms into the zero vector. To put it simply, for a matrix $A$, its kernel consists of all vectors $x$ that satisfy the homogeneous linear equation $Ax = 0$.

Finding the kernel of a matrix involves a systematic process of solving this homogeneous system. The most common and effective method utilizes the Row Reduced Echelon Form (RREF) of the matrix, as a matrix and its RREF share the identical kernel. This means that the set of solutions for $AX = 0$ is exactly the same as the set of solutions for $BX = 0$, where $B$ is the RREF of $A$.

How to Find the Kernel of a Matrix: Step-by-Step

Follow these steps to determine the kernel of any given matrix:

  1. Form the Homogeneous System:
    Start by setting up the matrix equation $AX = 0$. Here, $A$ is your original matrix, $X$ is a column vector of unknown variables, and $0$ is the zero vector of the appropriate dimension.

  2. Augment the Matrix:
    Create an augmented matrix by attaching a column of zeros to the right side of your original matrix $A$. This visually represents the homogeneous system.

    • For example, if $A = \begin{pmatrix} a{11} & a{12} \ a{21} & a{22} \end{pmatrix}$, the augmented matrix becomes $\begin{pmatrix} a{11} & a{12} & | & 0 \ a{21} & a{22} & | & 0 \end{pmatrix}$.
  3. Transform to Row Reduced Echelon Form (RREF):
    Apply a series of elementary row operations to the augmented matrix until it is in RREF. These operations include:

    • Swapping any two rows.
    • Multiplying an entire row by a non-zero constant.
    • Adding a multiple of one row to another row.
      The goal is to get leading 1s (pivots) in each non-zero row, with zeros above and below each pivot, and all zero rows at the bottom.
  4. Identify Pivot and Free Variables:

    • Pivot Variables: These correspond to the columns in your RREF that contain a leading 1. Each pivot variable can be expressed in terms of other variables.
    • Free Variables: These correspond to the columns in your RREF that do not contain a leading 1. For each free variable, you can assign an arbitrary parameter (e.g., $s, t, u, \dots$) because they can take any real value.
  5. Write the General Solution:
    From the RREF, write down the system of equations. Express each pivot variable in terms of the free variables (and their assigned parameters). This will give you the general form of any vector $X$ that satisfies $AX=0$.

  6. Express as a Linear Combination (Basis for the Kernel):
    Take the general solution vector from Step 5 and decompose it into a sum of vectors, where each vector is multiplied by one of the parameters you assigned to the free variables. The vectors that remain after factoring out the parameters form a basis for the kernel (null space).

    • The kernel is then the span of these basis vectors.
    • The number of vectors in this basis is called the nullity of the matrix.

Example: Calculating the Kernel

Let's find the kernel of the matrix:
$A = \begin{pmatrix} 1 & 3 & -1 \ 2 & 6 & -2 \ -3 & -9 & 3 \end{pmatrix}$

  1. Form the homogeneous system $AX = 0$:
    $\begin{pmatrix} 1 & 3 & -1 \ 2 & 6 & -2 \ -3 & -9 & 3 \end{pmatrix} \begin{pmatrix} x_1 \ x_2 \ x_3 \end{pmatrix} = \begin{pmatrix} 0 \ 0 \ 0 \end{pmatrix}$

  2. Augment the matrix:
    $\begin{pmatrix} 1 & 3 & -1 & | & 0 \ 2 & 6 & -2 & | & 0 \ -3 & -9 & 3 & | & 0 \end{pmatrix}$

  3. Transform to RREF:

    • $R_2 \leftarrow R_2 - 2R_1$
    • $R_3 \leftarrow R_3 + 3R_1$
      $\begin{pmatrix} 1 & 3 & -1 & | & 0 \ 0 & 0 & 0 & | & 0 \ 0 & 0 & 0 & | & 0 \end{pmatrix}$
      The matrix is now in RREF.
  4. Identify Pivot and Free Variables:

    • Pivot variable: $x_1$ (corresponds to the leading 1 in the first column).
    • Free variables: $x_2, x_3$ (columns 2 and 3 do not have leading 1s).
      Let $x_2 = s$ and $x_3 = t$, where $s, t \in \mathbb{R}$.
  5. Write the General Solution:
    From the RREF, the first row gives the equation:
    $1x_1 + 3x_2 - 1x_3 = 0$
    Substitute the free variables:
    $x_1 + 3s - t = 0$
    $x_1 = -3s + t$

    The general solution vector is:
    $X = \begin{pmatrix} x_1 \ x_2 \ x_3 \end{pmatrix} = \begin{pmatrix} -3s + t \ s \ t \end{pmatrix}$

  6. Express as a Linear Combination (Basis for the Kernel):
    Separate the solution based on the parameters $s$ and $t$:
    $\begin{pmatrix} -3s + t \ s \ t \end{pmatrix} = \begin{pmatrix} -3s \ s \ 0 \end{pmatrix} + \begin{pmatrix} t \ 0 \ t \end{pmatrix} = s \begin{pmatrix} -3 \ 1 \ 0 \end{pmatrix} + t \begin{pmatrix} 1 \ 0 \ 1 \end{pmatrix}$

    Therefore, the kernel of matrix A is the span of the vectors $\begin{pmatrix} -3 \ 1 \ 0 \end{pmatrix}$ and $\begin{pmatrix} 1 \ 0 \ 1 \end{pmatrix}$.
    $\text{Ker}(A) = \text{span} \left{ \begin{pmatrix} -3 \ 1 \ 0 \end{pmatrix}, \begin{pmatrix} 1 \ 0 \ 1 \end{pmatrix} \right}$
    A basis for the kernel is $\left{ \begin{pmatrix} -3 \ 1 \ 0 \end{pmatrix}, \begin{pmatrix} 1 \ 0 \ 1 \end{pmatrix} \right}$. The nullity of A is 2.

Significance of the Kernel

The kernel is a fundamental concept in linear algebra that offers insights into the nature of a matrix transformation:

  • Invertibility/Injectivity: A square matrix is invertible if and only if its kernel contains only the zero vector (i.e., its nullity is zero). For any linear transformation, a trivial kernel (containing only the zero vector) indicates that the transformation is one-to-one (injective).
  • Solutions to Non-Homogeneous Systems: If $AX=b$ (where $b \ne 0$) has a particular solution $X_p$, then the general solution is $X_p + X_h$, where $X_h$ is any vector from the kernel of $A$. This means the kernel describes the "ambiguity" or "variations" in solutions.
  • Rank-Nullity Theorem: For any $m \times n$ matrix $A$, the sum of the dimension of its column space (rank) and the dimension of its kernel (nullity) equals the number of columns, $n$. This relationship is expressed as: $\text{rank}(A) + \text{nullity}(A) = n$.

Understanding how to find the kernel is essential for analyzing the properties of matrices, solving systems of linear equations, and comprehending linear transformations.