High Quality Content by WIKIPEDIA articles! In mathematics, the stable marriage problem (SMP) is the problem of finding a stable matching a matching in which no element of the first matched set prefers an element of the second matched set that also prefers the first element. Given n men and n women, where each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference, marry the men and women off such that there are no two people of opposite sex who would both rather have each other than their current partners. If there are no such people, all the marriages are "stable".