Step-by-step explanation:
2 points on a coordinate grid establish a right-angled triangle, so that we can use Pythagoras to calculate the distance.
the direct distance between the 2 points is the baseline (the Hypotenuse, which is opposite of the 90° angle).
and the straight up/down and straight left/right coordinate differences of x and y are the legs. so, the third point of the triangle is the point, where these 2 legs cross (this point is not relevant to solving this issue).
you remember Pythagoras ?
c² = a² + b²
with c being the Hypotenuse, and a, b being the legs.
with the given coordinates of the 2 points we get the lengths of the legs :
in x direction (left/right) we have -7 - 2 = -9 = 9 as length.
in y direction (up/down) we have 0 - 4 = -4 = 4 as length.
since we have to square them anyway, the sign does not matter anyway.
and we have
distance² = (-9)² + (-4)² = 81 + 16 = 97
distance = sqrt(97) = 9.848857802... ≈ 9.8