TITLE: Pairs of vertices with high degree difference
QUESTION [9 upvotes]: Consider a finite, simple and undirected graph $G=(V,E)$ with $V=\{v_1,\dots, v_n\}$. Let us also fix an integer $k> n/2$. What are we able to say about the following quantity:
$$\mathcal{I}_k(G) := \sum_{1\le i<j \le n} \mathbb{1}{\Big\{|\mathrm{deg}(v_i)-\mathrm{deg}(v_j)|\ge k}\Big\},$$
i.e. the number of all those pairs $(v_i,v_j)$ with degree difference greater or equal to $k$?
After some consideration, I am quite convinced that the following inequality is true:
\begin{equation} \mathcal{I}_k(G) \ \le \ k(n-k), \end{equation}
but I am stuck on actually proving it. What can be done, we can divide $V$ into the following parts
$$A := \{v_i : \mathrm{deg}(v_i)\ge k\},$$
$$B := \{v_i : \mathrm{deg}(v_i)\le n-k\},$$
$$R=V\setminus(A\cup B).$$
Obviously, we can assume that $A$ is a clique and $B$ is an anticlique.  So in the case of $|A|\ge k+1$ we get the bound directly - it is enough to erase all edges outside of $A$. The case of $|B|\ge k+1$ is similar.  I am however stuck in the case of $\max(|A|, |B|)\le k$. I thought about rewriting $\mathcal{I}_k(G)$ as
$$\mathcal{I}_k(G) = \sum_{i=k}^{n}|C_i|\sum_{j=0}^{i-k}|C_j|,$$
where
$$C_i := \{v_j: \mathrm{deg}(v_j)=i \},$$
and using some kind of degree sequence criterion, such as Erdős–Gallai and similar.
But I did not succeed. I would be very grateful for any comment or insight. Maybe looking on this question, You will think of some other related problem or theorem  that might be helpful. Maybe You are able to say what a general strategy might be appropriate to handle this problem. It may turn out that for some reason this problem is trivial but I have overlooked it. I will appreciate any help or advice.

REPLY [2 votes]: This is too long for a comment, but it's really just a modification of John Tuwim's answer.  By using the reductions discussed in the original post, the proof becomes even simpler and it shows that $$\mathcal{I}_k(G)\leq \mathrm{sp}(G,k-1)(n-\mathrm{sp}(G,k-1))\leq (k+1)(n-k-1).$$
Let $G$ be a graph on $n$ vertices, let $\lceil n/2\rceil\leq k\leq n-1$, let $A=\{v\in V(G): d(v)\geq k\}$, $B=\{v\in V(G):d(v)\leq n-k-1\}$, and $R=V(G)\setminus (A\cup B)$.  As mentioned in the original post, we can assume $A$ is clique, $B$ is an independent set, $R=\emptyset$, and $$n-\mathrm{sp}(G,k-1)< b:=|B|\leq |A|=:a<\mathrm{sp}(G,k-1)$$ (we can assume $b\leq a$ since $\mathcal{I}_k(G)=\mathcal{I}_k(\bar{G})$).
Now using the result of Erdős et al., there exists $S\subseteq V(G)$ such that $\mathrm{sp}(G,k-1)=|S|\geq k+1$ and for all $u,v\in S$, $|d(u)-d(v)|\leq k-1$.  Let $|s_A|=|S\cap A|$ and $s_B=|S\cap B|$ and note that
$$
s_A+s_B=\mathrm{sp}(G,k-1)>a\geq b.\tag1
$$
Thus
\begin{align*}
\mathcal{I}_k(G)&\leq s_A(b-s_B)+s_B(a-s_A)+(a-s_A)(b-s_B)\\
&\leq s_A(b-s_B)+s_B(a-s_A)+(a-s_A)s_A+(b-s_B)s_B\\
&=(s_A+s_B)(n-s_A-s_B)\\
&\leq (k+1)(n-k-1)
\end{align*}
where we used ($1$) in the second inequality and $\mathrm{sp}(G,k-1)\geq k+1>n/2$ in the last inequality.
Note that this calculation gives an upper bound in terms of $\mathrm{sp}(G, k-1)=s_A+s_B$ and shows that even when $\mathrm{sp}(G, k-1)=s_A+s_B=k+1$ we have a strict inequality provided $s_A<a$ and $s_B<b$.