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:

- Calculate rank (r) of the Matrix.
- Use
**The Rank Plus Nullity Theorem**, it saysNullity + rank = number of columns (n)

Therefore, you will be able to calculate nullity as

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

Consider the examples:

**Example-1:**

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.

**Example-2:**

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.