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

How can I determine a 2x2 trasformation matrix which transforms the triangle with vertices (1,0), (-1,0), and (2,-1) to a triangle with vertices (1,1), (-1,-2), and (3,-2)?

share|cite|improve this question

migrated from Feb 10 '14 at 13:31

This question came from our site for users of Mathematica.

This question appears to be off-topic because it is about mathematics, not about TeX & friends. I reccommend migration to Maths.SX. – Jubobs Feb 10 '14 at 9:46
If SE moderators confuse Mathematica and Mathematics no wonder why some users do the same.. – Öskå Feb 10 '14 at 10:21
I said before we should change the name of this forum to Wolfram Language, but no body listens to me. – Nasser Feb 10 '14 at 10:26
Sorry for posting an answer...hmmm – ubpdqn Feb 10 '14 at 11:00

If the question is how to do this with Mathematica then this particular problem can be done using default FindGeometricTransform (documentation here). In this case it can be solved exactly.

For this particular example:

pts1 = {{1, 0}, {-1, 0}, {2, -1}};
pts2 = {{1, 1}, {-1, 2}, {3, -2}};
tr = Chop[FindGeometricTransform[pts2, pts1]]

This yields:

enter image description here

The transform function can be decomposed using CoefficientArrays

{t, m} = Normal /@ CoefficientArrays[tr[[2]][{x, y}]]

where t is translation vector and m is transform matrix.

The result can be tested:

m.# + t & /@ pts1


{{1., 1.}, {-1., 2.}, {3., -2.}}

as desired

Or plotted:

ListPlot[{pts2, tr[[2]][#] & /@ pts1}, 
 PlotStyle -> {{Red, PointSize[0.03]}, {Green, PointSize[0.02]}}]

enter image description here

More complex pairs of sets of points and contexts would need deeper consideration (rigid, shear, etc). I again refer you to the documentation.

share|cite|improve this answer

Your Answer


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