Solution (source code)

= Solution

The $j$th column of the <matrix representation of a linear map> is the <coordinate vector> of the image of the $j$th <basis vector>:
$$
\phi(u_j)=\sum_iA_{ij}u_i.
$$
Define $C$ by $w_j=\sum_iC_{ij}u_i$, so its columns express the new <basis vectors> in the old <basis>. For every <vector>, $[v]_u=C[v]_w$. Applying $\phi$ in either coordinate system gives $AC[v]_w=CA'[v]_w$, proving the <change of basis> formula
$$
\boxed{A'=C^{-1}AC.}
$$
To make $A'$ diagonal, choose the columns of $C$ to be <linearly independent> <eigenvectors> of $A$, expressed in the $u$ <basis>, and put their corresponding <eigenvalues> on the diagonal in the same order. This is possible precisely when $A$ is a <diagonalizable matrix> over the stated <field>; an <eigenbasis> need not exist over an arbitrary <field>.