The required integer is r=200. To prove it, we first show that, amongst every five 500-element subsets of {1,2,…,1000}, there are two sharing at least 200 elements, and then provide an example of five such every two of which share exactly 200 elements.
The first part is a special case of the lemma below.
Lemma. Let n be an integer greater than 1, let S1,…,Sn be subsets of a finite set S such that ∣S1∣+⋯+∣Sn∣≥∣S∣, and let N be one of the closest integers to
σ=∣S∣∣S1∣+⋯+∣Sn∣−21.
Then ∣Si∩Sj∣≥n(n−1)N(2σ−N)∣S∣ for some distinct indices i and j.
Proof of the lemma. Let χi:S→Z be the characteristic function of the set Si: χi(x)=1 if x∈Si, and χi(x)=0 otherwise; clearly, ∑x∈Sχi(x)=∣Si∣. Let further χ:S→Z, χ=χ1+⋯+χn, so χ(x) is precisely the number of Si containing x, and ∑x∈Sχ(x)=∑i=1n∣Si∣.
Next, fix an element x of S and write
(χ(x))2=(i=1∑nχi(x))2=i=1∑n(χi(x))2+21≤i<j≤n∑χi(x)χj(x)=i=1∑nχi(x)+21≤i<j≤n∑χi(x)χj(x)=χ(x)+21≤i<j≤n∑χi(x)χj(x),
to get ∑1≤i<j≤nχi(x)χj(x)=21χ(x)(χ(x)−1)=21(χ(x)−k)(χ(x)−k−1)+k(χ(x)−2k+1), for any integer k. Since χ is integer-valued, the first summand in the last expression above is non-negative, so
1≤i<j≤n∑χi(x)χj(x)≥k(χ(x)−2k+1),k∈Z.
Consequently,
1≤i<j≤n∑∣Si∩Sj∣=1≤i<j≤n∑x∈S∑χi(x)χj(x)=x∈S∑1≤i<j≤n∑χi(x)χj(x)≥x∈S∑k(χ(x)−2k+1)=k(σ−2k)∣S∣,k∈Z.
Since k↦k(σ−k/2), k∈Z, achieves its maximum at k=N, the conclusion follows by considering an intersection Si∩Sj, i<j, of maximal cardinality.
Notice that equality in the last inequality above forces each element of S to be covered by exactly N or exactly N±1 of the Si. This remark turns out to be quite useful in constructing the desired example.
Finally, to provide an example of five 500-element subsets of {1,2,…,1000} every two of which share exactly 200 elements, consider first the following five 5-element subsets of {1,2,…,10}:
A1A4={1,2,3,6,8},={2,3,4,7,9},A2A5={1,2,5,7,10},={3,4,5,8,10}.A3={1,4,5,6,9},
Since every two A's share exactly two elements, the sets ⋃k=099(10k+Ai), i=1,2,…,5, provide the desired example.