working for small set x1 and x2