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

I am trying to solve the following system of equations

$$ \begin{eqnarray} \|p + \alpha n\| & = &\|q + \beta n\| \\ (p + \alpha n) \cdot (q + \beta n) & = & 0 \end{eqnarray} $$

for the unknowns $\alpha, \beta \in \mathbb{R}$, with $n$, $p$ and $q$ known vectors in $\mathbb{R}^n$ (the second line contains a dot product), and $\|n\|=1$.

Using some algebra, these equations can be written as

$$ \begin{eqnarray} \alpha^2 - \beta^2 + A\alpha + B\beta + C & = & 0 \\ \alpha\beta + D\alpha + E\beta + F & = & 0 \end{eqnarray} $$

for suitably defined scalar constants $A$,..., $F$. Further manipulation leads to a quartic equation.

My question: is there some "elegant" closed-form solution, or, otherwise, by what method could this be solved numerically (it seems there are two pairs of solutions)?

share|cite|improve this question
up vote 3 down vote accepted

It is not "really" a quartic equation! Let me explain.

The first equation expands to $$\alpha^2+(2p\cdot n) \alpha +p\cdot p=\beta^2+(2q\cdot n )\beta +q\cdot q=0.$$

The second equation expands to $$\alpha\beta+ (q\cdot n)\alpha +(p\cdot n)\beta +p \cdot q=0.$$

Complete the squares in the first equation. We get something of shape $$(\alpha +p\cdot n)^2-(\beta +q\cdot n)^2=A.$$

The second equation can be written as $$(\alpha +p\cdot n)(\beta +q\cdot n)=B.$$

Let $x=\alpha+p\cdot n$ and $y=\beta +q\cdot n$.

Our system of equations then becomes $$x^2-y^2=A, \qquad xy=B.$$

So $y=B/x$. Substitute in the first equation, and multiply through by $x^2$. We get a quadratic equation in $x^2$. Solve this equation for $x^2$ in the usual way, then take the square roots.

share|cite|improve this answer
That's brilliant... I wonder how you came up with this. Thanks! – koletenbert Oct 21 '11 at 20:49
There is very clear symmetry, so for general algebraic reasons, it is inevitable that there will be collapse. Then it was just a question of describing the collapse without fancy tools. – André Nicolas Oct 21 '11 at 20:57

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.