Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In this problem: Intersection of conics using matrix representation , a situation arises where there are two matrices (for example:) $$Q_1 = \begin{bmatrix}1 & 0 & 0\\0 & -1 & 0\\0 & 0 & -2\end{bmatrix}$$ $$Q_2 = \begin{bmatrix}1/2 & 0 & 0\\0 & -1 & 0\\0 & 0 & -1\end{bmatrix}$$

and we must set $$det(\lambda Q_1 + \mu Q_2) = 0$$

Expanding this equation by hand is straight forward - we can group terms, rearrange, recognize the form, and solve: $$(\lambda + \frac{\mu}{2})(-\lambda-\mu)(-2\lambda-\mu) = 0$$

(Note that the expression is not always this "nice" - i.e. when there are less zero terms in the matrices).

However, I am trying to write code to do this. Even simplifying and setting $\lambda=1$, the determinant computation still involves a symbolic variable ($\mu$). Without resorting to a big symbolic manipulation library, is there a different way to solve this procedurally?

share|cite|improve this question
David, if you prefer to expand an answer to the point of literally destroying the original, post another answer instead. – Asaf Karagila Mar 4 '13 at 16:40
@AsafKaragila My apologies. I thought it was just expanding the point of xavierm02's post. Is there a way to access my edit that is "under review" so I can post it as a new answer? – David Doria Mar 4 '13 at 16:50
Sure, (if you display it as Markdown it should give you the code itself) – Asaf Karagila Mar 4 '13 at 17:22
up vote 1 down vote accepted

$\det(Q_1 + \mu Q_2) = \sum\limits_{k=0}^3a_k\mu^k$


You need to find the roots of $P$.

Since the polynomial is of degree $3$ or less, you can solve it using a general formula

share|cite|improve this answer

Here is most of the process, expanding on xavierm02 said in more detail.

The determinant expression is a cubic function in $\mu$. That is $\det(Q_1 + \mu Q_2) = \sum\limits_{k=0}^3a_k\mu^k$

If we write the matrix $$Q_1 + \mu Q_2 = \begin{bmatrix}a & b & c\\d & e & f\\g & h & i\end{bmatrix}$$ we can write $$det(Q_1 + \mu Q_2) = aei + bfg + cdh - ceg - bdi - afh$$ Now, each of $a,b,c,d,e,f,g,h,i$ have the form $\alpha + \beta \mu$, and we will refer to these $\alpha$ and $\beta$ as subscripts of the variables. For example, $aei = (a_\alpha + a_\beta\mu)(e_\alpha + e_\beta\mu)(i_\alpha + i_\beta\mu)$. Expanding this, we get $$aei = a_\alpha e_\alpha i_\alpha + a_\alpha e_\alpha i_\beta \mu +\\ a_\alpha e_\beta i_\alpha \mu + a_\alpha e_\beta i_\beta \mu^2 +\\ a_\beta e_\alpha i_\alpha \mu + a_\beta e_\alpha i_\beta \mu^2 +\\ a_\beta e_\beta i_\alpha \mu^2 + a_\beta e_\beta i_\beta \mu^3\\ = a_\alpha e_\alpha i_\alpha +\\ (a_\alpha e_\alpha i_\beta + a_\alpha e_\beta i_\alpha + a_\beta e_\alpha i_\alpha)\mu + \\ (a_\alpha e_\beta i_\beta + a_\beta e_\alpha i_\beta + a_\beta e_\beta i_\alpha) \mu^2 + \\ a_\beta e_\beta i_\beta \mu^3$$ Following this pattern, we can compute the coefficients $a_k$

\begin{align} a_0 = &a_\alpha e_\alpha i_\alpha + b_\alpha f_\alpha g_\alpha + c_\alpha d_\alpha h_\alpha - c_\alpha e_\alpha g_\alpha - b_\alpha d_\alpha i_\alpha - a_\alpha f_\alpha h_\alpha \\ a_1 = &a_\alpha e_\alpha i_\beta + a_\alpha e_\beta i_\alpha + a_\beta e_\alpha i_\alpha + b_\alpha f_\alpha g_\beta + b_\alpha f_\beta g_\alpha + b_\beta f_\alpha g_\alpha + \\ &c_\alpha d_\alpha h_\beta + c_\alpha d_\beta h_\alpha + c_\beta d_\alpha h_\alpha - c_\alpha e_\alpha g_\beta + c_\alpha e_\beta g_\alpha + c_\beta e_\alpha g_\alpha - \\ &b_\alpha d_\alpha i_\beta + b_\alpha d_\beta i_\alpha + b_\beta d_\alpha i_\alpha - a_\alpha f_\alpha h_\beta + a_\alpha f_\beta h_\alpha + a_\beta f_\alpha h_\alpha \\ a_2 = &a_\alpha e_\beta i_\beta + a_\beta e_\alpha i_\beta + a_\beta e_\beta i_\alpha + b_\alpha f_\beta g_\beta + b_\beta f_\alpha g_\beta + b_\beta f_\beta g_\alpha + \\ &c_\alpha d_\beta h_\beta + c_\beta d_\alpha h_\beta + c_\beta d_\beta h_\alpha - c_\alpha e_\beta g_\beta + c_\beta e_\alpha g_\beta + c_\beta e_\beta g_\alpha - \\ &b_\alpha d_\beta i_\beta + b_\beta d_\alpha i_\beta + b_\beta d_\beta i_\alpha - a_\alpha f_\beta h_\beta + a_\beta f_\alpha h_\beta + a_\beta f_\beta h_\alpha \\ a_3 = &a_\beta e_\beta i_\beta + b_\beta f_\beta g_\beta + c_\beta d_\beta h_\beta - c_\beta e_\beta g_\beta - b_\beta d_\beta i_\beta - a_\beta f_\beta h_\beta \end{align}

and then use the roots equations .

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.