The general method for this is
For a linear mapping T: V -> W
with basis B = {v1,v2,v3,...,vn} for the domain and C = {u1,u2,u3,...,un} for the codomain then the matrix of T is A = [a1 a2 a3 ... an] (where ak is the k'th column vector of the matrix A) and
ak = [T(vk)]_C (the coordinate vector of...