Distance to a circle vs distance to a line

113 Views Asked by At

A line can be defined as $y = mx+p$, that is, every point that satisfy $y-mx+p=0$. The "$0$" in this equation is a number increasing and decreasing depending on the distance between the point to the line. In other words, the function $f(x, y) = y-mx+p$ takes a point and returns a number increasing and decreasing depending on the distance between the point to the line.

If we place two points $A$ and $B$ at equal distance from the line, we indeed get the same absolute value for $f(A)$ and $f(B)$, which is $0.5$ (great!).

picture of a line y=0.5x + 1

If we do the exact same thing with a circle, defined as $f(x, y) = x^2+y^2-r^2$, it does not work. We place two points $A$ and $B$ at equal distance from the circle, but the absolute value for the bottom point is less (1.75) than the number for the top point (2.25). In other words, we cannot use this equation to know whether two points are at equal distance from the circle.

circle x2 + y2 = 4

The question is: why doesn't it work for the circle but works with the line? is it because of the square?

1

There are 1 best solutions below

2
On

The formula you wrote for the distance from a point to a line is not the formula for the shortest distance from a point to a line; instead, it's actually the vertical distance. By the way, it seems that you've also made a typo for the vertical distance formula, because it should be $f(x,y)=y-mx-p$ rather than $f(x,y)=y-mx+p$. The shortest distance, which is the perpendicular distance rather than the vertical distance, is given by the formula which you can read all about here (Wikipedia). Essentially, you must also take into account the slope of your line.

As for your circle distance formula, it is not correct. By the distance formula, we know that the shortest distance between a point and a circle is $|\sqrt{(x_1)^2+(y_1)^2}-r|$. Intuitively, we derive this by using the distance formula between a point and the circle's center and subtracting the distance from the locus of the circle to the center of the circle. Using this formula, you would see that both points have a distance of $0.5$ from the circle.