Continuum theory provides two constraints on the velocity field generated by a deforming body.
Computation of the velocity field using these two constraints is an ill-posed problem which may be regularized using a smoothness term. We define a penalty function as a weighted sum of the two constraining terms and the smoothness term. Minimization of this function yields the desired velocity field. Via variational calculus, it can be shown that the solution minimizing the penalty satisfies the Euler-Lagrange equations for this problem. The matrix equation is solved using the conjugate gradient algorithm.