Solution (source code)

= Solution

Compact <support of a measure> gives finite second <absolute moments> for both <probability measures>. Since the source satisfies <absolute continuity of measures> with respect to <Lebesgue measure>, <Brenier's theorem> identifies the quadratic <Kantorovich optimal transport problem> with the <Monge optimal transport problem>:
$$
\boxed{\begin{aligned}d_2^2(\mu,\nu)&=\min_{\pi\in\Gamma(\mu,\nu)}\int|x-y|^2\,d\pi(x,y)\\&=\min_{S_\#\mu=\nu}\int|x-S(x)|^2\,d\mu(x)=\int|x-T(x)|^2\,d\mu(x).\end{aligned}}
$$
Here $S_\#\mu$ is the <pushforward measure>. The optimal <transport plan> is unique and equals $(\operatorname{Id},T)_\#\mu$. The optimal <transport map> is \b[unique up to a $\mu$-null set], with
$$
\boxed{T=\nabla u\quad\mu\text{-almost everywhere},\qquad u\text{ convex}.}
$$
The <gradient> of this <convex function> is <c-cyclically monotone> for $c(x,y)=|x-y|^2$ on a full-measure set. In particular, summing the two supporting inequalities for the <convex function> gives $(T(x)-T(x'))\cdot(x-x')\geq0$ wherever both <gradients> exist. No regularity of the target beyond the stated <probability measure> assumptions is needed.