Consider the vector field in Cartesian coordinates, $\mathbf F(x,y,z) = -y \, \hat{\mathbf x} + x \, \hat{\mathbf y} + 0 \, \hat{\mathbf z}$. The arrows curl around the positive $z$ axis (i.e. the "axis" of the field is in the $z$ direction), with the direction determined by the right hand rule, as shown in the following figure.
Figure 1. Plot of $\mathbf F$.
My question
I want to rotate $\mathbf F$ such that the arrows curl around the positive $y$ axis (i.e. the "axis" of the field should now be in the $y$ direction), as shown in the following figure. Let's call this desired new field as $\mathbf G$. How can I achieve this?
Figure 2. Plot of $\mathbf G$.
My attempt #1
Since we want to rotate the axis of the field $\mathbf F$ from the $z$ axis to the $y$ axis, I think to achieve that we should rotate $\mathbf F$ around the $x$ axis by 90° clockwise (with the unit vector $\hat{\mathbf x}$ pointing towards us). And as we know, to rotate a vector or point in 3D around the $x$ axis we use the following transformation matrix:
$\mathbf R = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta \\ 0 & \sin \theta & \cos \theta \\ \end{bmatrix},$
with $\theta$ measured counterclockwise. In our case we choose $\theta = -90^\circ$ (negative because we want to rotate clockwise), so:
$\mathbf R = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & -1 & 0 \\ \end{bmatrix}.$
Premultiplying $\mathbf F$ by the above matrix, we get the vector field $\mathbf H(x,y,z) = -y \, \hat{\mathbf x} + 0 \, \hat{\mathbf y} - x \, \hat{\mathbf z}$. The plot of $\mathbf H$ is the following, and as we can see it's not the desired $\mathbf G$ field.
Figure 3. Plot of $\mathbf H$.
After playing around, I found $\mathbf G$ must actually be $\mathbf G(x,y,z) = z \, \hat{\mathbf x} + 0 \, \hat{\mathbf y} - x \, \hat{\mathbf z}$, as shown in figure 2. Why?
EDIT: My attempt #2
I found this question. According to the asker and John Hughes' answer, the formula to compute $\mathbf G$ from $\mathbf F$ should be:
${\mathbf G} = {\mathbf R} \, {\mathbf F} \left( {\mathbf v}_1, {\mathbf v}_2, {\mathbf v}_3 \right),$
where:
${\mathbf v}_1 = \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} \cdot {\mathbf R}^T \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix},$
${\mathbf v}_2 = \begin{bmatrix} 0 \\ 1 \\ 0 \\ \end{bmatrix} \cdot {\mathbf R}^T \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix},$
${\mathbf v}_3 = \begin{bmatrix} 0 \\ 0 \\ 1 \\ \end{bmatrix} \cdot {\mathbf R}^T \begin{bmatrix} x \\ y \\ z \\ \end{bmatrix}.$
Using those four equations, and Wolfram Mathematica for the computations, I indeed get $\mathbf G(x,y,z) = z \, \hat{\mathbf x} + 0 \, \hat{\mathbf y} - x \, \hat{\mathbf z}$, as shown in the following figure.
Figure 4. Computation of ${\mathbf G}$ with Mathematica.
So I've answered my first question ("How can I achieve this?"), but I'd still appreciate if someone could answer my second question, which now is: Why do the formulas from John Hughes work?



