In the exercise there is a hint for finding the intersection of the two boxes (π₯π1,π¦π1,π₯π2,π¦π2) and for
xi1 = max of the x1 coordinates of the two boxes
yi1 = max of the y1 coordinates of the two boxes
xi2= min of the x2 coordinates of the two boxes
yi2= min of the y2 coordinates of the two boxes

But than I drew I saw that
xi1 =min of the x1 coordinates of the two boxes
xi2=max of the x2 coordinates of the two boxes

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.

Itβs a little cluttered, but note in the diagram that:
xi1 is pointing at b2_x1, which is the max of b2_x1 and b1_x1
yi1 is pointing at b2_y1, which is the max of b2_y1 and b1_y1
etc

x is horizontal, y is vertical, per guidelines for this notebook exercise