For more info on Euler Sequences, notation and convention see the generic entry on Euler angle sequences.
R 231 ( ϕ , θ , ψ ) = R 1 ( ψ ) R 3 ( θ ) R 2 ( ϕ ) {\displaystyle R_{231}(\phi ,\theta ,\psi )=R_{1}(\psi )R_{3}(\theta )R_{2}(\phi )} \\
The rotation matrices are
R 1 ( ψ ) = [ 1 0 0 0 c ψ s ψ 0 − s ψ c ψ ] {\displaystyle R_{1}(\psi )=\left[{\begin{matrix}1&0&0\\0&c_{\psi }&s_{\psi }\\0&-s_{\psi }&c_{\psi }\end{matrix}}\right]}
R 3 ( θ ) = [ c θ s θ 0 − s θ c θ 0 0 0 1 ] {\displaystyle R_{3}(\theta )=\left[{\begin{matrix}c_{\theta }&s_{\theta }&0\\-s_{\theta }&c_{\theta }&0\\0&0&1\end{matrix}}\right]}
R 2 ( ϕ ) = [ c ϕ 0 − s ϕ 0 1 0 s ϕ 0 c ϕ ] {\displaystyle R_{2}(\phi )=\left[{\begin{matrix}c_{\phi }&0&-s_{\phi }\\0&1&0\\s_{\phi }&0&c_{\phi }\end{matrix}}\right]}
Carrying out the matrix multiplication from right to left \\
R 3 ( θ ) R 2 ( ϕ ) = [ c θ s θ 0 − s θ c θ 0 0 0 1 ] [ c ϕ 0 − s ϕ 0 1 0 s ϕ 0 c ϕ ] = [ c θ c ϕ s θ − c θ s ϕ − s θ c ϕ c θ s θ s ϕ s ϕ 0 c ϕ ] {\displaystyle R_{3}(\theta )R_{2}(\phi )=\left[{\begin{matrix}c_{\theta }&s_{\theta }&0\\-s_{\theta }&c_{\theta }&0\\0&0&1\end{matrix}}\right]\left[{\begin{matrix}c_{\phi }&0&-s_{\phi }\\0&1&0\\s_{\phi }&0&c_{\phi }\end{matrix}}\right]=\left[{\begin{matrix}c_{\theta }c_{\phi }&s_{\theta }&-c_{\theta }s_{\phi }\\-s_{\theta }c_{\phi }&c_{\theta }&s_{\theta }s_{\phi }\\s_{\phi }&0&c_{\phi }\end{matrix}}\right]} \\
Finally leaving us with the Euler 231 sequence \\
R 1 ( ψ ) R 3 ( θ ) R 2 ( ϕ ) = [ c θ c ϕ s θ − c θ s ϕ − c ψ s θ c ϕ + s ψ s ϕ c ψ c θ c ψ s θ s ϕ + s ψ c ϕ s ψ s θ c ϕ + c ψ s ϕ − s ψ c θ − s ψ s θ s ϕ + c ψ c ϕ ] {\displaystyle R_{1}(\psi )R_{3}(\theta )R_{2}(\phi )=\left[{\begin{matrix}c_{\theta }c_{\phi }&s_{\theta }&-c_{\theta }s_{\phi }\\-c_{\psi }s_{\theta }c_{\phi }+s_{\psi }s_{\phi }&c_{\psi }c_{\theta }&c_{\psi }s_{\theta }s_{\phi }+s_{\psi }c_{\phi }\\s_{\psi }s_{\theta }c_{\phi }+c_{\psi }s_{\phi }&-s_{\psi }c_{\theta }&-s_{\psi }s_{\theta }s_{\phi }+c_{\psi }c_{\phi }\end{matrix}}\right]}