I have the following 4 equations:

\begin{eqnarray} z &=& c_0 + c_1x + c_2y + c_3xy + c_4x^2 + c_5y^2 \\ 2(x-x_0) &=& \lambda(c_1 + c_3y + 2c_4x) \\ 2(y-y_0) &=& \lambda(c_2 + c_3x + 2c_5y) \\ 2(z-z_0) &=& -\lambda \end{eqnarray}

where $x, y, z$, and $\lambda$ are unknown, $c_i$ are known coefficients, and $\mathbf{x}_0\!=\!(x_0, y_0, z_0)$ is also known. The system is what results when trying to derive the nearest point to $\mathbf{x}_0$ on the surface defined by the first equation. Note that $\mathbf{x}_0$ does not lie on the surface, and therefore does not satisfy the first equation.

I originally posted here, hoping to find an analytical approach to solving this non-linear system, but to no avail. Can anyone advise me on solving this numerically? I have no experience with solving non-linear systems of equations.

  • $\begingroup$ Why not symbolically? It's all polynomial. $\endgroup$ Dec 8, 2019 at 10:17
  • $\begingroup$ Compute the residual $r$ with $z_0+r=c_0+c_1x_0+c_2y_0+c_3x_0y_0+c_4x_0^2+c_5y_0^2$ and then use homotopy continuation where the first equation is $z+(1-t)r=c_0+c_1x+c_2y+c_3xy+c_4x^2+c_5y^2$. This should work when ${\bf x}_0$ is close to the surface, if it is farther apart, the homotopy path could curve back or move to infinity. $\endgroup$ Dec 8, 2019 at 11:01

1 Answer 1


Eliminating the variables from the second, third and fourth equations $$x=\frac{-c_2 c_3 \lambda ^2-2 (c_1+c_3y_0) \lambda -4 x_0}{c_3(c_3+2 c_5) \lambda ^2+4 c_4 \lambda -4}$$

$$y=\frac{2 (x-x_0)}{c_3 \lambda }-\frac{2 c_4 x+c_1}{c_3}$$ $$z=z_0-\frac \lambda 2$$

Replace $x,y,z$ in the first equation to get an ugly polynomial in $\lambda$ of degree $5$.

Have fun !

  • $\begingroup$ Thanks for the prompt response! Did you manipulate the 2nd and 3rd equations in my post to eliminate $y$? $\endgroup$
    – niran90
    Dec 8, 2019 at 7:32
  • $\begingroup$ Do you also think that, given I need to solve a quintic equation, there is no way of knowing if I'm within the convergence ball of the solution to the nearest point problem? $\endgroup$
    – niran90
    Dec 8, 2019 at 7:34
  • $\begingroup$ @niran90. I used the second, third and fourth equations to solve for $(x,y,z)$. I kept the solution for $x$. Now, I solved the third to get $y$ and the fourth to get $z$. At this point, everything is function of $\lambda$. $\endgroup$ Dec 8, 2019 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.