How to convert the general form of ellipse equation to the standard form?

How to convert the general form of ellipse equation to the standard form? $$-x+2y+x^2+xy+y^2=0$$


$% Predefined Typography \newcommand{\paren} [1]{\left({#1}\right)} \newcommand{\bparen}[1]{\bigg({#1}\bigg)} \newcommand{\brace} [1]{\left\{{#1}\right\}} \newcommand{\bbrace}[1]{\bigg\{{#1}\bigg\}} \newcommand{\floor} [1]{\left\lfloor{#1}\right\rfloor} \newcommand{\bfloor}[1]{\bigg\lfloor{#1}\bigg\rfloor} \newcommand{\mag} [1]{\left\lVert{#1}\right\rVert} \newcommand{\bmag} [1]{\bigg\Vert{#1}\bigg\Vert} \newcommand{\abs} [1]{\left\vert{#1}\right\vert} \newcommand{\babs} [1]{\bigg\vert{#1}\bigg\vert} % \newcommand{\labelt}[2]{\underbrace{#1}_{\text{#2}}} \newcommand{\label} [2]{\underbrace{#1}_{#2}} \newcommand{\ulabelt}[2]{\overbrace{#1}_{\text{#2}}} \newcommand{\ulabel} [2]{\overbrace{#1}_{#2}} % \newcommand{\setcomp}[2]{\left\{~{#1}~~\middle \vert~~ {#2}~\right\}} \newcommand{\bsetcomp}[2]{\bigg\{~{#1}~~\bigg \vert~~ {#2}~\bigg\}} % \newcommand{\iint}[2]{\int {#1}~{\rm d}{#2}} \newcommand{\dint}[4]{\int_{#3}^{#4}{#1}~{\rm d}{#2}} \newcommand{\pred}[2]{\frac{\rm d}{{\rm d}{#2}}#1} \newcommand{\ind} [2]{\frac{{\rm d} {#1}}{{\rm d}{#2}}} \newcommand{\predp}[2]{\frac{\partial}{\partial {#2}}#1} \newcommand{\indp} [2]{\frac{{\partial} {#1}}{\partial {#2}}} \newcommand{\predn}[3]{\frac{\rm d}^{#3}{{\rm d}{#2}^{#3}}#1} \newcommand{\indn} [3]{\frac{{\rm d}^{#3} {#1}}{{\rm d}{#2}^{#3}}} % \newcommand{\ii}{{\rm i}} \newcommand{\ee}{{\rm e}} \newcommand{\exp}[1] { {\rm e}^{\large{#1}} } % \newcommand{\and} {~\text{and}~} \newcommand{\or} {~\text{or}~} % \newcommand{\red} [1]{\color{red}{#1}} \newcommand{\blue} [1]{\color{blue}{#1}} \newcommand{\green}[1]{\color{green}{#1}} $ If you have a conic section characterized by :

$$f(x, y) = A_0x^2 + 2B_0xy + C_0y^2 + 2D_0x + 2E_0y + F_0 = 0$$

Then the center will occur where $\indp{f}{x} = 0$ and $\indp{f}{y} = 0$, and solving the linear equations (2x2 matrix) you get the center $c$ at:

$$c_x = \frac{C_0D_0 - B_0E_0}{B_0^2 - A_0C_0}$$ $$c_y = \frac{A_0E_0 - B_0D_0}{B_0^2 - A_0C_0}$$

So the conic section shifted to be at the center will occur at

$$g(x, y) = f(x + x_c, y + y_c) = Ax^2 + 2Bxy + Cy^2 + F = 0$$

for some new coefficients $A,~ B,~ C,~ \text{and } F$:

$$\begin{align} A &= A_0(A_0C_0 - B_0^2) \\ B &= B_0(A_0C_0 - B_0^2) \\ C &= C_0(A_0C_0 - B_0^2) \\ F &= F_0(A_0C_0-B_0^2) -A_0E_0^2 - C_0D_0^2 +2B_0D_0E_0 \\ \end{align}$$

Now you must rotate the values of $x, y$ to align the axises, so you need to introduce two new variables $u, v$ under the constraint:

$$u = cx - sy$$ $$v = sy + cx$$ $$s^2 + c^2 = 1$$

Where $s$ and $c$ represent the sine and cosine of the rotation (although we will avoid trig functions like the plague).

Solving the transform for $x$ and $y$ and plugging into the definition for $g$ we get

$$h(u, v) = (Ac^2 -2Bcs+ Cs^2)u^2 + 2(Acs + Bc^2 -Bs^2 -Ccs )uv + (As^2 -2Bcs+ Cc^2)v^2 + F = 0$$

To obtain axial alignment, we need to choose $c$ and $s$ in a way that the coefficient of $uv$ is $0$ while maintaining $s^2 + c^2 = 1$.

$$Acs + Bc^2 -Bs^2 -Ccs = 0$$ $$c^2 + s^2 = 1$$

which solves to $$c^2 = \frac{\pm(C - A)\sqrt{M} + M}{2M}$$ $$s^2 = \frac{\mp(C - A)\sqrt{M} + M}{2M}$$ $$M = A^2 + C^2 + 4B^2 - 2AC$$

which is enough information to back substitute and get either an analytical expression or computational computation for a centered axial aligned conic section.


For your example: $$f(x, y) = -x+2y+x^2+xy+y^2=0$$

So $A_0 = 1$, $B_0 = 1/2$, $C _0= 1$, $D_0 = -1/2$, $E_0 = 1$, $F_0 = 0$.

So the center occurs at

$$c = \begin{bmatrix} \frac 43 \\ -\frac 53 \end{bmatrix}$$

and the origin centered shifted conic section is:

$$g(x, y) = \frac 34 x^2 + \frac 34 y^2 + \frac 34 xy - \frac 74 = 0$$

with the new $A = \frac 34$, $B = \frac 38$, $C = \frac 34$, $F = -\frac 74$.

So with yours, $M = \frac {9}{16}$, and $c = s = \pm \frac{1}{\sqrt{2}}$ (your conic section was rotated by $\frac 18$ of a revolution).

So the centered axially aligned transform of your example is:

$$9v^2 + 3u^2 - 14=0$$