next up previous
Next: Exercise 2 Up: Nullspace Previous: Nullspace

How to use MATLAB to find a basis Nullspace of A

Enter your matrix $A$ in MATLAB.

1. Type

$A= \left[ \begin{array}{rrrrrrr}
1 & 3 & 0 & 2 & 6 & 3 & 1\\
-2 & -6 & 0 & ...
...& 9 & 0 & 0 & 6 & 6 & 2\\
-1 & -3 & 0 & 1 & 0 & 9 & 3\\
\end{array} \right] $

2. Find $rref(A)$ you will get

$ A= \left[ \begin{array}{rrrrrrr}
1 & 3 & 0 & 0 & 2 & 0& 0 \\
0 & 0& 0 & 1 & ...
...0& 0& 1 & { {1} \over {3} } \\
0& 0 &0 &0 & 0 & 0 & 0 \\
\end{array} \right] $
cm

3. Solve for leading variables:

$ \begin{array}{rrrrr}
x_1= & -3x_2 & & -2x_5 \\
x_4= & -2x_5 & & \\
x_6= & -{ {1} \over {3} } x_7 & & \\
\end{array} $

cm

Set $x_2 = r, x_3 = s , x_5 = t $ and $ x_7=w $ we obtain

$ \left[ \begin{array}{rrrrrr}
x_1= & &-3r & & -2t & \\
x_4= & & & -2t & & \\
x_6= & & & & &-{ {1} \over {3} } w \\
\end{array} \right] $

In matrix form we can write this as

$ \left[ \begin{array}{r} x_1 \ x_2 \ x_3 \ x_4 \ x_5 \ x_6 \ x_7 \\
\end...
...}{r} 0 \ 0 \ 0 \ 0 \ 0 \ - { {1} \over {3} } \ 1 \\
\end{array} \right] $

So the vectors

$ v_1 = \left[ \begin{array}{r} -3 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0 \ \end{array}\...
...ay}{r} 0 \ 0 \ 0 \ 0 \ 0 \ { {1} \over {3} } \ 1 \ \end{array}\right]
$

form a basis for the solution space of $AX=0$. The solution space of $AX=0$ is called the nullspace of $A$ and denoted by $ null(A)$.

Example 6 of section 1.2, Example 10 of section 5.4, Example 4 of section 5.5 show how to solve $AX=0$ and how to find a basis for the nullspace of $A$.

Dimension of the nullspace of $A$ is called nullity of A and denoted by $ nullity(A)$.

NOTE: in the above example $ rank(A) = 3 $ and $ nullity(A) = 4.$ Recall the dimension theorem : Is $A$ is an $m \times n $ matrix then $ rank(A) + nullity(A) = n $.


next up previous
Next: Exercise 2 Up: Nullspace Previous: Nullspace
Ali A. Daddel 2003-02-25