The formula for calculating length is:
[tex] \sqrt{ (x_b-x_a)^{2} + (y_b-y_a)^{2} } [/tex]
We can also write [tex] x_a - x_b [/tex] or [tex] y_a - y_b [/tex]
Why it does not matter?
Let's assume we have 2 numbers, a and b.
When we perform a subtraction:
[tex] a-b [/tex], we get another number [tex] c [/tex]
When we perform another subtraction:
[tex] b-a [/tex], we get a number [tex] -c [/tex]
When we raise [tex] c [/tex] or [tex] -c [/tex] to the power of 2, the result is the same, [tex] c^{2} [/tex].