Wolfram Research

Function Repository Resource:

Nullity

Source Notebook

Compute the nullity of a matrix

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["Nullity"][mat]

computes the nullity of the matrix mat.

Details and Options

The nullity of a matrix is the dimension of its null space, also called its kernel. The kernel is the space of all input vectors that the matrix maps to zero.

Examples

Basic Examples

Compute the nullity of a matrix:

In[1]:=
ResourceFunction["Nullity"][{{1, 2}, {3, 4}}]
Out[1]=

Compute the nullity of another matrix:

In[2]:=
ResourceFunction["Nullity"][{{1, 2}, {2, 4}}]
Out[2]=

Compute the nullity of another matrix:

In[3]:=
ResourceFunction["Nullity"][{{0, 0}, {0, 0}}]
Out[3]=

Properties and Relations

The rank-nullity theorem states that the rank of a matrix plus its nullity equals its column count:

In[4]:=
Grid[Prepend[{MatrixForm[#], MatrixRank[#], ResourceFunction["Nullity"][#], Last[Dimensions[#]]} & /@ {{{1, 2}, {3, 4}}, {{1, 2}, {2, 4}}, {{0, 0}, {0, 0}}, {{1, 2}, {3, 4}, {5, 6}}, {{1, 2, 5}, {2,
       4, 6}}, {{1, 2, 3}, {2, 4, 6}, {9, 8, 7}}}
  ,
  {m, MatrixRank[m], ResourceFunction["Nullity"][m], "number of columns"}
  ], Frame -> All, Background -> {Automatic, {LightBlue, Automatic}}]
Out[4]=

When called with symbolic arguments, Nullity assumes maximal linear independence:

In[5]:=
ResourceFunction["Nullity"][{{0, 0}, {a, b}}]
Out[5]=

The nullity of an identity matrix is always zero:

In[6]:=
ResourceFunction["Nullity"][IdentityMatrix[5]]
Out[6]=

The nullity of a Hilbert matrix is always zero:

In[7]:=
ResourceFunction["Nullity"][HilbertMatrix[3]]
Out[7]=

The nullity of a Toeplitz matrix is always zero:

In[8]:=
ResourceFunction["Nullity"][ToeplitzMatrix[3]]
Out[8]=

Resource History

Related Resources

License Information