All problems
Nullity of a 3x3 Matrix
Problem
Compute the nullity of a 3x3 matrix: the dimension of its null space.
Compute the rank by Gauss-Jordan elimination with partial pivoting and return 3 - rank.
Hint
Count pivot columns and subtract from 3; each missing pivot is a free variable.
Test cases
case 1
in: [[[1,0,0],[0,1,0],[0,0,1]]]
expected: 0
case 2
in: [[[1,2,3],[2,4,6],[0,0,0]]]
expected: 2
case 3
in: [[[0,0,0],[0,0,0],[0,0,0]]]
expected: 3
case 4
in: [[[1,0,0],[0,1,0],[0,0,0]]]
expected: 1
case 5
in: [[[1,1,1],[1,1,1],[1,1,1]]]
expected: 2
Starter codePython
def nullity_3x3(A):
# Your code here
pass5 test cases · run your code against them in the editor