Which one is the correct way to compute the change of basis matrix? I was looking for a way to compute the change of basis matrix (given the old basis and the new basis), but I found two methods that lead to different results, and I can't understand which one is correct.    
Method 1:
$$ 
B = \left\{
\begin{pmatrix}
1 \\ 2 
\end{pmatrix} , 
\begin{pmatrix}
3 \\ 4 
\end{pmatrix} 
\right\} ~ , ~
 D= \left\{
\begin{pmatrix}
1 \\ 4 
\end{pmatrix} , 
\begin{pmatrix}
2 \\ 3 
\end{pmatrix} \right\} 
$$
The vectors in $D$ are expressed as a linear combination of the ones in $B$, and then the coefficients are used to construct the change of basis matrix $S$, i.e.:
$$
\begin{pmatrix}1 \\ 4 \end{pmatrix} = s_{11}\cdot \begin{pmatrix}1 \\ 2 \end{pmatrix} + s_{12} \cdot \begin{pmatrix}3 \\ 4 \end{pmatrix} \ \ \Rightarrow s_{11}=4 \ \ \text{and}  \ \ s_{12}=-1  \\
\begin{pmatrix}2 \\ 3 \end{pmatrix} = s_{21}\cdot \begin{pmatrix}1 \\ 2 \end{pmatrix} + s_{22} \cdot \begin{pmatrix}3 \\ 4 \end{pmatrix} \Rightarrow s_{21}=\frac{1}{2} \ \ \text{and}  \ \ s_{22}=\frac{1}{2}  \\
\Rightarrow S =\begin{pmatrix}4 & -1 \\ \frac{1}{2} & \frac{1}{2} \end{pmatrix}
$$ 
Method 2:
$$\begin{pmatrix}s_{11} & s_{12} \\ s_{21} & s_{22} \end{pmatrix} \cdot \begin{pmatrix}1 & 3 \\ 2 & 4 \end{pmatrix} = \begin{pmatrix}1 & 2 \\ 4 & 3 \end{pmatrix} \\
\Rightarrow s_{11}=0 \ \ ;\ \ s_{12}= \frac{1}{2} \ \ ; \ \ s_{21}= -5 \ \ ; \ \ s_{22}=\frac{9}{2}\\
\Rightarrow S =\begin{pmatrix}0 & \frac{1}{2} \\ -5 & \frac{9}{2} \end{pmatrix}
$$
 A: In Method 1, what you really did, when looking at the equations you wrote down, was trying to solve the equation
$$
\underbrace{
\begin{pmatrix}
1 & 3 \\
2 & 4
\end{pmatrix} 
}_{=: ~A}
\begin{pmatrix}
s_{11} & s_{21} \\
s_{12} & s_{22}
\end{pmatrix}
=
\underbrace{
\begin{pmatrix}
1 & 2 \\
4 & 3
\end{pmatrix}
}_{=: ~B}
$$
So $\color{blue}{ \text{you were trying to solve } AS = B }$ for $S$.

 If you compare this to your matrix $S$, you will see that I exchanged $s_{12}$ and $s_{21}$ to correct a mistake in your calculation.

In this case your result will be
$$
S =
\begin{pmatrix}
4 & \frac{1}{2} \\
-1 & \frac{1}{2}
\end{pmatrix}
$$
In Method 2 $\color{blue}{ \text{you were trying to solve } SA = B }$ , which explains why you got two different results: you were solving two different matrix equations.

Which method is the correct way to calculate the change of basis?
Let's say you have a vector $\boldsymbol{\nu}$ written in the basis $\mathcal{A} = \{\boldsymbol{a}_1, \boldsymbol{a}_2 \}$. This means you have coordinates $\nu_1, \nu_2$ such that, if we also define the matrix $A = (\boldsymbol{a}_1, \boldsymbol{a}_2)$, you can write
$$ 
\boldsymbol{\nu}
= \nu_1 \boldsymbol{a}_1 + \nu_2 \boldsymbol{a}_2
= A 
\begin{pmatrix}
\nu_1 \\ \nu_2
\end{pmatrix}
$$
Now you want to know how it looks in $\mathcal{B} = \{\boldsymbol{b}_1, \boldsymbol{b}_2 \}$. This means you want to know the coordinates $\nu'_1, \nu'_2$ which lead to the same vector, no matter what basis you use :
$$
\boldsymbol{\nu}
= \nu'_1 \boldsymbol{b}_1 + \nu'_2 \boldsymbol{b}_2
= B 
\begin{pmatrix}
\nu'_1 \\ \nu'_2
\end{pmatrix}
= A
\begin{pmatrix}
\nu_1 \\ \nu_2 
\end{pmatrix}
$$
You continue by figuring out how the basis $\mathcal{A}$ is written in $\mathcal{B}$, solving the equations $\boldsymbol{a}_j = s_{j1}\boldsymbol{b}_1 + s_{j2} \boldsymbol{b}_2 ~$. This can be written as one matrix equation
$$
A
= (\boldsymbol{a}_1, \boldsymbol{a}_2)
= B (\boldsymbol{s}_1, \boldsymbol{s}_2)
= BS
$$
Which leads to
$$
\boldsymbol{\nu} 
= A
\begin{pmatrix}
\nu_1 \\ \nu_2
\end{pmatrix}
= BS
\begin{pmatrix}
\nu_1 \\ \nu_2
\end{pmatrix}
$$
Comparing the equations we get
$$
\begin{pmatrix}
\nu'_1 \\ \nu'_2
\end{pmatrix}
= S
\begin{pmatrix}
\nu_1 \\ \nu_2
\end{pmatrix}
~~~~~ \text{and} ~~~~~
S = (B^{-1})A
$$
where $S$ is the change of basis matrix you are looking for: given the coordinates in $\mathcal{A}$, you get the ones in $\mathcal{B}$. As you can see, $S$ can be calculated from $A$ and $B$, for example using Gaussian elimination.
In the methods you were using, you calculated $S = (A^{-1})B$ (method 1) and $S = B(A^{-1})$ (method 2). So none of the two yields the result you wanted. Method 1 is in some sense the closest, since you calculated the inverse of the matrix you actually wanted.
A: The method 2) is correct. It is the same as to find a matrix
$$
S=\begin{pmatrix}s_{11} & s_{12} \\ s_{21} & s_{22} \end{pmatrix} 
$$
such that 
$$
S\begin{pmatrix}1 \\2 \end{pmatrix}=\begin{pmatrix}1 \\4 \end{pmatrix}
$$
and
$$
S\begin{pmatrix}3 \\4 \end{pmatrix}=\begin{pmatrix}2 \\3 \end{pmatrix}
$$
that means exactly to transform the vectors of the first basis to the vectors of the second basis.
I don't see how the method 1) comes from...but it is wrong.
