The decomposition of a matrix, as a product of factors with particular properties, is a much used tool in numerical analysis. Here we develop methods for decomposing a matrix $C$ into a product $X Y$, where the factors $X$ and $Y$ are required to minimize their distance from an arbitrary pair $X_0$ and $Y_0$. This type of decomposition, a projection to a matrix product constraint, in combination with projections that impose structural properties on $X$ and $Y$, forms the basis of a general method of decomposing a matrix into factors with specified properties. Results are presented for the application of these methods to a number of hard problems in exact factorization.