The general second-degree equation ax2+2hxy+by2+2gx+2fy+c=0 can represent a circle, parabola, ellipse, hyperbola or a degenerate case, but its type is hidden by the linear terms 2gx,2fy and the cross term 2hxy. Translation and rotation are used, in that order, to strip these away.
Step 1 — remove the linear terms by translation. Substitute x=x′+x0,y=y′+y0 for an as-yet-unknown point (x0,y0), expand, and collect the coefficients of the new linear terms x′ and y′. Setting each of these coefficients to zero — equivalently, setting ∂/∂x=0 and ∂/∂y=0 on the original expression — gives the simultaneous linear system
ax0+hy0+g=0,hx0+by0+f=0
Solving these two equations for x0,y0 gives the exact point to which the origin must be shifted; after this translation the equation has no linear terms, only aX2+2hXY+bY2+c′=0.
Step 2 — remove the xy term by rotation. Rotate the once-translated axes through an angle θ using X=X′cosθ−Y′sinθ, Y=X′sinθ+Y′cosθ, substitute into aX2+2hXY+bY2+c′=0, and collect the coefficient of X′Y′. Setting that coefficient to zero gives …