Suppose that I have two unknown vectors $v_1,v_2 \in \mathbb{R}^3$, and a known vector $v_{3} \in \mathbb{R}^3$. I know all inner products $\langle v_i, v_j \rangle$, $1 \leq i,j \leq 3$. Is there a closed-form (or least painful iterative) way to reconstruct $v_1$ and $v_2$? intuitively it looks like there might be two solutions since any $v_1$ and $v_2$ can be reflected through the known $v_3$ to get the same inner products. Nevertheless getting them both would be helpful. Note that the problem is not generally rotation invariant as $v_3$ is known.

  • $\begingroup$ They can be rotated about $v_3$ so there is some rotation invariance. I would suggest rotating the whole system to point $v_3$ along the $z$-axis. $\endgroup$ – Angina Seng Dec 27 '17 at 16:11
  • $\begingroup$ You can use Cholesky decomposition to get some vectors matching the inner products, but then you need to rotate to get $v_3$ $\endgroup$ – Dap Dec 27 '17 at 16:14
  • $\begingroup$ You are right, there is a full degree of freedom. rotating $v_3$ to be the z axis would give me the $z$ value of both vectors, which makes it a $2D$ unconstrained "square root" problem. $\endgroup$ – Amir Vaxman Dec 27 '17 at 16:14

Assuming the vectors are in general position, i.e. no two are parallel:

Select an arbitrary unit vector $t$ perpendicular to $v_3$ (the usual trick for doing so robustly is to take $t = (e\times v_3)/\|e\times v_3\|$, where $e$ is the vector with a 1 in the entry corresponding to the least-magnitude entry of $v_3$, and a 0 elsewhere.)

We can assume $$v_1 = \alpha_1 t + \beta_1 v_3$$ $$v_2 = \alpha_2 t + \beta_2 v_3 + \gamma_2 t\times v_3$$

Now $$\beta_1 = v_1\cdot v_3 / \|v_3\|^2$$ $$\alpha_1 = \sqrt{\|v_1\|^2 -\beta_1^2\|v_3\|^2}$$ $$\beta_2 = v_2\cdot v_3 / \|v_3\|^2$$ $$\alpha_2 = \frac{v_1\cdot v_2 - \beta_1 v_2\cdot v_3}{\alpha_1}$$ $$\gamma_2 = \pm \sqrt{\frac{\|v_2\|^2 -\alpha_2^2 - \beta_2^2\|v_3\|^2}{\|v_3\|^2}}.$$

The answer is of course only unique up to (1) selection of $t$ and (2) selection of the sign of $\gamma_2$, i.e. the handedness of the resulting $(v_1,v_2,v_3)$ coordinate frame. There are two smooth families of solutions.


Let $v_i = [a_{i1},a_{i2},a_{i3}]^T$. As we know $v_3$, we have 6 unknowns thus we need 6 equations.

Since you have all inner product, we have \begin{equation} \begin{bmatrix} v_1^T & v_2^T & v_3^T \end{bmatrix} \begin{bmatrix} v_1 & v_2 & v_3 \end{bmatrix} = \begin{bmatrix} v_1^Tv_1 & v_1^Tv_2 & v_1^Tv_3 \\ v_2^Tv_1 & v_2^Tv_2 & v_2^Tv_3 \\ v_3^Tv_1 & v_3^Tv_2 & v_3^Tv_3 \end{bmatrix} \end{equation} and the right hand side is known.

Since you know $v_3$, we obtain following 5 equations which involves 6 unknowns. Note that $v_3^Tv_3$ does not give any information.

Thus we have 6 unknowns and 5 equations.

For example. let $v_3 = [0, 0, 1]^T$, $v_1=[1,0,0]^T$ and $v_2=[0,1,0]^T$. Even though we know all inner products, $v_1' = [\sin \theta, \cos \theta, 0]^T$ and $v_2' = [\cos \theta, -\sin \theta, 0]^T$ will satisfy the inner product conditions.

  • 1
    $\begingroup$ @MartinArgerami Since $v_1' = [\sin \theta, \cos \theta, 0]^T$, $\langle v_1',v_1' \rangle = \sin^2 \theta + \cos^2 \theta = 1$. $\endgroup$ – induction601 Dec 27 '17 at 16:39
  • $\begingroup$ Yes, my bad. Thanks! $\endgroup$ – Martin Argerami Dec 27 '17 at 16:44

Let \begin{align} v_1&=x_1e_1+x_2e_2+x_3e_3\\ v_2&=y_1e_1+y_2e_2+y_3e_3\\ v_3&=ae_1+be_2+ce_3 \end{align} and $\langle v_1,v_2\rangle=A$, $\langle v_1,v_3\rangle=B$, $\langle v_2,v_3\rangle=C$, $\langle v_1,v_1\rangle=P$, $\langle v_2,v_2\rangle=Q$. The conditions give a nonlinear system $$ \begin{cases} x_1y_1+x_2y_2+x_3y_3=A \\ x_1^2+x_2^2+x_3^2=P \\ y_1^2+y_2^2+y_3^2=Q \\ ax_1+bx_2+cx_3=B\\ ay_1+by_2+cy_3=C \end{cases} $$ of five equations in six unknowns. If the system is solvable, it will generally have infinitely many solutions.

You can first solve the last equation (parametrically). Then the first and fourth equations become a linear system. Finally, you have to normalize the solutions to satisfy the conditions on the norms.

  • $\begingroup$ @MartinArgerami Yes, I noticed, thanks $\endgroup$ – egreg Dec 27 '17 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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