OA=2+x x-distance from x=2 to the right
tg a = 2/x
If it had a positive slope, it could go through the origin making the distance
between A and B zero.
If you draw the line going through (2,2) with a negative slope,
we have similar triangles by drawing lines from (2,2) to the x and y axes.
let x-2=c, y-2=k
the length of the line segment is, using Pythagoras' theorem
You could differentiate this with respect to c and set the result = 0
to find the value of x causing the segment length to be a minimum.
the segment length is
we can differentiate wrt the angle to find the minimum length
this occurs when the angle is 45 degrees
hence the minimum segment length is