Put xˉ=n1∑k=1nxk. Counting the coefficient of each xk in the sum of all pairwise differences gives L=∑k=1n(2k−n−1)xk=∑k=1n(2k−n−1)(xk−xˉ), because ∑k=1n(2k−n−1)=0. The finite-sum identities ∑k=1nk=2n(n+1) and ∑k=1nk2=6n(n+1)(2n+1) give ∑k=1n(2k−n−1)2=4∑k=1nk2−4(n+1)∑k=1nk+n(n+1)2=3n(n2−1). Expanding the square differences gives ∑i=1n∑j=1n(xi−xj)2=2n∑k=1nxk2−2(∑k=1nxk)2=2n∑k=1n(xk−xˉ)2, so Q=21∑i=1n∑j=1n(xi−xj)2=n∑k=1n(xk−xˉ)2. Cauchy–Schwarz therefore yields L2≤3n(n2−1)∑k=1n(xk−xˉ)2=3n2−1Q. Equality holds exactly when xk−xˉ=c(2k−n−1) for one constant c, i.e. xk=x1+2c(k−1); after the relabeling this is an arithmetic sequence, including c=0.