# What is the general equation of the ellipse that is not in the origin and rotated by an angle?

I have the equation not in the center, i.e.

$$\frac{(x-h)^2}{a^2}+\frac{(y-k)^2}{b^2}=1.$$

But what will be the equation once it is rotated?

-

After a lot of mistakes I finally got the correct equation for my problem:-

$$\dfrac {((x-h)\cos(A)+(y-k)\sin(A))^2}{(a^2)}+\dfrac{((x-h) \sin(A)-(y-k) \cos(A))^2}{(b^2)}=1$$

-
This form is really elegant.Should be in text-books. (Axis rotation / $A$ ) relation varying them between $0, \pi$ can be appended. – Narasimham Jun 1 at 7:02

The equation you gave can be converted to the parametric form: $$x = h + a\cos\theta \quad ; \quad y = k + b\sin\theta$$ If we let $\mathbf x_0 = (h,k)$ denote the center, then this can also be written as $$\mathbf x = \mathbf x_0 + (a\cos\theta)\mathbf e_1 + (b\sin\theta)\mathbf e_2$$ where $\mathbf e_1 = (1,0)$ and $\mathbf e_2 = (0,1)$.

To rotate this curve, choose a pair of mutually orthogonal unit vectors $\mathbf u$ and $\mathbf v$, and then $$\mathbf x = \mathbf x_0 + (a\cos\theta)\mathbf u + (b\sin\theta)\mathbf v$$ One way to define the $\mathbf u$ and $\mathbf v$ is: $$\mathbf u = (\cos\alpha, \sin\alpha) \quad ; \quad \mathbf v = (-\sin\alpha, \cos\alpha)$$ This will give you an ellipse that's rotated by an angle $\alpha$, with center still at the point $\mathbf x_0 = (h,k)$.

If you prefer an implicit equation, rather than parametric ones, then any rotated ellipse (or, indeed, any rotated conic section curve) can be represented by a general second-degree equation of the form $$ax^2 + by^2 + cxy + dx + ey + f = 0$$ The problem with this, though, is that the geometric meaning of the coefficients $a$, $b$, $c$, $d$, $e$, $f$ is not very clear.

Addition. Borrowing from rschwieb's solution ...

Since you seem to want a single implicit equation, proceed as follows. Let $c = \sqrt{a^2 - b^2}$. Then the foci of the rotated ellipse are at $\mathbf x_0 + c \mathbf u$ and $\mathbf x_0 - c \mathbf u$. Using the "pins and string" definition of an ellipse, which is described here, its equation is $$\Vert\mathbf x - (\mathbf x_0 + c \mathbf u)\Vert + \Vert\mathbf x - (\mathbf x_0 - c \mathbf u)\Vert = \text{constant}$$ This is equivalent to the one given by rschwieb. If you plug $\mathbf u = (\cos\alpha, \sin\alpha)$ into this, and expand everything, you'll get a single implicit equation.

The details are messy (which is probably why no-one wants to actually write everything out for you).

-

Another option is to use the geometric definition of an ellipse as the set of points whose sum distance to the foci is constant.

If the foci are at $(a,b)$ and $(a',b')$, and the sum distance is $C$, you get:

$$\sqrt{(x-a)^2+(y-b)^2}+\sqrt{(x-a')^2+(y-b')^2}=C$$

-
So will the final equation be $((h+a*cos(T))^2)/(a^2)+((k+b*sin(T))^2)/(b^2)=1$ – andikat dennis Jun 21 '13 at 13:45
If you take the time to translate this answer into terms of the center and the minor axes, then yes, it will line up with the other answers. I just wanted to provide an alternate approach to the "get there from normal ellipse equations" approach given above. – rschwieb Jun 21 '13 at 14:01

As stated, using the definition for center of an ellipse as the intersection of its axes of symmetry, your equation for an ellipse is centered at $(h,k)$, but it is not rotated, i.e. the axes of symmetry are parallel to the x and y axes.

If this were not true, you would have a cross-product term involving $x \times y$. If you had such a term, you could calculate the counterclockwise rotation angle $\alpha$ required in order to eliminate the cross-product term (and thereby make the axes of symmetry parallel to the x and y axes).

One way is to use the formula $$\cot 2\alpha = \frac{A - C}{B},$$ where $\alpha$ is the counterclockwise rotation angle, $A$ is the coefficient of $x^2$, $B$ the coefficient of the cross-product term $x \times y$, and $C$ is the coefficient of $y^2$.

In order to apply the rotation once you know $\alpha$, you can find new coordinates $x', y'$ in terms of $x, y$ via $x' = x \cos \alpha - y \sin \alpha$ and $y' = x \sin \alpha + y \cos \alpha$.

Source: Calculus and Analytic Geometry, by George Thomas (paraphrased).

-

If you want the center to be $(h,k)$

• first apply a general rotation of coordinates transformation to $$\frac{x^2}{a^2}+\frac{y^2}{b^2} = 1$$ to rotate the axes to whatever angle you desire.

• then translate the center to $(h,k)$ by replacing the new $x$ and $y$ by $(x-h)$ and $(y-k)$.

-
@enzotib Thanks for the edit! I was not paying attention to the formatting while I was typing. – Dilip Sarwate Jun 21 '13 at 13:27
only a missing \\$ – enzotib Jun 21 '13 at 13:28
Is it possible to combine these two as one equation? – andikat dennis Jun 21 '13 at 13:52
"Is it possible to combine these two as one equation?" Yes. Work out the details for yourself or use the methods suggested by rschweib or bubba. – Dilip Sarwate Jun 21 '13 at 15:01

Elliptic parameter equation： $$\ x = a \cos t \cos α-b\sin t\sin α+x_0;$$ $$\ y = a\cos t\sin α-b\sin t\cos α+y_0;$$

elliptical general equation： $$\dfrac {((x-x_0)\cosα+(y-y_0)\sinα)^2}{a^2}+\dfrac{((x-x_0) \sinα-(y-y_0) \cosα)^2}{b^2}=1$$

Elliptic conic representation： $$\ Ax^2+By^2+Cxy+Dx+Ey+F=0$$ in which $$\ A=\cos^2α/a^2+\sin^2α/b^2$$ $$\ B=\sin^2α/a^2+\cos^2α/b^2$$ $$\ C=2sinαcosα(1/a^2-1/b^2)$$ $$\ D=(-2x_0\cos^2α-2y_0\sinα\cosα)/a^2-(2x_0\sin^2α-2y_0\sinα\cosα)/b^2$$ $$\ E=(-2y_0\sin^2α-2x_0\sinα\cosα)/a^2-(2y_0\cos^2α-2x_0\sinα\cosα)/b^2$$ $$\ F=(x_0\cosα+y_0\sinα)/a^2+(x_0\sinα-y_0\cosα)/b^2-1$$

Conic matrix representation： $$\ [x,y,1]M[x,y,1]'=0$$ in which $$\ M=[A,C/2,D/2;C/2,B,E/2;D/2,E/2,F]$$

-