The "Lagrange Mulltipliers" method uses the fact that the shortest distance from a point to a surface is always perpendicular to the surface. So a vector in the direction of the line of shortest distance is parallel to a vector perpendicular to the surface. Given the function D(x, y, z)= (x- 1)^2+ (y- 2)^2+ z^2, The vector -(Dx i+ Dyj+ Dzk)= -(2(x- 1)i+ 2(y- 2)j+ 2zk) points along the line of fastest decrease of distance. We can write the surface as G(x, y, z)= xy+ y+ 3- z^2= 0 which has gradient vector nabla G= yi+ (x+ 1)j- 2zk perpendicular to the surface. So those two vectors must be parallel which means one is a multiple of the other: -(2(x- 1)+ 2(y- 2)+ 2z= lambda (yi+ (x+ 1)j- 2zk) where lambda is the "Lagrange Multiplier".
Setting the same component equal we have the three equations, -2x+ 2= lambda y, -2y+ 4= lambda (x+ 1), and -2z= -2 lambda z. That is three equations in four unknowns, but we also have the equation of the surface, z^2= xy+ y+ 3. From -2z= -2 lambda z, we must have either z= 0 or lambda= 1. The first two equations, with lambda= 1, become -2x+ 2= y and -2y+ 4= x+ 1. With y= -2x+ 2, -2y+ 4= -2(-2x+ 2)+ 4= 4x- 4+ 4= 4x= x+ 1 so 3x= 1, x= 1/3. Then y= -2x+ 2= -2(1/3)+3= -2/3+ 6/3= 4/3. From that z^2= (1/3)(4/3)+ 4/3+ 3= 4/9+ 12/9+ 27/9= 43/9. So z= +/- sqrt(43)/3.
(One can show that z= 0, which is the same as saying xy+ y+ 3= 0, cannot give a minimum distance.)