Hi All, first post, hope I'm obeying all the rules

If I have a 3d quadratic surface defined by $\displaystyle ax^2+by^2+cz^2+d=0$ and a point in space defined by the position vector $\displaystyle p={px,py,pz}$ , how can I determine the closest point on the surface to p?

I suspect the solution lies down the path of minimising the value of the difference between the points, or finding the values of x, y and z that minimise $\displaystyle apx^2+bpy^2+cpz^2-ax^2-by^2-cz^2$, but my maths is rusty and I have a feeling that if this is possible it would involve implicit differentiation or one of the other techniques I never quite mastered the first time around.

Any help or even a pointer to a different (easier) approach would be much appreciated.

Thanks,

Dave.