  A matching in a bipartite graph with parts X and Y is called envy-free if no
unmatched vertex in X is a adjacent to a matched vertex in Y. Every perfect
matching is envy-free, but envy-free matchings exist even when perfect
matchings do not. We prove that every bipartite graph has a unique partition
such that all envy-free matchings are contained in one of the partition sets.
Using this structural theorem, we provide a polynomial-time algorithm for
finding an envy-free matching of maximum cardinality. For edge-weighted
bipartite graphs, we provide a polynomial-time algorithm for finding a
maximum-cardinality envy-free matching of minimum total weight. We show how
envy-free matchings can be used in various fair division problems with either
continuous resources ("cakes") or discrete ones. In particular, we propose a
symmetric algorithm for proportional cake-cutting, an algorithm for
1-out-of-(2n-2) maximin-share allocation of discrete goods, and an algorithm
for 1-out-of-floor(2n/3) maximin-share allocation of discrete bads among n
agents.
