i'll tell you in a second how this looks like mathematically, but intuitively we have to pick the place along the random measured search space that has the smallest sum of square difference error, which is the one where these two patches just look mostly alike.