Im supposed to find the point B(x,y,z) which is a point on the surface z = x^2 + y^2 and is closest to the point A(3,0,0,)?

HOW?

I was said to differentiate the distance D between B and A, ($\displaystyle D^2 = (x - 3)^2 + y^2 + (x^2 + y^2)^2$)then the shortest distance will be for dD/dx = 0 & dD/dy = 0. Can anyone tell me why it is so?

Also i believe that posing y=0 is a good thought... then the question would be to find the distance from A to the curve z=x^2

Thanks!