In mathematics, a generalized inverse of a matrix A is a matrix that has some properties of the inverse matrix of A but not necessarily all of them. Formally, given a matrix A∈Rn×m{\displaystyle A\in \mathbb {R} ^{n\times m}} and a matrix Ag∈Rm×n{\displaystyle A^{\mathrm {g} }\in \mathbb {R} ^{m\times n}}, Ag{\displaystyle A^{\mathrm {g} }} is a generalized inverse of A{\displaystyle A} if it satisfies the condition AAgA=A{\displaystyle AA^{\mathrm {g} }A=A}.