Solution (source code)

= Solution

The multiplication order needs care. Use the standard right-hand <rotation matrices>, consistent with the printed $G$ and the stated positive $z$ <rotation>. For column <vectors>, direct multiplication of the two products \i[in the order printed] gives
$$
R_y(-\pi/2)R_z(-\pi/2)=\begin{pmatrix}0&0&-1\\-1&0&0\\0&1&0\end{pmatrix},\qquad (x,y,z)\mapsto(-z,-x,y),
$$
$$
R_y(\pi/2)R_z(\pi/2)=\begin{pmatrix}0&0&1\\1&0&0\\0&1&0\end{pmatrix},\qquad (x,y,z)\mapsto(z,x,y).
$$
Both permute the dimensions $(d,w,h)$ into $(h,d,w)$, rather than the required $(w,h,d)$. Therefore, with ordinary column-vector <matrix multiplication>, \b[neither printed product is the permutation in part (ii)]. A <translation> can correct the position of a cuboid, but cannot correct these permuted side lengths for general $w,h,d$. This order mismatch is present in the original printed question.<Computer Graphics examination paper by the University of Oxford (2015)>[Printed p. 5, Question 2(b)(iii): the products are written with ROT_y to the left of ROT_z]{ref}

The apparent intended comparison is obtained if “chain” means apply the $y$ <rotation> first, then the $z$ <rotation>. Under that interpretation the actual column-vector products have the reverse order:
$$
\boxed{R_z(-\pi/2)R_y(-\pi/2)=\begin{pmatrix}0&1&0\\0&0&1\\1&0&0\end{pmatrix}=P_{3\times3}.}
$$
Thus the \i[negative-angle sequence] is correct when read as operations performed from left to right. The positive-angle sequence gives
$$
R_z(\pi/2)R_y(\pi/2)=\begin{pmatrix}0&-1&0\\0&0&1\\-1&0&0\end{pmatrix},\qquad (x,y,z)\mapsto(-y,z,-x).
$$
It occupies $[-w,0]\times[0,h]\times[-d,0]$. Apply the world-space <translation>
$$
\boxed{t=(w,0,d),\qquad (x',y',z')=(w-y,z,d-x).}
$$
This puts the cuboid in $[0,w]\times[0,h]\times[0,d]$ and still maps $z=k\,\texttt{step}$ to $y'=k\,\texttt{step}$. The distinction is purely the action order: ordinary products act rightmost first, while a library may describe an ordered sequence of operations in application order. Giving the coordinate maps makes either convention explicit. If one merely wanted to place the literal printed negative product in the positive octant, its <translation> would instead be $(h,d,0)$, producing dimensions $(h,d,w)$ and still failing the requested general bounds.