[Math] Proof that Gale-Shapley is man optimal

algorithmsproof-explanation

I'm having trouble following this proof that the Gale Shapley algorithm always outputs an optimal matching for men.

screen shot

Overall I find it hard to follow (probably because I find the notion of "optimal for men" rather vague) but in particular I get lost at "Let B be partner of Z in S". Two lines above we said A is a partner of Z.

Best Answer

To clear up the definition first: to say that $S^*$ is "optimal for men" means that in $S^*$, every man is paired with the best possible woman he can possibly be with among all stable pairings. There is nothing vague about it.

Now to address your point. "Two lines above", we were talking about the pairing $S^*$, the pairing produced by the Gale-Shapley algorithm. At "Let B be partner of Z in S", we are talking about a hypothetical stable pairing $S$ in which $Y$ is paired with someone better than he is paired with in $S^*$.