I don't know what "mathematical optimization" means in this context.
The easiest way to prove this statement is to draw the perpendicular from point A to the line.
Then select any other point on the line and draw the line from point A to this selected point..
You have drawn a right triangle in which the perpendicular is a leg and the segment to any other point is the hypotenuse. The Pythagorean theorem tells you that the hypotenuse is always longer!