# Rotating vector around arbitry axis when vector is in origin {0,0,0} (3D)

I'm trying to rotate a vector that is at the origin {0,0,0} around an arbitrary axis (in this case the rotation is around {40,30,30} through {40,31,30}).

The problem appears to be that I can't rotate a {0,0,0} vector, because it always remains 0. I remedied this by moving it towards the point I want to rotate around ({40,30,30}) and moving it back after the rotation.

However, I don't know if this is the right way to do it, and I'm having a hard time finding anything about it.

As far as I understand, the translation towards the origin before rotation should take care of the problem that the vector to rotate is at the origin itself, but it doesn't appear to be working as such.

It's software that I wrote myself, so it's possible I messed something up. But I'm really not sure anymore.

• Sometimes we view vectors as just an arrow that has length and direction. Sometimes we view them as an arrow with the root attached to some point in space. The first is more common. For the first the only rotation you can do is to change the direction of the vector. As you say, you can't rotate a zero length vector because it has no direction. For the second, you can rotate the location of the root of the vector even if it is the zero vector. – Ross Millikan Mar 17 '18 at 15:33
• If you say the vector is at $(0,0,0)$ that could mean it is the zero vector with zero length or it could mean you are regarding the root as being at the origin but the head is somewhere else. You need to make clear what you are trying to do. – Ross Millikan Mar 17 '18 at 15:33
• It is a zero vector with zero length. Since I'm trying to rotate it around a different axis, it should still be possible to move it, right? I'm not trying to rotate it around the origin, but around a different vector in space. – ihendriks Mar 17 '18 at 15:42
• The zero vector has no length, hence it has no angle with. rotating it will not change anything because it can be view as a point. If you want to rotate a vector that start at $(0,0,0)$: en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions and mathworld.wolfram.com/RodriguesRotationFormula.html – Holo Mar 17 '18 at 16:06

You can certainly rotate the point $(0,0,0)$ around your axis. Your axis is parallel to $y$ and offset from the origin by $50$ units. The easiest way to do this is to translate your axis and all of space to put the axis through the origin, rotate the space, and translate back. Your translation is then by $(-40,0,-30)$ so your zero vector moves to $(-40,0,-30)$. Now if you rotate this by an angle $\theta$ it becomes $(-40 \cos \theta -30 \sin \theta,0,30 \sin \theta -40 \cos \theta)$ if our sign conventions agree. Translating back then gives your final point as $(40-40 \cos \theta -30 \sin \theta,0,30+30 \sin \theta -40 \cos \theta)$