Need explanation of a matrix multiplication
Let's take it step by step.

$$
f^{(1)}(x)=h=W^Tx  \tag{1}
$$

$$
f^{(2)}(h)=h^Tw \tag{2}
$$

We substitute h.

$$
f(x)=(W^Tx)^Tw   \tag{3}
$$

To make it work, we'll make a little trick.


  The transpose of a transposed matrix is the original matrix.


$$
(A^T)^T = A
$$

We substitute w.

$$
f(x)=(W^Tx)^T (w^T)^T  \tag{4}
$$

Now we use following:

$$
(AB)^T=B^T A^T
$$


  The transpose of two matrices multiplied together is the same as the product of their transpose matrices in reverse order.


et voila

$$
f(x)=w^TW^Tx
$$