The Rank of a Difference of Matrices and Associated Generalized Inverses