Let us define a bipartite graph G as usual way. The boys and girls are vertices of the graph and pairs of friends are edges. It suffices to prove that the bipartite complement of this graph has a (n−2d) regular subgraph with 2n vertices.
Lemma. Let G be a bipartite graph. V(G)=A∪B and all the vertices are between A and B. Let ∣A∣=∣B∣=n. If k∣X∣≤e(X,Y)+k(n−∣Y∣) holds for any X⊆A and for any Y⊆B, then there exists a k regular subgraph of G, with vertices V(G). (e(X,Y) is the number of edges between X and Y).
Proof of lemma. Let us consider the following directed graph G~. V(G~)=V(G)∪{a,b}, E(G~)={(x,y)∣x∈A,y∈B}∪{(a,x)∣x∈A}∪{(y,b)∣y∈B}. Now we define weight on the edges. All edges in {(x,y)∣x∈A,y∈B} have weight 1, and all the remaining edges have weight k. Let us show that max-flow from a to b is kn. By MAX-FLOW, MIN-CUT theorem, it suffices to show that minimum cut is kn.
Assume that X⊆A and Y⊆B and {(a,x)∣x∈X}∪{(y,b)∣y∈Y} are all the edges that not affected by the cut. Then all the edges between X and Y must be affected. Thus, the weight of cut is at least k∣A−X∣+k∣B−Y∣+e(X,Y)≥k∣A−X∣+k∣X∣=k∣A∣=kn. This completes proof of lemma.
Let G~ be the bipartite complement of G. We need to show that G~ has a (n−2d) regular subgraph with 2n vertices. By the lemma, it suffices to show that
(n−2d)(n−∣Y∣)+eG~(X,Y)≥(n−2d)∣X∣,∀X⊆A,∀Y⊆B
or equivalently,
(n−2d)(∣X∣+∣Y∣−n)≤eG~(X,Y),∀X⊆A,∀Y⊆B.
If ∣Y∣≤n−2d, then ∣Y∣+2d−n≤0 and
(∣X∣+d−n)(∣Y∣+2d−n)≥(n+d−n)(∣Y∣+2d−n)≥d(2d−n).
(∣X∣+d−n)(∣Y∣+2d−n)≥(∣X∣+d−n)d≥(2d−n)d.
If n−2d≤∣Y∣ and n−d≤X then from d≤2n,
(∣X∣+d−n)(∣Y∣+2d−n)≥0≤d(2d−n).
If ∣X∣≤d, then from e(X,Y)≤∣Y∣⋅∣Y∣ and ∣Y∣≤∣X∣≤d≤2n,
(n−2d)(∣X∣+∣Y∣−n)≤0.
This completes the proof.