Hi Lilit.Ghalachyan,

You want the overlap, which reaches from the first point on the x-axis where the boxes start overlapping - which is the highest value of the x1 coordinates of the boxes - to the first point where they stop overlapping - which is the lowest value of the x2 coordinates of the boxes.

In other words, xi1 = max of the x1 coordinates of the two boxes, and xi2 = min of the x2 coordinates of the two boxes.