Solving AM=MB for 3x3 Matrices: Vectorize M & Find 9 Equations

  • Context: Graduate 
  • Thread starter Thread starter daviddoria
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
daviddoria
Messages
96
Reaction score
0
I would like to solve AM = MB where A,B,M are 3x3 matrices.

What I came up with was to equate every entry in C to the corresponding entry in D (where C = AM and D = MB).

You can then vectorize M (call it Mv) and figure out the 9 equations to fill a 9x9 matrix on both sides

9x9 matrix times Mv = 9x9 matrix times Mv

Each row on the right can be subtracted from the same row on the left, leaving

9x9 times Mv = 0

The problem is, I could construct this matrix easily by hand, but this seems like an obnoxious process to write in code (a couple of loops or something?) Is there a better/different way to do this so that I can use normal algebra notation to express this?

Thanks,
Dave
 
Physics news on Phys.org