General expressions

Although the method is simple to describe, the algebra becomes messy when written in full generality. For example, suppose we use the second method, with three points (x1,y1)(x_1,y_1), (x2,y2)(x_2,y_2), (x3,y3)(x_3,y_3) none of which are at the origin.

The three equations are

(Ax1+By1)2+Cx1+Dy1=0(Ax2+By2)2+Cx2+Dy2=0(Ax3+By3)2+Cx3+Dy3=0(Ax1+By1)2+Cx1+Dy1=0(Ax2+By2)2+Cx2+Dy2=0(Ax3+By3)2+Cx3+Dy3=0\begin{gather} (Ax_1+By_1)^2+Cx_1+Dy_1=0\\ (Ax_2+By_2)^2+Cx_2+Dy_2=0\\ (Ax_3+By_3)^2+Cx_3+Dy_3=0 \end{gather}

Solving the first two for CC and DD produces:

C=(Ax2+By2)2y1(Ax1+By1)2y2x1y2x2y1,D=(Ax1+By1)2x2(Ax2+By2)2x1x1y2x2y1 C = \frac{(Ax_2+By_2)^2y_1-(Ax_1+By_1)^2y_2}{x_1y_2-x_2y_1},\quad D = \frac{(Ax_1+By_1)^2x_2-(Ax_2+By_2)^2x_1}{x_1y_2-x_2y_1}

It will simplify matters to introduce the notation

vij=xiyjxjyi. v_{ij}=x_iy_j-x_jy_i.

The discussion at mathpages does much the same thing, but treats the vv values as the elements of the cross product of the vectors [x1,x2,x3][x_1,x_2,x_3] and [y1,y2,y3][y_1,y_2,y_3].

Now, substituting into the last equation produces an equation of the form

aA2+2bAB+cB2=0 aA^2+2bAB+cB^2=0

where

\begin{align*} a & = -v_{23}x_1^2+v_{13}x_2^2-v_{12}x_3^2\\ b & = -v_{23}x_1y_1+v_{13}x_2y_2-v_{12}x_3y_3\\ c & = -v_{23}y_1^2+v_{13}y_2^2-v_{12}y_3^2 \end{align*}

The solutions are then

\begin{align*} A&=r, & B &= \frac{-br+\sqrt{b^2-acr}}{c}\\ A&=s, & B &= \frac{-bs-\sqrt{b^2-acs}}{c} \end{align*}

The values aa, bb and cc can all be expressed as the negative determinants:

a=x12x22x32x1x2x3y1y2y3,b=x1y1x2y2x3y3x1x2x3y1y2y3,c=y12y22y32x1x2x3y1y2y3. a = -\begin{vmatrix}x_1^2&x_2^2&x_3^2\\ x_1&x_2&x_3\\ y_1&y_2&y_3\end{vmatrix},\qquad b = -\begin{vmatrix}x_1y_1&x_2y_2&x_3y_3\\ x_1&x_2&x_3\\ y_1&y_2&y_3\end{vmatrix},\qquad c = -\begin{vmatrix}y_1^2&y_2^2&y_3^2\\ x_1&x_2&x_3\\ y_1&y_2&y_3\end{vmatrix}.

The next step would be to substitute these values into the expressions above for CC and DD, but as you see we're already getting to the reasonable limit of complexity for algebraic expressions. Substituting the first pair of values for AA and BB into the equation for CC produces an utterly hideous expression!