Project DelphiTensors Workshop

Mistake: an answer from pinv proves the matrix was invertible

pinv returned without complaining, so the matrix was fine.”

A = np.array([[1., 2., 3.], [4., 5., 6.], [7., 8., 10.]]) A[:, 2] = A[:, 1] P = np.linalg.pinv(A) assert np.linalg.matrix_rank(A) == 2 assert np.allclose(A @ P @ A, A) assert not np.allclose(P @ A, np.eye(3))

pinv is defined for every matrix, so it returns quietly on a rank-2 matrix in a 3×3 box. The Moore-Penrose identities hold and P @ A is still not the identity: the duplicated column cost a direction, and no exception was ever going to say so.

Check the rank.