A purification procedure that simultaneously corrects the N- and S-representability main defects of a second-order reduced density matrix (2RDM), second-order hole reduced density matrix (2HRDM), and second-order G matrix is presented here. In this purifying procedure, the generalized unitarily invariant second-order matrix decomposition [D. R. Alcoba, Int. J. Quantum Chem. 97, 776 (2004)] for the 2RDM and the 2HRDM as well as for the G matrix is combined with the S-representability conditions. In particular, here we will focus our attention on the RDMs corresponding to doublet states.