Many problems from mechanics involving non-holonomic velocity constraints lead to the study of a geometry called non-holonomic or sub-Riemannian. For instance a coin rolling without slipping on a flat surface can be described by some angle parameters which describe its motion on a certain sub-Riemannian manifold. All the trajectories of the coin are horizontal curves (tangent to a certain distribution). Chow's connectivity theorem states that the coin can roll between any to given states. We shall deal with the optimization problem for the coin motion, i.e., finding the horizontal curve which minimizes the distance between two given end positions of the coin. We shall integrate explicitely the variational equations in order to get the optimal coin trajectory.