# Difficult equations to rewrite as ellipses

I have this equality that defines an elliptic boundary. I am trying to rewrite it in the form of the equation of an ellipse, but I am having trouble doing that. How would I go about rewriting this so it looks like the equation for an ellipse?

$$a + \frac{\sqrt{(p_x - x_x)^2 + (p_y - x_y)^2}}{s_a} = b + \frac{\sqrt{(q_x - x_x)^2 + (q_x - x_y)^2}}{s_b}$$

In this equation, $a, b, s_a, s_b$ are some constants, and $(p_x, p_y), (q_x, q_y), (x_x, x_y)$ are points, where the p and q points are fixed.

-
If $s_a=s_b \not = 0$, this looks to me as if it may be half a hyperbola or a straight line. –  Henry Nov 16 '11 at 0:48
You're right that I think they would be a straight line if they were equal, but in the general case that's not true. –  ellipseses Nov 16 '11 at 0:51
How you obtained this "elliptic boundary" might give clues on whether what you have is indeed an ellipse. –  Guess who it is. Nov 16 '11 at 0:52
Well, these are equations that model an experiment I was running, and in my writeup of this experiment I wish to explain that this is an elliptical boundary in the general case (which I can see by my results!) but it seems almost impossible to rearrange this –  ellipseses Nov 16 '11 at 0:56
Try $a=s_a=s_b=p_x=p_y=1$, $b=q_x=q_y=-1$, then I think you will find positive $x_x$ and $x_y$ satisfy $x_x x_y = 1/2$. –  Henry Nov 16 '11 at 1:02

In fact, the equation you have is what's generally known as a Cartesian oval.

The equation you gave is similar in form to

$$m \sqrt{(x-a)^2+y^2}\pm n \sqrt{(x+a)^2+y^2}=k$$

which is equation 2 in the MathWorld link I gave, after setting the fixed points $p$ and $q$ (the foci) on the horizontal axis and having the segment joining the two foci be centered at the origin, and identifying $a-b$ or $b-a$ with $k$, and $1/s_a$ and $1/s_b$ with $m$ and $n$.

As noted in the MathWorld link, central conics are degenerate Cartesian ovals, obtained by setting $m=n$.

-
But the second square root has (x + a), rather than -? Interesting though.. –  ellipseses Nov 16 '11 at 2:11
Yes. Take $2a$ to be the distance between your $p$ and $q$, and let $p$ be $(-a,0)$ and $q$ be $(a,0)$... –  Guess who it is. Nov 16 '11 at 2:13
That's putting very strict restrictions on p and q though. Place arbitrary points in the x,y plane (positive coordinates for simplicty) and I don't see it. –  ellipseses Nov 16 '11 at 2:18
You can translate and rotate a line segment such that it's centered at the origin and coincident with the horizontal axis, no? –  Guess who it is. Nov 16 '11 at 2:22
I suppose that is true, but if you were doing this comparison against many points in the same plane, would the shapes be the same each time? –  ellipseses Nov 16 '11 at 2:25

In order to get an ellipse you need to have $s_a=-s_b$. By multiplying everything with $s_a$ and then subsuming $b$ into $a$ we can get $$a+\sqrt{(p_x - x_x)^2 + (p_y - x_y)^2} = - \sqrt{(q_x - x_x)^2 + (q_x - x_y)^2}$$ Square both sides of this to give $$a^2+(p_x - x_x)^2 + (p_y - x_y)^2 +2a\sqrt{(p_x - x_x)^2 + (p_y - x_y)^2} = (q_x - x_x)^2 + (q_x - x_y)^2$$ Rearrange this to get everything but the remaining square root on the right-hand side. The $x_x^2$ and $x_y^2$ terms cancel out (which is why we needed $|s_a|=|s_b|$), and we get $$2a\sqrt{(p_x - x_x)^2 + (p_y - x_y)^2} = (\cdots)x_x + (\cdots)x_y + (\cdots)$$ with some constant coefficients on the right that you can work out. Now square both sides again. You get a second-degree equation in $x_x$ and $x_y$, describing a conic.

(Now, where did we use my requirement that $s_a$ and $s_b$ have different signs? We didn't. But if the signs are equal, then the equation describes either half of a hyperbola or nothing at all -- the "nothing at all" case being the locus of points whose distances to $p$ and $q$ differ by more than the distance between $p$ and $q$, which is forbidden by the triangle equality. The information loss inherent in the squarings magically replaces this non-existing locus with an ellipse anyway, but an ellipse that doesn't solve the original equation).

If $|s_a|\ne|s_b|$ then you may possibly get a roundish curve when you plot your equation, but this curve will not be an ellipse. Because the quadratic terms do not cancel out before we square for the second time, we get a fourth-degree curve after the dust settles. I imagine that it will start looking somewhat egg-shaped as the relative difference between $|s_a|$ and $|s_b|$ increases.

-
+1: I think you have confirmed my various earlier comments –  Henry Nov 16 '11 at 1:13
Here is a scenario plugged into wolfram alpha where $sa \neq -sb$ and it looks to be an ellipse. Why? wolframalpha.com/input/… edit just saw your edit... Interesting. What would you call the egg shaped curve that it ends up being? –  ellipseses Nov 16 '11 at 1:25
@ellipseses: It doesn't look like an ellipse to me -- it is distinctly flatter on the right side than on the left. Ellipses, in contrast, are centrally symmetric. –  Henning Makholm Nov 16 '11 at 1:29
@ellipseses: This distinctly doesn't look like an ellipse. This even less. –  Henning Makholm Nov 16 '11 at 1:39
@HenningMakholm you didn't square, you just wrote a 2 in yoru wolfram alpha plots (unless the formatting removed them for some reason. It still stands that it doesn't look like an ellipse, you're right. How do I name these plots? –  ellipseses Nov 16 '11 at 1:45

It could be an ellipse, but by nature it is degree 4 in the variables. Multiply through by $s_a s_b$ to get rid of denominators. The subtract so all square roots are on one side, everything else on the other. Square both sides. At this point you have $mess_1 = \sqrt{mess_2} + mess_3.$ Subtract again to get $mess_1 - mess_3 = \sqrt{mess_2}.$ Square both sides again. No more square root signs.

So, degree 4, and apparently a closed (bounded curve) from its appearance. If you carefully graph $x^4 + y^4 = 1,$ you get a sort of squarish thing. $x^4 + 2 x^2 y^2 + y^4 = 1$ is a circle. However, $x^4 + x^2 y^2 + y^4 = 1$ is in between. Finally, taking a coefficient just below 2, $x^4 + 1.9 x^2 y^2 + y^4 = 1$ is pretty close to a circle. Similar comments apply if you stretch in the $x$ direction to get things that are sort of like rectangles or ellipses.

-
Interesting approach... but $((\sqrt(a) - \sqrt(b))^2)^2$ still has square roots, does it not? –  ellipseses Nov 16 '11 at 1:35
You do not square twice in a row. First you take $(\sqrt{a} - \sqrt{b})^2 = a + b - 2 \sqrt{ab},$ then put the $a+b$ on the other side to get $mess = - 2 \sqrt{ab},$ THEN you square again to get $mess^2 = 4 a b.$ –  Will Jagy Nov 16 '11 at 1:44

The intuitive idea is that you are looking for the points $\{x\}$ where the weighted sum or difference of their distances to the points $p$ and $q$ to be $a-b$.

It is well known that if the (unweighted) sum of the distances to two given points is a given constant (and the constant is more than the distance between the points) then you have an ellipse. This happens here if $s_a = -s_b$.

It is slightly less well known unless you have a classical mathematics education that if the absolute value of the difference of the distances to two given points is a constant then you have a hyperbola (except when the difference is zero, in which case you have the perpendicular bisector between the two points). This happens here if $s_a = s_b$, and as you are not taking the absolute value you only get half the hyperbola.

But if the distances are weighted differently then the constant sum or difference should not produce a conic section.

-