# How to solve matrix equation of type: MatrA*X +MatrB=MatrC, for X, where X is supposed to be matrix as well

Here is the example of an equation, I'm trying to solve:

I tried to use Solve, but apparently it doesn't work the way I expected:

In[132]:= matrixA:={{1,-3},{8,0}}
matrixB:=3 {{-1,1},{0,4}}

In[131]:= Solve[matrixA-2 X==matrixB,X]

Out[131]= {}

• You need to specify the unknown X = {{x1,x2},{x3,x4}}, and type Solve[matrixA-2 X==matrixB,{x1,x2,x3,x4}]. Also, there is no need to use SetDelayed (:=) here; use Set (=). – corey979 Nov 2 '16 at 17:50
• it worked, thanks! – Elias Nov 2 '16 at 18:04

• Thanks. Is there a way to easily convert the output into matrix, rather than manually extract x1, x2, x3, x4 from the solution, using Evaluate? – Elias Nov 2 '16 at 18:06
• Not exactly. The result of Flatten[X] /. Solve[A - 2*X == 3*B, Flatten[X]] is {{5,-6,4,-18}}, but it supposed to be {{5,-6},{4,-18}} – Elias Nov 2 '16 at 18:10