C.a.R. > Applications > Extremal Values > Longest Segment

Maximize AB. The solution is here.