A problem (among a list of Lagrange multipliers problems in Earl Swokowski's Calculus) states as follows: find the shortest distance between $2x+3y-z = 2$ and $2x+3y-z=4$. I can see that the restrictions $g_1$ and $g_2$ are the respective equations of the planes, yet I fail to identify the function to optimize. Any hints on finding it?
The equations of the two planes are not two separate constraints that must be satisfied. If they were, you would find no solutions, because the planes are parallel but not identical. No one point $(x,y,z)$ lies on both planes. (If one did, the distance between the planes would be zero.)
You can choose an arbitrary point in one of the planes, such as $(1,0,0)$ in the first plane, and then minimize the distance from $(1,0,0)$ to $(x,y,z)$ subject to the constraint the $(x,y,z)$ lies in the second plane.
Note that in problems like this, it’s generally easier to minimize the squared distance instead of the distance, because a point where distance squared is minimized will also be a point where distance is minimized (because distance is by definition nonnegative).