1. Not sure in which part of Germany you live but where I live we would use this notation:

2. You are looking for a point P with the following properties:

That means the distance has a minimum.

There is a simple formula which yields the perpendicular distance of a point to a straight line which is probably known to you. I'll show you a different approach (it is always useful to have an alternative at hand ) :

3. Calculate the vector from Q to any point of g:

Determine the minimum of by differentiating wrt and set the numerator of the quotient equal to zero.

You'll get which produces the point P(2,2,3).

4. Thus the line you are looking for is the line .