Find a shortest distance from a point to an instersection of two implicit surfaces I have a problem where I need to find a point on a curve that is defined by two implicit surfaces. This point must be at the shortest distance from a reference point that is located somewhere in space.
These two surfaces are a cone-like and a sphere-like. The actual equations are quite complex therefore I will not present them here. However, it is important to mention that unlike in the example I provide below, the intersection curve of these surfaces does not fall in to one plane.
implicit formulation for a sphere: $x^2+y^2+z^2=1$
implicit formulation for a cone: $\frac{x^2+y^2}{0.5}=(z+1)^2$

Explanation how to derive an implicit equation of an intersection of any two 3d surfaces would help a lot as well.
EDIT: line -> curve
EDIT: Adding actual case:
The two surfaces are:
Ellipsoid -> $f_2(x,y,z)=\sqrt{\frac{Ex^2}{D}+Fxy+\frac{Dy^2}{E}+Gz^2}-\sqrt{DE}$
Stretched cone -> $f_1(x,y,z)=\frac{(x+y)-(A+B)}{2}+\sqrt{\left(\frac{(x-y)-(A-B)}{2}\right)^2+Cz^2}$
Where $A, B, C, D, E, F, G$ are the shape parameters. Let's assume that these parameters are:
$A=1$, $B=1$, $C=1$, $D=8$, $E=6$, $F=-1$, $G=1$
However they are not limited to those values, it could pretty much be anything (with some restrictions).
It results in two surfaces looking like this:

Note that the z=0 is a plane of symmetry
 A: The standard method for such problems is to introduce Lagrange multipliers. 
Assume that the reference point is the origin, and that the two surfaces are given in the form $S_1:\  g_1(x,y,z)=0$ and $S_2:\ g_2(x,y,z)=0$. Then set up the auxiliary function
$$\Phi(x,y,z,\lambda,\mu):=x^2+y^2+z^2-\lambda g_1(x,y,z)-\mu g_2(x,y,z)\ ,$$
and solve the system
$$\Phi_x=0,\quad\Phi_y=0,\quad\Phi_z=0,\quad g_1=0,\quad g_2=0$$
for $x$, $y$, $z$ (the values of $\lambda$ and $\mu$ are not needed).
This brings all conditionally stationary points of the objective function $f(x,y,z):=x^2+y^2+z^2$ on the curve $\gamma:=S_1\cap S_2$ to the fore. When applying this method you should have  the global situation under control, because there are instances when the method "fails", e.g. if $S_2$ passes through the tip of the cone $S_1$, or if $S_1$ and $S_2$ are tangent to each other at the point of minimum.
For the computations it helps if you present $S_1$ and $S_2$ avoiding square roots. It seems that both are quadrics not only in the toy example, but in your concrete case as well.
A: $$
\left \{
  \begin{align*}
    x^2+y^2+z^2 &= 1 \\
    2(x^2+y^2) &= (z+1)^{2}
  \end{align*}
\right.$$
The cone here has a nice symmetry, we can eliminate $x$ and $y$ first:
\begin{align*}
  2(1-z^2) &= (z+1)^2 \\
  3z^2+2z-1 &=0 \\
  (z+1)(3z-1) &= 0 \\
  z &= -1 \quad \text{or} \quad \frac{1}{3}
\end{align*}
When $z=-1$, $x^2+y^2=0 \implies (x,y)=(0,0)$
When $z=\dfrac{1}{3}$, $$x^2+y^2=\frac{8}{9}$$
Let the reference point be $(X,Y,Z)$, then you need to minimize
$$d=
\sqrt{
  \left( X-\frac{2\sqrt{2}}{3} \cos t \right)^2+
  \left( Y-\frac{2\sqrt{2}}{3} \sin t \right)^2+
  \left( Z-\frac{1}{3} \right)^2}=
\sqrt{
  X^2+Y^2-
 \frac{4\sqrt{2}}{3} \left( X\cos t+Y\sin t \right)+\frac{8}{9}+
  \left( Z-\frac{1}{3} \right)^2}$$
If $X^2+Y^2\ne 0$, choose $t$ such that
$$X\cos t+Y\sin t=\sqrt{X^2+Y^2}$$

Hence minimal value is attained at
  $$
\left(
  \frac{2\sqrt{2}X}{3\sqrt{X^2+Y^2}},
  \frac{2\sqrt{2}Y}{3\sqrt{X^2+Y^2}},
  \frac{1}{3}
\right)$$

See more on cone-sphere intersection.
A: If I am right, your two equations can be set in the form $z^2=P(x,y)$ where $P$ is a bivariate quadratic polynomial.
Then the projection of the curve onto the $x,y$ plane is a conic, which can be described by a parametric equation. You will get a relation like
$$\begin{cases}x=x(t)\\y=y(t)\\z=\pm\sqrt{P(x(t),y(t))}\end{cases}.$$
The requested point will be found by minimizing
$$(x(t)-x_0)^2+(y(t)-y_0)^2+(z(t)-z_0)^2,$$ i.e. by finding the roots of the derivative,
$$(x(t)-x_0)\dot x(t)+(y(t)-y_0)\dot y(t)\pm(z(t)-z_0)\frac{P'_x(x(t),y(t))\dot x(t)+P'_y(x(t),y(t))\dot y(t)}{2z}=0.$$
