This is a short note to self: Let be a symmetric positive semidefinite matrix with one-dimensional kernel spanned by . How to solve (if you know that is in the range of )? Just typing

x = A\b

should give a warning in a reasonable software (but also should produce some correct result, if it returns anything at all).

If you don’t want that warning and also want to get the solution that is orthogonal to the kernel you should do

x = (A+v*v')\b.

Note that has full rank (and is still an eigenvector, but now for the eigenvalue ).

Surely, the solution of which is orthogonal to the kernel of also solves this since . Conversely, if solves , then taking the inner product with gives and since and it follows that which shows that both and that is orthogonal to the kernel.