# Determining the normal of an ellipse

Given I have (in a 2D coordinate system) an ellipse with the center at $(c_x,c_y) = (0,0)$ where I do not know the actual value of the major an minor axis but I have the ratio $r=\frac{a}{b}$ and an inclination angle $\phi$. If I know that the point $p = (p_x,p_y)$ are on the ellipse then how can I get the normal vector (pointing towards the inner part of the ellipse) at the point $p$?

I have started the following way:

First I should rotate the point $(p_x,p_y)$ such that we are in a coordinate system where the major axis lies on the x-Axis. So the rotated point $p'$ given by:

$$p' = (x, y) = (p_x\,\cos \phi− p_y\,\sin \phi\,, \,\, p_y\,\cos \phi +p_x\,\sin \phi).$$

Now the question is given that I know the ratio $r=\frac{a}{b}$ how can I find the real value for $a$ and $b$ ?

I can assign an angle $\alpha$ from the ratio of the rectangle given by $x$ and $y$ and then eventually determine the real values for $a$ and $b$:

$$\tan\alpha = \frac{y}{x}$$ $$p'_x = a \cdot \cos \alpha$$ $$p'_y = b \cdot \sin \alpha$$

from which follows:

$$a = \frac{x}{\cos(\arctan(\frac{y}{x}))}$$ $$b = \frac{y}{\sin(\arctan(\frac{y}{x}))}$$

Now that I have the real value for $a$ and $b$ we have:

$$x = a \cdot \cos (\alpha)$$ $$y = b \cdot \sin (\alpha)$$

The vector $t = (- a \cdot \sin \alpha\,,\,b \cdot \cos \alpha )$ (where $\alpha$ is given by = $\arctan(\frac{y}{x})$, and $\arctan$ beeing an inverse trigonometric function) which is given by the derivatives is tangential to the ellipse and points away from the center towards the x-axis. So the normal pointing towards the inner part of the ellipse is given by

$$n=(\,b \cdot \cos \alpha\,,\, - a \cdot \sin \alpha)$$

My primary question is whether the given result is correct. The second question is whether there is a shorter way to obtain the result.

• Possible duplicate of math.stackexchange.com/questions/171936 (the normal would be perpendicular to the tangent). Several other sources online, but they all deal with non-rotated ellipses. – barrycarter Feb 26 '16 at 18:03

## 1 Answer

You’ve made an error part way through. Although the point $(a\cos\alpha, b\sin\alpha)$ with $\tan\alpha={p'_y}/{p'_x}$ is on the ellipse, it doesn’t coincide with $(p'_x,p'_y)$ except along the major and minor axes.

You can find a normal without resorting to trigonometric functions or even solving for $a$ and $b$.

Let $f:(x,y)\mapsto \frac{x^2}{a^2}+\frac{y^2}{b^2}$. The gradient $\nabla f = \left\langle\frac{2x}{a^2},\frac{2y}{b^2}\right\rangle$ is an outward normal to the level curves of this function, which are homothetic ellipses. Multiplying by $\frac{a^2}2$ and negating to get an inward normal, we get $$\mathbf n=-\langle p'_x,r^2p'_y\rangle.$$ (This can also be derived by implicit differentiation of the standard equation of an ellipse.) You’ll then need to rotate this back into the original coordinate system.

• I don't get why the points should not coincide? I have explicitly stated that arctan would be an inverse trigonometric function. So it would cover all cases not only positive x and y. But most probably I just did not get your point. Can you please elaborate? – Sjoerd222888 Feb 28 '16 at 21:14
• @Sjoerd222888 No doubt you had the parametric form $(a\cos t,b\sin t)$ in mind, but the parameter $t$ in this expression is not the angle $(x(t),y(t))$ makes with the $x$-axis. Instead, it’s something known as the eccentric anomaly. To work with the angle, you’d need to start from the polar equation of an ellipse instead. – amd Feb 28 '16 at 21:29
• Now I got it. Thanks for the explanation! – Sjoerd222888 Feb 28 '16 at 21:32