# Why is the matrix realization constructed from basis “looks backwards”?

In Wu-Ki Tung, Group Theory in Physics, operators $U(g)$ are realized as $n\times m$ matrices $D(g)$ as

$$U(g)\textbf e_i=\textbf e_j D(g)^j_{\>i}$$

with a note that the first index ($j$) is the row-label and the second one ($i$) is the column-label. Why isn't it defined as $$U(g)\textbf e_i=\textbf e_j D(g)^i_{\>j}$$ so that the matrix can be used with multiplication with $\begin{pmatrix}\textbf e_1\\\vdots\\\textbf e_n\end{pmatrix}$?

For an example of the rotation in $\Bbb R^2$, since

$$\textbf e_1'=\textbf e_1\cos\phi+\textbf e_2\sinφ\\ \textbf e_2'=\textbf e_1(-\sin\phi)+\textbf e_2\cosφ$$

we have

$$D(\phi)=\begin{pmatrix}\cos\phi&-\sin\phi\\\sin\phi&\cos\phi\end{pmatrix}$$

Why isn't it not in the form

$$D(\phi)=\begin{pmatrix}\cos\phi&\sin\phi\\-\sin\phi&\cos\phi\end{pmatrix} \text{?}$$

I know defining this makes the natural multiplication works with rotating vectors

$$\begin{pmatrix}x'^1\\x'^2\end{pmatrix}=\begin{pmatrix}\cos\phi&-\sin\phi\\\sin\phi&\cos\phi\end{pmatrix}\begin{pmatrix}x^1\\x^2\end{pmatrix}$$

It looks backwards because $\mathbf{e}_j$ are each vectors, not components relative to some basis, like $x^j$. When we calculate linear transformations, we are usually only concerned with how the components transform, and not the basis itself.
For example, if you have a column vector in the basis $\{\mathbf{e}_j\}$, with components $x^1$ and $x^2$, formally, $$\mathbf{e}_1 x^1 + \mathbf{e}_2 x^2 = \begin{pmatrix} \mathbf{e}_1 & \mathbf{e}_2 \end{pmatrix}\begin{pmatrix} x^1 \\ x^2 \end{pmatrix}.$$ Also, notice that the lowered indices on $\mathbf{e}_j$ suggest that they be treated in a row vector when using matrix multiplication.
When computing linear transformations we typically just work with the components of a vector relative to a particular basis, just like in your equation $$\begin{pmatrix} x'^1 \\ x'^2 \end{pmatrix} = \begin{pmatrix} \cos \phi & - \sin \phi \\ \sin \phi & \cos \phi \end{pmatrix} \begin{pmatrix} x^1 \\ x^2 \end{pmatrix},$$ giving an answer still expressed in the same basis.
For example, if you were asked to compute how a rotation acts on $\mathbf{e}_1$, i.e. $\mathcal{R}_\phi \mathbf{e}_1$, you would probably compute $$\begin{pmatrix} \cos \phi & - \sin \phi \\ \sin \phi & \cos \phi \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix}\cos \phi \\ \sin \phi \end{pmatrix},$$ which feels natural since using column vectors allows us to have the matrix representation act to the right of itself. Writing this same equation contracted onto the basis row vector, we find that $$\mathbf{e}'_1 \equiv \mathcal{R}_\phi \mathbf{e}_1 = \begin{pmatrix} \mathbf{e}_1 & \mathbf{e}_2 \end{pmatrix} \begin{pmatrix} \cos \phi & - \sin \phi \\ \sin \phi & \cos \phi \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \mathbf{e}_1 \cos \phi + \mathbf{e}_2 \sin \phi,$$ as we would expect.
To write this out more generally where the group acts on an arbitrary vector $\mathbf{x}$, $$U(g) \mathbf{x} = U(g) \sum_i x^i \mathbf{e}_i = \sum_i x^i U(g) \mathbf{e}_i = \sum_i x^i \sum_j \mathbf{e}_j {D(g)^j}_i = \sum_j \mathbf{e}_j \sum_i {D(g)^j}_i x^i = \mathbf{D}(g) \mathbf{x}.$$