TITLE: Confusion in rotation matrix - rotation about $y$ axis
QUESTION [6 upvotes]: The rotation matrix about y axis should look like
$$\left[
\begin{array}{ccc}
\cos\frac{\pi}{2} & 0 &\sin\frac{\pi}{2}\\
0 & 1 & 0\\
-\sin\frac{\pi}{2} & 0 &\cos\frac{\pi}{2}\\
\end{array}
\right]
=
\left[
\begin{array}{ccc}
0 & 0 &1\\
0 & 1 & 0\\
-1& 0 &0\\
\end{array}
\right]
$$
Now, I pictured this rotation, and it should look like rotation about y axis, counterclockwise

I drew $(1,1,1)$ vector in original coordinate system, and in the new coordinate system, the vector should be $(-1,1,1)$

BUT! the matrix calculation gives otherwise.
$$
\left[
\begin{array}{ccc}
0 & 0 &1\\
0 & 1 & 0\\
-1& 0 &0\\
\end{array}
\right]
\left[
\begin{array}{c}
1\\
1\\
1
\end{array}
\right]
=\left[
\begin{array}{c}
1\\
1\\
-1
\end{array}
\right]
$$
Am I missing something?

Okay, it seems like I should rotate vector instead of coordinate system.
Then, How can you explain rotation about z axis?

The rotation matrix is 
$$
\left[
\begin{array}{ccc}
\cos\frac{\pi}{2} &\sin\frac{\pi}{2} & 0\\
-\sin\frac{\pi}{2} &\cos\frac{\pi}{2} & 0\\
0 & 0 & 1
\end{array}
\right]
=
\left[
\begin{array}{ccc}
0 & 1 &0\\
-1 & 0 & 0\\
0& 0 &1\\
\end{array}
\right]
$$
But... calculation is correct.
$$
\left[
\begin{array}{ccc}
0 & 1 &0\\
-1 & 0 & 0\\
0& 0 &1\\
\end{array}
\right]
\left[
\begin{array}{c}
1\\
1\\
1
\end{array}
\right]
=\left[
\begin{array}{c}
1\\
-1\\
1
\end{array}
\right]
$$
IF you rotate the vector, then in the picture, it should be $(-1,1,1)$


Oh. god.... I think I am looking at the wrong source.
My book tells

well, clearly, googling gives me 

http://what-when-how.com/the-3-d-global-spatial-data-model/rotation-matrix-derivation-the-3-d-global-spatial-data-model/
I think I solved my case. Thank you all.

REPLY [3 votes]: @Emilio Novati Explained very well about the rotation. But I spent some time draw this picture, so I'll post it. 
You misunderstood the rotation matrix. You should rotate the vector counterclockwisely, instead of rotate the coordinate system.