The derivation of the Monge-Ampère (MA) equation, as it results from a variational principle involving grid displacement, is outlined in two dimensions (2D). This equation, a major element of Monge-Kantorovich (MK) optimization, is discussed both in the context of grid generation and grid adaptation. It is shown that grids which are generated by the MA equation also satisfy equations of an alternate variational principle minimizing grid distortion. Numerical results are shown, indicating robustness to grid tangling. Comparison is made with the deformation method [G. Liao and D. Anderson,
, 285 (1992)], the existing method of equidistribution. A formulation is given for more general physical domains, including those with curved boundary segments. The Monge-Ampère equation is also derived in three dimensions (3D). Several numerical examples, both with more general 2D domains and in 3D, are given.