He went north 10 yards and later south 2 yards, that's a total of 8 yards north from O. Likewise he went 6 yards east of O. If we think of his movement north as the measure of one leg of a right triangle and his movement east as the measure of the other leg of that right triangle, then we can find the distance from O to P as the measure of the hypotonuse of that right triangle.
c^2 = a^2 + b^2 ... where a = 8 and b = 6
c^2 = 8^2 + 6^2 = 64 + 36 = 100
c = 10