# Rotate vector by a given angle in given direction on a sphere.

I'd like to find matrix that allow me to rotate any vector by a $\theta$ angle in direction given by $\phi$ angle. E.g.

1. when I rotate any vector by a $\theta = \pi / 2$ and constant $\phi$ four times I'll be in the same position.
2. When I rotate any vector by a $\theta= \pi/2$ and $\phi = 0$ and then by a $\theta = \pi / 2$ but $\phi = \pi$ I'll back to the first position.

I know how rotation around any axis looks like but I need to rotate vector around any chosen axis.

• en.wikipedia.org/wiki/… – Winther Jan 16 '17 at 1:28
• @Winther I saw it but I no have idea how to use it. – bawq Jan 16 '17 at 2:11
• To specify a general rotation you need an axis and the amount of rotation (usually an angle) around the axis. In order to specify an axis in spherical coordinates, you need two angles (except in the two cases you used in your example 2., where $\phi=0$ or $\phi=\pi$). That's three angles altogether to specify the rotation. You have named only two angles, so how is the rotation specified? – David K Jan 16 '17 at 2:13
• @DavidK so is it: $R_z(\phi) Ry(\theta) Rz(\alpha) Ry(-\theta) Rz(-\phi)$? – bawq Jan 16 '17 at 15:38
• You wrote, "I need to rotate vector around himself." There is a notion of performing a rotation around a vector, meaning the vector gives the direction of the axis of rotation. When you do this, the rotation does not effect the vector chosen for the axis, nor any vector in the same direction or opposite direction. So to rotate a vector around itself is to do nothing to the vector. Rotation changes a vector only when we rotate around some other vector (which could be one of the basis vectors that define the axes). – David K Jan 16 '17 at 16:18