This problem seems so simple that it must have been answered before, but I couldn't figure out what to search. Anyway,

Suppose you have the Euclidean distance between two points, $a$ and $b$, $z = \sqrt{x^2+y^2}$, where $x$ and $y$ are the differences, respectively, between the $x$ and $y$ co-ordinates of $a$ and $b$. Note that you do NOT know $a$ and $b$, only $z$. How do you find the value of $z' = \sqrt{(x-1)^2+(y-1)^2}$?

EDIT: Some people have (correctly) pointed out that I seem to be talking about distance from the origin. I wrote the original post in a hurry and didn't include a few clarifying details. Here is the full problem:

I have two rectangles in the plane and I want to find the minimum gap between them. I have a way (read: function) to get the minimum Euclidean distance between them, but the minimum gap is smaller than that (the gap between $(0,0)$ and $(0,2)$ is 1, the point $(0,1)$).

The $x$ and $y$ mentioned in my original problem were the difference vectors between the closest two points of the two rectangles, not as I originally said, the two points themselves.

  • 1
    $\begingroup$ Note that $\sqrt{x^2+y^2}$ is not the distance between $x$ and $y$. It is the distance between $(x,y)$ and $(0,0)$. $\endgroup$ – Arnaud Mortier May 30 '18 at 0:10
  • $\begingroup$ There is nothing smaller about $x-1$. If the $x$ component is negative, the vector $(x,y)$ just got larger. $\endgroup$ – Dan Sp. May 30 '18 at 0:23
  • $\begingroup$ @ArnaudMortier Thanks for pointing this out. I edited the post to be more clear about what I was intending. $\endgroup$ – ThePerfectionist May 30 '18 at 0:55

You can't. $\sqrt{x^2 + y^2}$ is the distance from $(x,y)$ to the point $(0,0)$. $\sqrt{(x-1)^2 + (y-1)^2}$ is the distance to the point $(1,1)$. But there infinitely many points with the same distance from $(0,0)$ (that is, lying on a circle with center $(0,0)$ and a fixed radius) that have different distances to the point $(1,1)$

| cite | improve this answer | |

Your question is "given that $(x,y)$ lies on some circle centered at the origin, how do I find the distance between $(x,y)$ and $(1,1)$?"

Answer: you don't. The only point in the plane that is equidistant from every point on a circle is the centre of the circle.

| cite | improve this answer | |
  • $\begingroup$ Though you can put limits on it. If $z\ge 1$ then $z-1\le z' \le z+1$ and if $0 \le z \le 1$ then $1-z \le z' \le 1+z$ $\endgroup$ – Henry May 30 '18 at 0:11
  • $\begingroup$ Sure, the circle is compact, so the distance between $(1,1)$ and a point on it is going to be bounded. But you can't say much more than that. $\endgroup$ – Arnaud Mortier May 30 '18 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.