1

An ellipse centered at <span class=$(0,0)$ with semi-major axis a and semi-minor axis $b$">

I want find out for each point $(x,y)$ in the white region, the nearest point $(a \cos \theta, b \sin \theta )$ on the ellipse curve.I tried with the following approach. $$ \text {distance} = \sqrt{(x-a \cos \theta)^2+(y-b \sin \theta)^2} $$ I find out the first derivative of the $$F(\theta)=(x-a \cos \theta)^2+(y-b \sin \theta)^2.$$ The equation after first derivative is: $$ ax \sec \theta- by \csc \theta=a^2-b^2. $$ How to calculate theta for this equation?

little o
  • 4,853
cseju19
  • 71
  • 6
  • @Dbchatto67 That's enough editing for now, I think. It's getting quite annoying to focus on writing an answer with the constant notifications coming in. – Arthur Mar 28 '19 at 11:40
  • Thanks for editing Arthur! I am new to Stack Exchange and this is the first time I posted any question. – cseju19 Mar 28 '19 at 11:44
  • No worries. For next time, have a look at our guide for math formatting. It will make your equations look much better. That being said, it's not an easy equation to solve. Maybe the approach sketched by Pierre below is easier? – Arthur Mar 28 '19 at 11:48

2 Answers2

1

You can get it by solving a constrained optimization problem. You want the point $(u,v)$ that minimizes $f(u,v)=(u-x)^2+(v-y)^2$ subject to the constraint $\frac{u^2}{a^2} + \frac{v^2}{b^2} = 1$. The point $(x,y)$ doesn't need to be inside the ellipse.

The Lagrangian is given by $$ L(u,v,\lambda) = (u-x)^2+(v-y)^2-\lambda\left(\frac{u^2}{a^2} + \frac{v^2}{b^2}-1\right) $$

Now you just need to compute the critical points of $L$ and choose the ones that yield the smallest distance to $(x,y)$.

You can solve this by hand but, out of laziness, I give you Wolfram's solution... Two critical points

WARNING: Wolfram is not giving the full set of solutions. After computing $u,v$ in terms of $\lambda$ from the first two equations of the system $\nabla L = 0$ and substituting them in the last equation we get a fourth degree polynomial equation in $\lambda$. The solution must be conmputed in an alternative way if this polynomial has four real roots.

$$ \left( -\frac{a \sqrt{b^2-y^2}}{b}, \frac{-a^2 b^4 y+a^2 b^2 y^3+a b^3 x y \sqrt{b^2-y^2}+b^6 y-b^4 y^3}{a^4 b^2-a^4 y^2-2 a^2 b^4-a^2 b^2 x^2+2 a^2 b^2 y^2+b^6-b^4 y^2}\right) $$

and

$$ \left( \frac{a \sqrt{b^2-y^2}}{b}, \frac{-a^2 b^4 y+a^2 b^2 y^3-a b^3 x y \sqrt{b^2-y^2}+b^6 y-b^4 y^3}{a^4 b^2-a^4 y^2-2 a^2 b^4-a^2 b^2 x^2+2 a^2 b^2 y^2+b^6-b^4 y^2}\right) $$

One will correspond to the minimum distance and the other will correspond to the maximum distance.

This is not relevant to your question, but the Lagrange multipliers are $$ \frac{a^2 b^2-a^2 y^2+a b x \sqrt{b^2-y^2}}{b^2-y^2} $$

and

$$ \frac{a^2 b^2-a^2 y^2-a b x \sqrt{b^2-y^2}}{b^2-y^2}, $$

respectively.

PierreCarre
  • 20,974
  • 1
  • 18
  • 34
  • for critical points(u,v), the coordinate of u is always negative? how? please explain. – cseju19 Mar 28 '19 at 12:29
  • Thanks for your quick solution. I am trying to implement this. One more confusion, for critical points(u,v), the coordinate of u is always negative? how? please explain. – cseju19 Mar 28 '19 at 12:41
  • There was a typo... I'll correct it. – PierreCarre Mar 28 '19 at 13:03
  • Suppose I want to find (u,v) for any point on the major axis (x,0) then (u,v)=(-a,0) and (u,v)=(a,0) from the above equation. But this will not give me shortest distance always. For a point close to center, suppose (3,0), the shortest distance should in the vertical direction, if a>b. Please help me. – cseju19 Mar 28 '19 at 14:29
  • I guess Wolfram is dropping some solutions along the way. If you solve it by hand in the simple case $(x,y)=(0,0)$, you will get the following critical points: $(0, \pm b), (\pm a,0)$ and, if $a=b$, every point that satisfies $u^2+v^2=1$ – PierreCarre Mar 28 '19 at 16:39
  • I am trying to solve by hand and if I face any difficulty, I will ask you again. Thanks for your great help! @PierreCarre – cseju19 Mar 29 '19 at 04:37
  • I am getting a 4th degree equation of \lambda. am I going correct? @PierreCarre – cseju19 Mar 29 '19 at 07:42
  • I think λ will have 4 values? @PierreCarre – cseju19 Mar 29 '19 at 08:29
  • Like I told you, I did not solve it by hand (except for the case $x=y=0$). I'll take another look when I have a moment. @cseju19 – PierreCarre Mar 29 '19 at 09:40
  • @cseju19 In fact, like you pointed out, the problem can be reduced to a fourth degree polynomial equation in $\lambda$. Sometimes that equation will have only two real solutions (that was the case reported by Wolfram in my post, the other two are complex conjugates), but sometimes the equation may have four real solutions, and that is the case not covered in the formulas I presented. – PierreCarre Mar 29 '19 at 13:22
  • Actually I need all the real roots to decide nearest point in my work. But solving 4th degree polynomial by hand is getting difficult for me. – cseju19 Mar 29 '19 at 13:27
  • Take a look at " https://en.wikipedia.org/wiki/Quartic_function ". There you can find criteria to decide if there are two or four real roots. If there are only two, you already have the formulas, if there are four you'll find the formulas in this link. @cseju19 – PierreCarre Mar 29 '19 at 13:32
  • If I analyze the nature of the equation from discriminant, for points $(0,a),(0,-a),(0,b),(0,-b)$, two distinct real roots and two complex conjugate roots are coming. For other points, real double roots and two simple roots are coming. But the root finding formula seems very difficult to me and behaving unnaturally. – cseju19 Mar 30 '19 at 12:16
  • Can you help me with range of $\lambda$ for the equation? – cseju19 Mar 31 '19 at 08:40
-1

You have $axsec(\theta)- bycsc(\theta)= a^2- b^2$. Let $z= sec(\theta)$. Since $csc(\theta)= \frac{1}{sec(\theta)}$, the equation becomes $axz- \frac{by}{z}= a^2- b^2$. Muliply on both sides to get $axz^2- by= (a^2- b^2)z$.
We can write that as $(ax)z^3+ (b^2- a^2)z- by= 0$ and solve it using the quadratic formula: $z= sec(\theta)= \frac{a^2- b^2\pm\sqrt{(b^2- a^2)^2+ 4abxy}}{2ax}$.

user247327
  • 18,710
  • If you prefix a trigonometric function name with a backslash, LaTeX/MathJax will know it's a symbol and render it with an upright font with appropriate spacing: ax \sec \theta → $ax \sec \theta$ instead of ax sec \theta → $ax sec \theta$. – CiaPan Mar 28 '19 at 12:20
  • 1
    @user247327: \ csc \theta =1/ \ sin \theta – cseju19 Mar 28 '19 at 12:20