# Solving matrix equation for a matrix

Is there any way to define the matrix M that achieves the following equation? the two defined matrices are

{{(ω1 + ω4) / Sqrt},
{(μ ω2 + ω3) / Sqrt},
{(-μ ω2 + ω3) / Sqrt},
{(-ω1 + ω4) / Sqrt}}


and

{{ω1}, {ω2}, {ω3}, {ω4}}

• BTW, column vectors are not a necessity. Jun 4, 2020 at 12:54
• @ΑλέξανδροςΖεγγ You're right: I realized this from the corresponding answers. Jun 4, 2020 at 12:58

tt = {{(ω1 + ω4)/Sqrt},
{(μ ω2 + ω3)/Sqrt},
{(-μ ω2 + ω3)/Sqrt},
{(-ω1 + ω4)/Sqrt}} // Flatten

mat =Last@ CoefficientArrays[tt, {ω1, ω2, ω3, ω4}] // Normal mat. {ω1, ω2, ω3, ω4} - tt // Simplify


{0,0,0,0}

• Huh. Maybe I’m mistake but is this not just putting the initial vector/set of coupled equations in a matrix form? Seems magical but I know it’s simpler than it seems. Or maybe not? Jun 5, 2020 at 3:07
• @CATrevillian yes you are right. Jun 5, 2020 at 7:43

CoefficientArrays[] works very well for this:

m1 = Normal[Last[CoefficientArrays[{(ω1 + ω4)/Sqrt, (μ ω2 + ω3)/Sqrt,
(-μ ω2 + ω3)/Sqrt, (-ω1 + ω4)/Sqrt},
{ω1, ω2, ω3, ω4}]]]
{{1/Sqrt, 0, 0, 1/Sqrt}, {0, μ/Sqrt, 1/Sqrt, 0},
{0, -(μ/Sqrt), 1/Sqrt, 0}, {-(1/Sqrt), 0, 0, 1/Sqrt}}


Note how I used vectors instead of column matrices.

m1.{ω1, ω2, ω3, ω4} - {(ω1 + ω4)/Sqrt, (μ ω2 + ω3)/Sqrt,
(-μ ω2 + ω3)/Sqrt, (-ω1 + ω4)/Sqrt}
{0, 0, 0, 0}

• oops... I simplified my silly answer and I now notice its exactly the same as yours. Oh well. Don't know why the OP changed his mind about giving you the credit. Jun 5, 2020 at 7:45