Claim: matching smallest cookie to smallest satisfiable child is optimal. Proof: suppose there is a better solution where cookie goes to child instead of , where (child has smaller greed). Since , greed[] >= greed[]. Cookie could have satisfied child too. Swapping gives at least as many satisfied children.
By exchange argument, the greedy solution is optimal. This exchange proof works because swapping to a smaller cookie never hurts. The core idea: if a larger cookie works, the smaller one works too.