Given that matrix $A$ is similar to matrix $B$, how do we find the matrix $M$? I have two questions regarding similar matrices. From the book, I learned that matrix A is similar to matrix B if  $M^{-1}AM = B$. My question is, given any matrix A and B, how can I systematically find matrix M.
First, I would like to know how to find matrix M if matrix B is a Jordan form.
Secondly, I would like to know how to find matrix M if matrix B is an arbitrary matrix that is similar to A.
I hope the community can share some numerical examples so that I can understand the steps properly.
At this point, I only know that if matrix $E$ has a complete of set of eigenvectors $S$, then $E = S^{-1}\Lambda S$
P.s: I read about Jordan form but I am still very puzzled on how to find the matrix M that leads to Jordan form.
 A: Suppose matrix A and B are similar and diagonalizable, then 
$$S^{-1}AS = \Lambda \ \text{and}\ V^{-1}BV = \Lambda$$
Since A and B are similar, there exist a matrix M such that, 
$$M^{-1}AM=B$$  To find M, we can use the following form:
$$M^{-1}S\Lambda S^{-1}M =V\Lambda V^{-1}$$
$$(S^{-1}M)^{-1}\Lambda S^{-1}M =V\Lambda V^{-1}$$
This implies $M = SV^{-1}$. Here, A and B are diagonalizable so there must be a complete set of eigenvectors. S and V are invertible and thus M is invertible. Note that, M may not be unique so we can also find M using the form:
$AM = MB$ where M is
$$M = \left( \begin{matrix}m_{11}&\cdots&m_{1n}\\
\vdots&\ddots&\vdots&\\
m_{n1}&\cdots&m_{nn}\\ 
\end{matrix} \right) $$
Let the components of M be a column vector, say $\hat{m}$. Then, we can find M with $(AM-BM)\hat{m} = 0$
$$$$
Next, suppose that matrix A has incomplete set of eigenvectors. We want to know B such that B is a Jordan form matrix, ($B=J$).
$$$$
To find J, we need to find matrix M such that $M^{-1}AM=J$. This M can be computed using the following steps:  
If A is a singular matrix, then there are $r$ independent eigenvectors in the column space. To find these eigenvectors, we need to compute $$Ax_i = \lambda_i x_i \ \text{ or }\ Ax_i = \lambda_i x_i + x_{i-1}$$
Tips: we can find $N(A-\lambda I)^j$ where $j = 1,2,3,\cdots$ too.
These eigenvectors are the columns of M.
After finding these $r$ eigenvectors, we need to find the intersection between columnspace and nullspace. Suppose they intersect with $p$ dimension, then every vector in the nullspace is an eigenvector corresponding to $\lambda = 0$, (This means in the above step, there is $p$ numbers of $x_i$ that has $\lambda = 0$). Since, the nullspace intersect with the columnspace, we can find the eigenvectors using the linear combination of the columnspace. The coefficient of the linear combination is the next columns of M. There are total $p$ columns.
Lastly, there is additional vectors ${z_i}$ lying in the nullspace but outside the intersections. These vectors are the remaining columns of M. Combining these columns produces matrix M.
