# Finding ordered basis of two vector spaces

Let $K$ a field and $E, F$ two $K$-vector spaces with ordered basis $B_1 = (e_1, e_2, e_3, e_4)$ and $B_2=(v_1,v_2,v_3)$ respectively. Given $f:E\rightarrow F$ the only linear map such that:

$\\f(e_1)=v_1-v_3,\\f(e_2)=v_1+v_2+v_3,\\f(e_3)=3v_1+2v_2,\\f(e_4)=2v_1-v_2-2v_3,$

How can I find a basis $D_1,D_2$ of $E$ and $F$ such that $M(f,D_1,D_2)=\left( \begin{array}{cccc} 1 & 1 & 1 & 1 \\ 1 & 2 & 3 & 4 \\1 & 4 & 9 & 16\end{array} \right)$?

You have many degree of freedom, so there is not a unique solution. In fact you are looking for two change of basis in dimension $4$ and $3$, so you need a non-singular $4x4$ and a non-singular $3x3$ matrix: $16+9=25$ unknown. The equation to impose are only $12$ ($4$ vectorial equations in dim $3$).
We can use the freedom to leave the basis of $F$ as is, and only change the basis in $E$. If $$e'_i=e_jA_{ji}$$ is the change of basis relation, the equations $$f(e'_i)=f(e_j)A_{ji}=v_k M_{kj}A_{ji}=v_k M'_{ki}$$ gives $$MA=M'$$ The general solution of this system of equations is $$A=\begin{pmatrix} -5a & -5b & -5c+2 & -5d+6 \\ -3a+1 & -3b+4 & -3c+11 & -3d+22 \\ 2a & 2b-1 & 2c-4 & 2d-9 \\ a & b & c & d \end{pmatrix}$$ where $a, b, c, d$ are free parameters, to be chosen with the condition $$|A|=2a-6b+6c-2d\neq0.$$ For example, letting $a=c=1$ and $b=d=-1$ we have $$A=\begin{pmatrix} -5 & 5 & -3 & 11 \\ -2 & 7 & 8 & 25 \\ 2 & -3 & -2 & -11 \\ 1 & -1 & 1 & -1 \end{pmatrix}$$ We can check that with $e'_1=e_1 A_{11}+e_2 A_{21}+e_3 A_{31}+e_4 A_{41}=-5e_1-2e_2+2e_3+e_4$ we have \begin{align} f(e'_1)&=-5f(e_1)-2f(e_2)+2f(e_3)+f(e_4)\\ &=-5(v_1-v_3)-2(v_1+v_2+v_3)+2(3v_1+2v_2)+(2v_1-v_2-2v_3)\\ &=v_1+v_2+v_3 \end{align} and similarly for $f(e'_i)$, with $i=2,3,4$.