Taking any two points #(x_1, y_1)# and #(x_2, y_2)# on the plane, in general it is possible to form a right angled triangle with the line between these two points forming the hypotenuse. Denote this line by #C# for convenience.

One of the other sides (denote this by #A# for convenience) is the line joining the point #(x_1, y_1)# to the point #(x_1, y_2)#. This line will be parallel to the y-axis (because the value of #x# remains the same, here denoted by #x_1#).

The remaining side (denote this by #B# for convenience) is the line joining the point #(x_2, y_2)# to the point #(x_1, y_2)#. This line will be parallel to the x-axis (because the value of #y# remains the same, here denoted by #y_2#).

Note that the second points mentioned in the two previous sentences are the same; this is the vertex that encloses the right angle of the right angled triangle.

The length of the side that is parallel with the x-axis may be calculated as #(x_2 - x_1)#, that is, letting #A# now denote the length of the line, #A = (x_2 - x_1)#.

The length of the side that is parallel with the y-axis may be calculated as #(y_2 - y_1)#, that is, letting #B# now denote the length of the line, #B = (y_2 - y_1)#.

Denoting the length of the line joining the two points by #C#, it might be noted that #C# is the hypotenuse of a right angled triangle with two remaining sides #A# and #B#.

So, by Pythagoras' theorem

#C^2 = A^2 + B^2#

or (noting that we are only interested in the positive square root in this particular problem),

#C = sqrt(A^2 + B^2)#

So, the length of the line (denoted by #C#) joining the points #(x_1, y_1)# and #(x_2, y_2)# is given by

#C = sqrt((x_2 - x_1)^2 + (y_2 - y_1)^2)#

As it happens, in this particular problem, the value taken by #y_1# and by #y_2# is the same in both cases (it happens to be zero) so that #(y_2 - y_1) = 0#.

That is, the right angled triangle is "degenerate" because one of its sides is of zero length.

Despite that, the general formula for the distance between two points still works.

That is, in this particular case, in which #x_1 = -3#, #y_1 = 0#, #x_2 = 4# and #y_2 = 0#

#C = sqrt((4 - (-3))^2 - (0-0)^2) = sqrt((4 + 3)^2 - 0^2) = sqrt(7^2 - 0) = sqrt(49) = 7#

(taking the positive square root) as noted in the previous explanation provided by Julia.