Balanced cut-vector distance formula (source code)

= Balanced cut-vector distance formula
{title2=$\|v_X-v_Y\|_2^2=4t(2p-t),\quad t=|X\cap Y|$}

Represent a balanced partition of $[4p]$ by the zero-one vector recording which unordered pairs lie across its cut. Complementary subsets represent the same cut; choose the representative containing coordinate one. Two such cuts differ on the pairs crossing the <symmetric difference> of their sides, giving the displayed distance. Its maximum is $4p^2$, attained exactly when $t=p$. Every cut has $4p^2$ occupied coordinates, so the vectors lie in an <affine hyperplane> of dimension at most $\binom{4p}{2}-1$.