How to find a transformation matrix, given coordinates of two triangles in $R^2$

Organize each of the points of the starting triangle as columns in a matrix $\mathbf{U}$, and each of the points of the resulting triangle as columns in a matrix $\mathbf{V}$. Thus, both $\mathbf{U}$ and $\mathbf{V}$ are $3\times3$ matrices because you have 3 vertices, each vertex having 3 coordinates (I am assuming the triangles are contained in $\mathbb{R}^3$ space).

Now, assume there is a matrix $\mathbf{T}$ such that $\mathbf{T}\mathbf{U}=\mathbf{V}$. All you need to do is to isolate $\mathbf{T}$:

$$ \mathbf{T}\mathbf{U}\mathbf{U}^{-1}=\mathbf{V}\mathbf{U}^{-1}\\ \mathbf{T}=\mathbf{V}\mathbf{U}^{-1} $$

Using the vertices of the triangles as columns in $\mathbf{U}$ and $\mathbf{V}$ is just a convenient way of writing the problem in matrix form.