I am working with vectors in $\mathbb{R}^4$. Any two such (non-parallel) vectors obviously define a plane, and I can rotate any vector in the plane defined by itself and a second vector as follows:

$rot_k(v, \theta) = |v|(unit(v)\cos(\theta)+unit(reject_v(k))\sin(\theta))$

where $v$ is the vector to rotate and $k$ is the second vector used to define the plane.

Now suppose (because it is true) that I want to be able to find the angle $\theta$ between an ordered pair of vectors $<v,k>$ with the smallest absolute value such that $rot_k(v, \theta) = k$. If I just use the cosine angle formula, I get a result for $\theta$ which will sometimes give the wanted result, but which also sometimes rotates $v$ in the opposite of the desired direction, which is unhelpful.

Per the answer to this question, I could perform a change of basis into the common plane of the two vectors to eliminate the extra two dimensions, and then use the 2x2 determinant to figure out the orientation of those 2-dimensional vectors. But that seems a little bit excessive. I could also do a test rotation and then reverse the sign of $\theta$ if it gives an incorrect result on the test, but that seems horribly inelegant. Is there any more direct way to do it?

This answer on orienting vectors in 3D space seems like a promising place to start, but it depends on the cross product, which does not exist in 4D space.

EDIT: I realized the first equation I gave for rotation of $v$ in the common plane with $k$ assumed that $k$ was was perpendicular to $v$. It has been replaced with a more general formula. The original form will still perform a rotation, but not necessarily of the correct magnitude.


Your Answer

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

Browse other questions tagged or ask your own question.