Inside the sphere, the electric field has the form , including at the origin. Thus it is a conservative vector field. Outside, use the gradient of a radial function to obtain
This is also an explicit potential of a conservative vector field, single-valued throughout the exterior region. Equivalently, the curl vanishes in both regions: for a radial coefficient , because is radial. The interior formula avoids any apparent issue at the origin. The vector-field potentials here have the opposite sign from the electric potential convention used in (b).
For , use the gradient of a radial function with :
Equivalently each component is by differentiating . The origin is excluded from the function's domain.
For , the multivariable chain rule gives , with the corresponding expressions for . Thus the gradient of a radial function is
The origin needs a separate check because is undefined there. If the one-variable function has a finite right derivative at zero, the radial composite is differentiable at the origin exactly when , in which case its gradient is zero. A nonzero radial slope gives incompatible opposite-direction derivatives.
Choose the bounded, nonnegative nondecreasing function from part (d), and define
The function is convex and nondecreasing. For , the triangle inequality, monotonicity, and convexity give
Hence is a convex function. By the gradient of a radial function formula and the fundamental theorem of calculus,
for whenever . A monotone function has at most countably many discontinuities, so part (d) makes the exceptional radii -null. The origin is also -null. Define ; thus -almost everywhere.
For every in the orthogonal group, , including at zero. Consequently is invariant under the orthogonal group. Moreover away from the null origin, and composition of pushforward measures gives
Part (c) therefore gives . The Knott–Smith optimality criterion makes a transport map given by a convex function's gradient optimal for the quadratic transport cost. Uniqueness from Brenier's theorem yields
Since directions agree, this also identifies the optimal value: