Given the equations of the first and the second order manifolds in $ R^n $, we construct the distance equation, i.e. a univariate algebraic equation one of the zeros of which (generically minimal positive) coincides with the square of the distance between these manifolds. To achieve this goal we employ Elimination Theory methods.
In the frame of this approach we also deduce the necessary and sufficient algebraic conditions under which the manifolds intersect and propose an algorithm for finding the coordinates of their nearest points.
The case of parameter dependent manifolds is also considered.