The point P is external to a line of infinite length. Draw a circle centre P radius r so as to intersect the line at two points A and B. If the equation of the circle is x²+y²=r² and the line is y=a, A=(-√(r²-a²),a) and B=(√(r²-a²),a). The distance AB=2√(r²-a²). AP and BP are equal distances from the line because they are radii. The line can be moved up or down. It can be moved so that the circle no longer intersects the line so there is a point where the line touches the circle at one point only—the tangent. So A and B become that point, and AB=0, making r=a.
APB is an isosceles triangle and ∠PAB=∠ABP=θ, making ∠APB=180-2θ. But when AB=0, ∠APB=0, so 180-2θ=0, and θ=90º. The distance between P and the line is r and it makes an angle of 90º to the line, so that the shortest distance is a perpendicular from P to the line.