Nullity of a Matrix

Prerequisite – Mathematics | System of Linear Equations
Let A be a matrix. Since, number of non-zero rows in the row reduced form of a matrix A is called the rank of A, denoted as rank(A) and Nullity is the complement to the rank of a matrix .Please go through the Prerequisite first and read the rank topic, then come to this topic.

Therefore, Nullity of a matrix is calculated from rank of the matrix using the following steps:Let A[m*n] matrix, then:

  1. Calculate rank (r) of the Matrix.
  2. Use The Rank Plus Nullity Theorem, it says
    Nullity + rank = number of columns (n)

    Therefore, you will be able to calculate nullity as

    Nullity = no. of columns(n) - rank(r) 

Consider the examples:


Input: mat[][] = {{10,   20,   10},
                 {20,   40,   20},
                 {30,   50,   0}}

Output: Rank is 2 and hence Nullity is 1 

Explanation: Ist and IInd rows are linearly dependent. But Ist and 3rd or IInd and IIIrd are independent, so Rank is 2 and hence Nullity is (3-2) = 1.


Input: mat[][] = {{1,   2,   1},
                 {2,   3,   1},
                 {1,   1,   2}}

Output: Rank is 3 and hence Nullity is 0 

Explanation: Ist and IInd and IIIrd rows are linearly dependent, so Rank is 3 and hence Nullity is (3-3) = 0.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.