Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have three original points $pt_1, pt_2, pt_3$ which if transformed by an unknown matrix $M$ turn into points $gd_1, gd_2, gd_3$ respectively. How can I find the matrix $M$ (all points are in 3-dimensional space)?

I understand that for original points holds $M\cdot pt_i = gd_i$, so combining all $pt_i$ into matrix $PT$ and all $gd_i$ into $GD$ I'd get a matrix equation $M\cdot PT=GD$ with unknown $M$.

However, many math packages solve matrix equations in form of $A\cdot x=B$, where $x$ is unknown.

Is my idea of combining points into matrices correct and if so how can I solve my matrix equation?

share|cite|improve this question
up vote 2 down vote accepted

Form matrices whose rows are $pt_k$ and $gd_k$. Then $$ \begin{bmatrix}pt_1\\pt_2\\pt_3\end{bmatrix}M=\begin{bmatrix}gd_1\\gd_2\\gd_3\end{bmatrix} $$ Then we have $$ M=\begin{bmatrix}pt_1\\pt_2\\pt_3\end{bmatrix}^{-1}\begin{bmatrix}gd_1\\gd_2\\gd_3\end{bmatrix} $$ So your idea is correct.

share|cite|improve this answer
Doh, how couldn't I figure it out! – mbaitoff Feb 24 '13 at 8:14
Wait, why rows? In your mind, if $A$ is a matrix, $X$ and $B$ are vectors, then which notation is correct: $A\cdot X=B$ or $X\cdot A=B$? – mbaitoff Feb 24 '13 at 8:17
Small addition: you didn't say whether the space is 3-dimensionsal. If you have less points than dimensions, you can still find a matrix that does what you want, but it is not unique. You should use pseudo Inverse. – yohBS Feb 24 '13 at 8:19
@mbaitoff: Oops... I should have put the matrix on the right or used columns. I have moved the matrix to the right, so as to be proper with row vectors. – robjohn Feb 24 '13 at 8:23
@yohBS: and if we have more points than dimensions, we can use a least squares regression. – robjohn Feb 24 '13 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.