# Solution af a system of 2 quadratic equations

I have a system of two quadratic equations with unknowns $x$ and $y$:

$$a_{1 1} x y + a_{1 2} x^2 + a_{1 3} y^2 + a_{1 4} x + a_{1 5} y + a_{1 6} = 0,\\ a_{2 1} x y + a_{2 2} x^2 + a_{2 3} y^2 + a_{2 4} x + a_{2 5} y + a_{2 6} = 0,$$

where $a_{i j}$ are arbitrary scalars.

Is there an algebraic solution of the above system?

• easy case would be ,if we could complete square in each equation,get similar to circle equation – dato datuashvili Jul 26 '12 at 9:06
• So you have two conic sections that cut each other and you are looking for the cut points? – draks ... Jul 26 '12 at 9:11
• Yes, I have tho conics and I am looking for the intersercion points. – tomto Jul 26 '12 at 9:32

The solutions to a two second degree equations system in two variables may be seen as the coordinates of the intersections of two generic conic sections. In particular two conics may possess none, two or four possibly coincident intersection points. The best method of locating these solutions exploits the homogeneous matrix representation of conic sections, i.e. a 3x3 symmetric matrix which depends on six parameters. The procedure to locate the intersection points follows these steps:

• given the two conics $C_1$ and $C_2$ consider the pencil of conics given by their linear combination $\lambda C_1 + \mu C_2$
• identify the homogeneous parameters $(\lambda,\mu)$ which corresponds to the degenerate conic of the pencil. This can be done by imposing that $\det(\lambda C_1 + \mu C_2) = 0$, which turns out to be the solution to a third degree equation.
• given the degenerate conic $C_0$, identify the two, possibly coincident, lines constituting it
• intersects each identified line with one of the two original conic; this step can be done efficiently using the dual conic representation of $C_0$
• the points of intersection will represent the solution to the initial equation system
• Ah, yes, that's another nice way to solve it! – Andrea Mori Jul 26 '12 at 10:11
• @darks: Thank you very much! I think it is a good solution for me. I have only one question: If I compute coeficients of the degenerate conic $C_0$ the question is how to compute parameters of the lines? I have a solution but it is not elegant: For example I fix $x$ for some value and calculate $y$ from $C_0$. I repeat the procedure for some other value of $x$. I calculate lines parameters from these points. Is there any better (more elegant) solution? – tomto Jul 27 '12 at 7:16
• @draks ... I am also curious about this. How would one programatically find the lines that constitute a degenerate conic (i.e. without completing the square by hand, etc.)? – David Doria Mar 5 '13 at 17:27

Each equation describes a conic. Thus, you are trying to compute the intersection $\cal C_1\cap\cal C_2$ of two conics. In general, you have to expect four intersection points (e.g., think of two ellipses meeting transversally).

There are special cases where the task is simplified. For instance, if one of the two conics splits as the union of two lines, or if one of the equations reduces easily to the form $y=f(x)$.

In the general case you can either try Elimination Theory or you can exploit the fact that conics are rational curves, i.e. that there is a parametrization $$\Bbb R\ni t\mapsto (x(t),y(t))\in\cal C_1\qquad(*)$$ given by rational functions, i.e. quotient of polynomials in $t$. Then if you plug this "rational description" of $\cal C_1$ into the equation of $\cal C_2$ will eventually get a polynomial equation of degree 4 in the variable $t$ only, whose solutions correspond to the intersection points. In order to solve this degree 4 equation you need either some luck, or some patience to go browsing old Algebra books.

In order to get (*), the usual method is to find just one point $(x_o,y_o)\in\cal C_1$, consider the lines $$\ell_t: y=t(x-x_o)+y_o$$ through it and describe the second intersection of $\cal C_1\cap\ell_t$ in terms of $t$.

• Andrea, thank you for your answer. I will try to follow your advices. But the most I need is an exact formula, how to solve this problem. This formula can be complicated - this is not problem for me because I plan to put this formula to a computation algorithm. – tomto Jul 26 '12 at 9:51
• @user36556: A final formula that includes all cases might be very very complicated. In any event the procedure to get the intersection point can certainly be translated into an effective algorithm, and I'm sure that it already has. – Andrea Mori Jul 26 '12 at 9:59
• Maybe the formula that I am looking for can be generated by some algebra software (for example Matlab Symbolic Toolbox)? Actualy I don't have access to such software or I don't have knowledge about free software substitutes. – tomto Jul 26 '12 at 10:01
• I'm not an expert in symbolic computation software. I do use occasionally Maple just because my institution purchased a licence. What software is best to use for the case in question may be subject of another question here. – Andrea Mori Jul 26 '12 at 10:09