I try to solve the following problem: given a unit vector v, find rotate matrix R such that R*v = (0,0,..0,1) (vector that it's (n-1) components are 0 and the n'th component is 1). I know that if I hadn't had the request that R is a rotate matrix it would have been simply system of linear equations. Any thoughts of how can I find such a rotate matrix?


  • $\begingroup$ you will need to find a basis for the space that is orthogonal to the plane spanned by $v$ and $(0,0,\cdots, 1).$ once you have that you can find a block matrix $\pmatrix{\cos t&\sin t& 0\\-\sin t & \cos t & 0\\0&0&B}$ $\endgroup$ – abel Feb 20 '15 at 12:50

Use the Gram-Schmidt process, slightly modified. Start with the $n + 1$ vectors $$ v, e_1, e_2, \ldots, e_n $$ (where $e_i$ denotes the standard basis vector: 0s in all entries, but 1 in the $i$th entry) and call them $v_1, v_2, \ldots, v_{n+1}$.

Apply Gram-Schmidt to get \begin{align} w_1 &= v_1\\ u_1 &= w_1 / \|w_1 \|, \end{align}

as a first step. $u_1$ (which is just $v$, of course) will be the first column of your matrix.

Now apply GS to $v_2$: \begin{align} w_2 &= v_2 - (v_2 \cdot u_1) u_1 \\ u_2 &= w^2 / \| w_2 \| \end{align} and then to $v_3$: \begin{align} w_3 &= v_3 - (v_3 \cdot u_1) u_1 - (v_3 \cdot u_2) u_2 \\ u_3 &= w^3 / \| w_3 \| \end{align} and so on.

If, in the course of doing this, you ever find $w_i = 0$, then throw $v_i$ out of your list and start work with the next item as $v_i$.

In general, this "$w_i = 0$" case happens right at the end: the $n+1$st vector is a linear combination of the previous $n$. But if it happens in the middle, you can just toss out that vector early.

When you're done, the vectors $u_i$ will form the rows of an orthogonal matrix. The vector $v$ is the first row, but reading your question carefully, I see it should be the last: so swap the first and last rows. Now the only question is whether the resulting matrix is a rotation. If the determinant is $+1$, it's a rotation; if not, then negate the first row and it will be.

(A natural question is "if you want $v$ in the last row, why not put it at the end of your list of vectors instead of the start?" Answer: I want $v$ unchanged, and in the GS process, only the first vector survives untouched, and it only does so if it's a unit vector.)

  • $\begingroup$ if v is one of R rows, doesn't it mean that Rv = (0..0) ? and what e1,..en should I take? simply a basis? $\endgroup$ – Mr Y Feb 20 '15 at 14:05
  • $\begingroup$ 1. I screwed up and said that the $u_i$ should be the columns of $R$; I should have said "rows"; I've edited to fix that. 2. $v$ should actually be the last row ... so just before the "fix the determinant" step, please swap the first and last rows (I'll edit that as well). 3. If each of the $u_i$ ($i = 2, 3, \ldots$) is perpendicular to $v$, then a row that contains $u_i$, when multiplied by the column vector $v$, will give $0$. On the other hand, the last row will be $v$, and that row, multiplied by the column vector $v$, will give $v \cdot v = 1$. $\endgroup$ – John Hughes Feb 20 '15 at 14:24
  • $\begingroup$ Also: the vectors $e_i$ are the standard basis vectors; I've edited to add that as well. $\endgroup$ – John Hughes Feb 20 '15 at 14:28

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.