Skip to content
DeepForgeby svx
All problems
HardLinear Algebrala-320

Null Space Projection 3x2

Problem

Compute the 3x3 matrix that projects vectors onto the null space of a 3x2 matrix A with independent columns.

The projector is P = I - A (A^T A)^(-1) A^T, which removes the column-space component. Return None if A^T A is singular.

Hint

The fitted projector A (A^T A)^(-1) A^T is symmetric and idempotent, so P = I - fitted projects onto the orthogonal complement.

Test cases

case 1
in: [[[1,0],[0,1],[0,0]]]
expected: [[0,0,0],[0,0,0],[0,0,1]]
case 2
in: [[[1,0],[1,0],[0,1]]]
expected: [[0.5,-0.5,0],[-0.5,0.5,0],[0,0,0]]
case 3
in: [[[1,1],[1,1],[1,1]]]
expected: null
case 4
in: [[[1,0],[0,1],[1,1]]]
expected: [[0.33333333333333337,0.3333333333333333,-0.3333333333333333],[0.3333333333333333,0.33333333333333337,-0.3333333333333333],[-0.3333333333333333,-0.3333333333333…
case 5
in: [[[0,1],[0,0],[1,0]]]
expected: [[0,0,0],[0,1,0],[0,0,0]]
Starter codePython
def null_space_projection(A):
    # Your code here
    pass

5 test cases · run your code against them in the editor