On the invertibility of a nearly singular matrix