We have three colored segment in this animation. Surprisingly the length of the longest one is always the sum of the length of the two smaller ones.
This is actually a very special case of Ptolemy’s theorem. The theorem gives a connection between the sides and the diagonals of a cyclic quadrilateral. In this case the length of the dashed lines is equal so the theorem can be simplified to the statement above.