# Determining the cartesian equation of an ellipse ( be it neither in standard position nor orientation) given center, one vertex and one semi -axis

Desmos construction, with sliders waiting for being launched : https://www.desmos.com/calculator/vuou1gnese

Question : I obtained the final formula while thinking of center $$C$$ and vertex $$V$$ as points lying in the first quadrant, with $$V$$ located to the right of $$C$$ Is the formula general in spite of this? - I assumed that the " shifting terms" $$h$$ and $$k$$ operate , so to say, in the rotated system, so that, intead of substituting $$X_C$$ for $$h$$ and $$Y_C$$ for $$k$$ , I used the coordinates of center $$C$$ in the rotated system. Is this assumption correct? Finally, can you think of other forms of this equation?

The givens are :

• $$\text {Center} = C = (X_C, Y_C)$$

• $$\text {Vertex} = V = ( X_V,Y_V) = (X_C+p, X_C+q) , \text {with }p, q$$ $$\in \mathbb R$$

• $$m {\in\space \mathbb R^+} = \text {length of one semi axis ( perpendicular to the semi-axis [CV] }$$

From what is given can be immediately deduced :

• $$M = \text {length of the semi axis [CV]}= \sqrt {p^2 + q^2}$$

• $$R = \text {inclination of the straight line (CV) on which lies the semi axis [CV] }= \arctan {\frac qp}$$

• the equations of $$X'$$ and $$Y'$$, the rotated coordinate system in which lies the parabola , namely

$$\space \space \space \space X' : y = \tan(R)x$$

$$\space \space \space \space Y' : y = (-1 / \tan(R))x$$

Since the ellipse lies in a rotated coordinate system, and since its center is not necessarily at the origin its equation will be of the form :

$$\frac { (X(x,y) -h )^2 } { M^2 } + \frac { (Y(x,y)-k )^2 } { m^2 } =1$$

with

• $$X(x,y) = x \cos(R) + y \sin (R)$$

• $$Y(x,y) = y \cos(R) - y \sin (R)$$

• $$h$$ and $$k$$ : the coordinates of center $$C$$ in the rotated coordinate system.

Determining the values of $$h$$ and $$k$$

• $$h = X_C \cos (R) + Y_C \sin (R)$$

• $$k = Y_C \sin (R) - X_C \cos(R)$$

Hence the formula for the ellipse of center $$C= (X_C , Y_C)$$, vertex $$V$$ and a semi-axis of length $$m$$ is :

$$\frac { (X(x,y) - (X_C \cos (R) + Y_C \sin (R)) )^2 } { M^2 } + \frac {( Y(x,y)-(Y_C \sin (R) - X_C \cos(R)) ) ^2 } { m^2 } =1$$

with, as said above $$M= \text {length of the semi- axis [CV]}$$

• Your assumption is fine, and I see no mistakes in a quick skim, though I think you meant $Y'=(-1/\tan R)x$, not $X'$. Not sure there's a "simpler" way of expressing it though. Also, very nice Desmos demo, though I'd turn off animations when linking. Oct 27, 2022 at 22:12
• The name of the second rotated axis contained actually a typo, thanks. ( Is your comment on the animation of the Desmos construction related to energy consumption? If it is the case , I'll stop the sliders ! ) Oct 27, 2022 at 22:17
• Not energy consumption, merely attention consumption. I wasn't expecting it. Oddly it only happened in the mobile app, not here on my desktop. Separately: there's one simplification you could make, though I don't know if it actually simplifies anything: because you have $\sin \arctan (q/p)$ in the final equation (and the cosine), you could convert to their compositions ($\sin \arctan q/p = q/(p \sqrt{1-(q/p)^2}$, similar for cosine. Oct 27, 2022 at 22:22

## 2 Answers

Too big for a comment, but using the composition of arctan and sine/cosine actually simplifies things a lot more than I expected, because $$M$$ reappears. The identities are:

$$\sin \arctan \frac q p = \frac{\frac q p}{\sqrt{1+\left(\frac q p\right)^2}} = \frac p {\sqrt{p^2+q^2}} = \frac p M \\ \cos \arctan \frac q p = \frac{1}{\sqrt{1+\left(\frac q p\right)^2}} = \frac q {\sqrt{p^2+q^2}} = \frac q M$$

This makes your final equation at the bottom:

$$\frac{1}{M^2} \left( \left( \frac{p}{M}x + \frac{q}{M}y \right) - \left( \frac{p}{M}X_C + \frac{q}{M}Y_C \right) \right)^2 + \frac{1}{m^2} \left( \left( \frac{q}{M}y - \frac{p}{M}x \right) - \left( \frac{q}{M}X_C - \frac{p}{M}Y_C \right) \right)^2 = 1 \\ \frac{1}{M^4} \left( px + qy - pX_C - qY_C \right)^2 + \frac{1}{M^2m^2} \left( py -qx - pY_C + qX_C \right)^2 = 1 \\ \frac{1}{M^2} \left( px + qy - pX_C - qY_C \right)^2 + \frac{1}{m^2} \left( py -qx - pY_C + qX_C \right)^2 = M^2$$

I fear that further "simplification" just ends up with huge constants just to put it into $$Ax^2+By^2+Cxy+Dx+Ey+F$$ form.

Rotate then Shift.

Starting from the algebraic equation of an ellipse in standard format

$$\dfrac{x^2}{a^2} + \dfrac{y^2}{b^2} = 1$$

If you define the position vector $$\mathbf{p} = [x, y]^T$$ , then the above equation can be written concisely as follows

$$\mathbf{p}^T \ D \ \mathbf{p} = 1\hspace{50pt}(*)$$

where

$$D = \begin{bmatrix} \dfrac{1}{a^2} && 0 \\ 0 && \dfrac{1}{b^2} \end{bmatrix}$$

Now in the end, you want to find the algebraic equation of the same ellipse but rotated by some angle $$\theta$$ (with respect to the original orientation) and shifted by a certain displacement vector $$(Xc, Yc)$$

So, first rotate the ellipse about the origin, then shift the resulting the ellipse by the vector $$(Xc , Yc)$$

The image of a point $$\mathbf{p} = (x,y)$$ on the original ellipse under a rotation by an angle $$\theta$$ is the point

$$\mathbf{p'} = R \ \mathbf{p}$$

where $$R$$ is the two-dimensional rotation matrix given by

$$R = \begin{bmatrix} \cos \theta && - \sin \theta \\ \sin \theta && \cos \theta \end{bmatrix}$$

And the image of $$\mathbf{p'}$$ after a shift by $$C = [X_c, Y_c]^T$$ is

$$\mathbf{p''} = \mathbf{p'} + \mathbf{C} = R \ \mathbf{p} + \mathbf{C}$$

From this last equation, we deduce that $$\mathbf{p} = R^T (\mathbf{p''} - \mathbf{C} )$$

Substituting this into equation $$(*)$$, gives us

$$(\mathbf{p''} - \mathbf{C})^T \ R D R^T \ (\mathbf{p''} - \mathbf{C} ) = 1 \hspace{50pt} (**)$$

And this is the algebraic equation of the rotated/shifted ellipse.

Explicitly, we have

$$R D R^T = \begin{bmatrix} \dfrac{1}{a^2} \cos^2 \theta + \dfrac{1}{b^2} \sin^2 \theta && \bigg( \dfrac{1}{a^2} - \dfrac{1}{b^2} \bigg) \sin \theta \cos \theta \\ \bigg( \dfrac{1}{a^2} - \dfrac{1}{b^2} \bigg) \sin \theta \cos \theta && \dfrac{1}{a^2} \sin^2 \theta + \dfrac{1}{b^2} \cos^2 \theta \end{bmatrix}$$

And $$\mathbf{p''} - \mathbf{C} = (x - X_c, y - Y_c)$$

Therefore, the algebraic equation is

$$\bigg(\dfrac{1}{a^2} \cos^2 \theta + \dfrac{1}{b^2} \sin^2 \theta \bigg) (x - X_c)^2 + 2 \bigg( \dfrac{1}{a^2} - \dfrac{1}{b^2} \bigg) \sin \theta \cos \theta (x - X_c) (y - Y_c) + \bigg(\dfrac{1}{a^2} \sin^2 \theta + \dfrac{1}{b^2} \cos^2 \theta\bigg) (y - Y_c)^2 = 1$$

Using the double angle trigonometric formulas, this last equation can be expressed as follows

$$(A + B \cos(2 \theta)) (x - X_c)^2 + 2 B \sin(2 \theta) (x - X_c) (y - Y_c) + (A - B \cos(2 \theta)) (y - Y_c)^2 = 1$$

where

$$A = \dfrac{1}{2} \bigg( \dfrac{1}{a^2} + \dfrac{1}{b^2} \bigg)$$

$$B = \dfrac{1}{2} \bigg( \dfrac{1}{a^2} - \dfrac{1}{b^2} \bigg)$$

• Thanks for this detailed answer Hosam; I accepted the other one which is more compatible with my actual level in mathematics. Oct 30, 2022 at 22:07
• You're welcome. My pleasure. Oct 30, 2022 at 22:16