# 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]},
{(μ ω2 + ω3) / Sqrt[2]},
{(-μ ω2 + ω3) / Sqrt[2]},
{(-ω1 + ω4) / Sqrt[2]}}


and

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

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

tt = {{(ω1 + ω4)/Sqrt[2]},
{(μ ω2 + ω3)/Sqrt[2]},
{(-μ ω2 + ω3)/Sqrt[2]},
{(-ω1 + ω4)/Sqrt[2]}} // 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? Commented Jun 5, 2020 at 3:07
• @CATrevillian yes you are right. Commented Jun 5, 2020 at 7:43

CoefficientArrays[] works very well for this:

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


Note how I used vectors instead of column matrices.

m1.{ω1, ω2, ω3, ω4} - {(ω1 + ω4)/Sqrt[2], (μ ω2 + ω3)/Sqrt[2],
(-μ ω2 + ω3)/Sqrt[2], (-ω1 + ω4)/Sqrt[2]}
{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. Commented Jun 5, 2020 at 7:45