Finding the matrix associated with a linear map 
Find the matrix associated with the linear map $f:R^2 \rightarrow R^2$ defined by $f(x,y)=(3x-y,y-x)$ with respect to the ordered basis ${(1,0),(1,1)}$

Let the matrix be $A$ and let $f(x)=AX$ where 
$$X=\begin{bmatrix} 
x \\
y 
\end{bmatrix}$$
and 
$$A=\begin{bmatrix} 
a & b \\
c & d 
\end{bmatrix}$$
I tried solving for $a,b,c,d$ by using the basis vectors as $(x,y)$. That is, I took $(x,y)=(1,0)$ and $(x,y)=(1,1)$ to find $a,b,c,d$. But I am not getting the given answer.
 A: Regarding to the standard basis $e_i$ the map has the matrix
$$
A = 
\begin{pmatrix}
3 & -1 \\
-1 & 1
\end{pmatrix}
$$
because 
$$
f(x) 
= x A
= (x_1 e_1 + x_2 e_2) A
= x_1 e_1 A + x_2 e_2 A
= (x_1, x_2) 
\begin{pmatrix}
e_1 A \\
e_2 A
\end{pmatrix}
\\
e_1 = (1,0):\quad f(1,0) = (3,-1) = e_1 A = (1,0) A = (a_{11} a_{12})\\
e_2 = (0,1):\quad f(0,1) = (-1,1) = e_2 A = (0,1) A = (a_{21} a_{22})
$$
What you are looking for is
$$
B = M A M^{-1}
$$
$M$ first transforms a vector regarding the basis $b_1 = (1,0)$ and $b_2 = (1,1)$ into standard coordinates (basis $e_i$). Then it applies the function $f$ via the matrix $A$ (representing $f$ if you use it with vectors regarding standard coordinates) and finally transforms the result into the same vector regarding the basis $b_i$ via $M^{-1}$. 
The combined matrices have the same effect as $f$ for vectors regarding the basis $b_i$.
As the $b_i$ regarding themselves have the coordinates $(1,0)$ and $(0,1)$ these vectors must be mapped by $M$ to $(1,0)$ and $(1,1)$, thus
$$
M = 
\begin{pmatrix}
1 & 0 \\
1 & 1
\end{pmatrix}
\quad
M^{-1} = 
\begin{pmatrix}
1 & 0 \\
-1 & 1
\end{pmatrix}
$$
and we calculate
\begin{align}
B
&= M A M^{-1} \\
&=
\begin{pmatrix}
1 & 0 \\
1 & 1
\end{pmatrix}
\begin{pmatrix}
3 & -1 \\
-1 & 1
\end{pmatrix}
\begin{pmatrix}
1 & 0 \\
-1 & 1
\end{pmatrix}
\\
&=
\begin{pmatrix}
3 & -1 \\
2 & 0
\end{pmatrix}
\begin{pmatrix}
1 & 0 \\
-1 & 1
\end{pmatrix}
\\
&=
\begin{pmatrix}
4 & -1 \\
2 & 0
\end{pmatrix}
\end{align}
Test:
$e_1 = (1,0)$ regarding basis $b_i$ still has coordinates $(1,0)$,
as $(1,0) = 1 \cdot b_1 + 0 \cdot b_2$.
Then
$$
e_1 B = 
(1,0)
\begin{pmatrix}
4 & -1 \\
2 & 0
\end{pmatrix}
= (4,-1)
$$
And indeed 
$$
4 b_1 - b_2 = 4 (1,0) - (1,1) = (4,0)-(1,1) = (3,-1)
$$
Further $e_2 = (0,1)$ regarding standard coordinates has coordinates $(-1,1)$ regarding the $b_i$:
$$
-1 \cdot b_1 + 1 \cdot b_2 = (-1,0) + (1,1) = (0,1)
$$
This is mapped as:
$$
(-1,1)
\begin{pmatrix}
4 & -1 \\
2 & 0
\end{pmatrix}
= (-2, 1)
$$
Calculating back to standard coordinates:
$$
-2 b_1 + b_2 = -2 (1,0) + (1,1) = (-2,0) + (1,1) = (-1,1)
$$
which is where $e_2$ should mapped to by $f$.
Note:
The above assumed from your question that you have to use row vectors. If you use column vectors you
have to transpose the matrices and vectors:
$$
f(x) = A x 
$$
as $A = A^T$ is symmetric. Further
$$
B = (MAM^{-1})^T 
= (M^{-1})^T A^T M^T
= (M^T)^{-1} A M^T
=
\begin{pmatrix}
4 & 2 \\
-1 & 0
\end{pmatrix}
$$
A: Let $e_1=(1,0), e_2=(1,1)$ be the new basis, then observe that:
$$f(e_1)=(3,-1)=4e_1-e_2$$
and
$$f(e_2)=(2,0)=2e_1$$
Then, the matrix is 
$$A=\begin{bmatrix}
4&2\\
-1&0
\end{bmatrix}$$
A: You can set up the matrix with respect to the standard basis and then convert it to the matrix with respect to the given basis by multiplying with the appropriote change of bases matrices.
Altneratively, you can get the matrix of the linear map with respect to the given basis directly. In general: the $i$-th column of that matrix contains the (red) coordinates of the image of the $i$-th basis vector with respect to the (blue) basis in question; that means:
$$f \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 3 \\ -1 \end{pmatrix}=\color{red}{4}\color{blue}{\begin{pmatrix} 1 \\ 0 \end{pmatrix}}\color{red}{-1}\color{blue}{\begin{pmatrix} 1 \\ 1 \end{pmatrix}} \implies C_1 =\color{red}{ \begin{pmatrix} 4 \\ -1 \end{pmatrix}}$$
and
$$f \begin{pmatrix} 1 \\ 1 \end{pmatrix} = \begin{pmatrix} 2 \\ 0 \end{pmatrix}=\color{red}{2}\color{blue}{\begin{pmatrix} 1 \\ 0 \end{pmatrix}}+\color{red}{0}\color{blue}{\begin{pmatrix} 1 \\ 1 \end{pmatrix}} \implies C_2 =\color{red}{ \begin{pmatrix} 2 \\ 0 \end{pmatrix}}$$
So the matrix $C$ of the linear map with respect to the given basis is:
$$C = \left( C_1 \vert C_2\right) = \begin{pmatrix} 4 & 2 \\ -1 & 0\end{pmatrix}$$
