[Math] Equation of a line that passes halfway between two points (in other words, divides the space)

linear algebra

Is there a formal proper way of finding the line between two points?

By that I don't mean the line connecting the two points, I mean a line that runs the same distance away from point 1 and point 2.

To phrase it another way, I want to find the equation of a line that divides the plane into two equal parts, where each of the two points are the same distance from the line.

I drew a picture. In this picture, how do I find the purple line?

Line equidistant from two points

It may or not be relevant, but I'm asking because I am trying to learn about Support Vector Machines.

Best Answer

Each point on the line has the same distance from point $x_1=(a,b)$ as from point $x_2=(c,d)$. If we say this in equations we get: $$ (x-a)^2 + (y-b)^2 = (x-c)^2 + (y-d)^2 $$ expand

$$ x^2 -2ax + a^2 + y^2 - 2by +b^2 = x^2 -2cx +c^2 + y^2 -2dy +d^2 $$ we can simplify and get final equation $$ 2x(a-c) + 2y(b-d) +c^2 + d^2 -a^2 - b^2 = 0 $$


edit to explain in more detail first equality

If you have two points with coordinates $X=(x,y)$ and $A=(a,b)$ than distance between them is equal to $$ \text{dist}(X,A)=\sqrt{ (x-a)^2 + (y-b)^2 } $$ This is basically Pythagoras theorem. Draw right angle triangle with points $A,B,(x,b)$ than its hypotenuse is line segment connecting $A,B$. Pythagoras theorem calculates length of hypotenuse of right angle triangle.

In your question point on line, denote it $X=(x,y)$, has to have same distance from $A$ as well from $B$ so $$ \text{dist}(X,A) = \text{dist}(X,B) $$ This is almost that equation, you just need to square it.

Related Question