Three dimensional rotation of equations. I have a set of equations that describe a wire in (100) direction. 
I want to rotate the wire such that it's in the direction (111).
My initial plan (which failed) was to use Euler coordinates and first apply a rotation $R_y(\pi/4)$ and then $R_z(\pi/4)$
where the rotation matrices are defined as follows:
$$\begin{alignat}{1}
R_x(\theta) &= \begin{bmatrix}
1 & 0 & 0 \\
0 & \cos \theta &  -\sin \theta \\[3pt]
0 & \sin \theta  &  \cos \theta \\[3pt]
\end{bmatrix} \\[6pt]
R_y(\theta) &= \begin{bmatrix}
\cos \theta & 0 & \sin \theta \\[3pt]
0 & 1 & 0 \\[3pt]
-\sin \theta & 0 & \cos \theta \\
\end{bmatrix} \\[6pt]
R_z(\theta) &= \begin{bmatrix}
\cos \theta &  -\sin \theta & 0 \\[3pt]
\sin \theta & \cos \theta & 0\\[3pt]
0 & 0 & 1\\
\end{bmatrix}
\end{alignat}$$
If I now peform the operation $R_z(\pi/4) R_y(\pi/4) [x, y, z]^T=\left[\begin{matrix}0.5 x - 0.5 y + 0.5\sqrt{2} z\\0.5\sqrt{2} x + 0.5\sqrt{2} y\\- 0.5 x + 0.5 y + 0.5\sqrt{2} z\end{matrix}\right]$ 
and fill in $[x,y,z]=[1,0,0]$  I get $\left[\begin{matrix}0.5 \\0.5\sqrt{2} \\- 0.5 \end{matrix}\right]$, while I want $\left[\begin{matrix}1/\sqrt{3} \\1/\sqrt{3} \\1/\sqrt{3} \end{matrix}\right]$.
What in my reasoning is incorrect, and how can I solve it?
 A: One problem is that the angle between the $z$-axis and the vector
$(1,1,1)$ is not $\frac\pi4.$
An alternative way to do such a rotation is to decide where you want the images
of all three basis vectors to be, and form your rotation matrix
directly from that information.
In this case you want the image of $(1,0,0)^T$ to be 
$e'_1 = \left(\frac1{\sqrt3},\frac1{\sqrt3},\frac1{\sqrt3}\right)^T,$
so choose two suitable vectors (orthogonal to this vector and to each other)
to be the images of $(0,1,0)^T$ and $(0,0,1)^T$.
Based on the Euler-angle rotation you had in mind,
it looks like the preferred image of $(0,1,0)^T$ would be
$e'_2 = \left(-\frac1{\sqrt2},\frac1{\sqrt2},0\right)^T.$
The image of the $z$-axis in your preferred coordinate system
then is the cross-product of the other two vectors,
$e'_3 = e'_1 \times e'_2.$
Once you have decided on the new basis vectors, simply use them as
the columns of your transformation matrix:
$$ M_T = \begin{pmatrix} e'_1 & e'_2 & e'_3 \end{pmatrix}.$$
(This is a $3\times3$ matrix after expanding $e'_1,$ $e'_2,$ and $e'_3$.)
It is easy to confirm that this matrix transforms the vectors
$(1,0,0)^T$, $(0,1,0)^T$, and $(0,0,1)^T$ to the desired vectors.
A: I suggest a solution which  consists in defining the rotation as an orthogonal transformation that preserves orientation in $\mathbb{R}^3$.  We denote by $e_1=(1,0,0)^T, e_2=(0,1, 0)^T, e_3=(0,0,1)^T$ the standard basis in $\mathbb{R}^3$. Now we construct a new orthonormal basis $(u_1, u_2, u_3)$, where $u_1=\dfrac{1}{\sqrt{3}}(1,1,1)^T$ is the unit vector associated to $v=(1,1,1)^T$. The orthogonal complement
of $v$ is defined as  $v^\perp=\{w=(x,y,z)^T\:|\: w\perp v \Leftrightarrow v^Tw=0 \Leftrightarrow  x+y+z=0\}$. The subspace $v^\perp$ is 2-dimensional. We  choose a vector $w=(-1,1,0)^T$ in this subspace and denote by $u_2=\dfrac{1}{\sqrt{2}}(-1,1,0)^T$ its unit vector.  The cross product $u_1\times u_2:=u_3=\dfrac{1}{\sqrt{6}}(-1,-1, 2)^T$ is a unit vector in $v^\perp$, and by construction the orthonormal basis $(u_1, u_2, u_3)$ is positively oriented. Thus the linear map $R:\mathbb{R}^3\to\mathbb{R}^3$ such that $R(e_k)=u_k$, $k=1,2,3$, is the required rotation. Its matrix with respect to the standard basis is the matrix
$A$ having as columns the vectors $R(e_1), R(e_2), R(e_3)$:
$$A=\left[\begin{array}{rrr}\dfrac{1}{\sqrt{3}}&-\dfrac{1}{\sqrt{2}}&-\dfrac{1}{\sqrt{6}}\\\dfrac{1}{\sqrt{3}}&\dfrac{1}{\sqrt{2}}&-\dfrac{1}{\sqrt{6}}\\\dfrac{1}{\sqrt{3}}&0&\dfrac{2}{\sqrt{6}}\end{array}\right]$$
$R$ associates to each vector $s=(x,y,z)^T$, the vector $$R(s)=A\left[\begin{array}{c}x\\y\\z\end{array}\right]$$
A: A simple way is to rotate unit vector initially along x-axis in a standard spherical coordinate system in two rotations :
$ \theta = \pi/4 ,\phi = tan^{-1} \frac{1}{\sqrt{2}}. $
