Coordinates in a new coordinate space defined by three points. I have three 3D points A,B,C in a coordinate system. I want to transform the coordinates to a new coordinate system which has point A as the new origin (0, 0, 0), AB as the line along the new x-axis, and AC as the line along the new y-axis. How do I get the new coordinates of A, B, C in this new coordinates space?
 A: Let's define three vectors.
$X$ is the new $x$ axis $\begin{pmatrix} x_1 \\\ x_2 \\ x_3\end{pmatrix}$, $Y$ is the new y axis $\begin{pmatrix} y_1 \\\ y_2  \\ y_3\end{pmatrix}$, and $Z$ is the new z axis $\begin{pmatrix} z_1 \\\ z_2 \\ z_3 \end{pmatrix}$.
Then, we can make this transformation matrix $T$ that converts coordinates from from the new coordinate system to the old coordinate system. This is $T=\begin{pmatrix} a_1 & b_1 & c_1 \\\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{pmatrix}$.
The opposite of this, which is what we want, is the matrix $T^{-1}=\begin{pmatrix} a_1 & b_1 & c_1 \\\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{pmatrix}^{-1}$.
Now, when we have coordinates in the old system, and we want to convert to a new system, we can simply use $v ' = T^{-1}v$, where $v$ is a vector representing the old coordinates and $v'$ is a vector representing the new coordinates. 

Since there is a translation involved, where we translate everything by $-\vec{A}$, where $\vec{A}$ is the coordinates of the old point $A$, we should use  $v ' = T^{-1}(v-\vec{A})$ instead.
