Section 10.4 Null Spaces
The null space or kernel of a \(m \times n\) matrix \(A\) is the solution space of the homogeneous system of equations \(Ax = \mathbf 0\text{.}\) We denote this space \(N(A)\text{,}\) where
\begin{gather*}
N(A) = \{x \in \R^n : Ax = \mathbf 0 \}.
\end{gather*}
The null space is a subspace of \(\R^n\text{.}\)
Subsection 10.4.1 Manual Calculation of the Kernel
To calculate the null space of an \(m \times n\) matrix we must:
-
Find the solution to the homogeneous system \(Ax = \mathbf 0\text{.}\)
-
Write the solution \(x = (d_1, d_2, \dots, d_k, f_1, \dots f_r)\) in the form \(d_i= a_{i1} f_1 + a_{i2} f_2 + \dots +a_{ir} f_r\text{,}\) for \(i=1...k \) where \(f_1, f_2, \dots, f_r\) are the free variables and \(k + r = n\text{.}\) Then the vectors:
\begin{gather*}
(a_{11}, a_{12}, \dots, a_{1r}, 1, 0, \dots, 0) \\
(a_{21}, a_{22}, \dots, a_{2r}, 0, 1, \dots, 0) \\
\vdots \\
(a_{k1}, a_{k2}, \dots, a_{kr}, 0, 0, \dots, 1)
\end{gather*}
form a basis of \(N(A)\text{.}\)
We do this in Sage by using the
solve function.
First we will initialize our variables and the matrix we will solve.
Then we will translate the matrix into the system of equations corresponding to \(Ax = \mathbf 0\text{.}\) For each row of \(A\text{,}\) we form the product with the variable vector and set it equal to zero.
Then we call
solve to solve the equations.
By extracting the right hand side of the equation we get the parameterized solution vector.
For these parameters we can choose a particular value, in this case we will set \(r_1 = 1\text{.}\) We can then identify the basis vector, \(v\text{,}\) of the null space. We preform this substitution with the
subs method.
Subsection 10.4.2 Kernel Method
Sage provides the
right_kernel method to compute this subspace.
The output is a subspace of \(\R^3\) with a basis given by the vector we found manually.
Sage also returns the subspace \(N\) with its basis as a matrix.
We can verify that N is a subspace of \(\R^3\text{.}\)
