Mathematica doesn't allow implicit definition of a matrix, so your Z
should be defined as something like:
Z = {{z1, z2}, {z3, z4}};
For the case in which the order of Z
is very high, you may prefer this kind of definition (just in case, I'd like to mention that something like Z(1, 1)
doesn't make sense in Mathematica):
Z = Table[z[i, j], {i, 2}, {j, 2}];
Then, you seem to mix up Subscript
and List
. They're totally different. Personally, I suggest you not to use Subscript
, since (I think) it's a compromise to the traditional form of math symbol and a somewhat pathological object in Mathematica. You'll find that List
or just something like a[1, 1] = 1; a[1, 2] = 2; …
more convinient when you get more familiar with Mathematica. Here your X
and Y
can be defined like this:
X = {{1, 1}, {1, 1}};
Y = {{2, 2}, {2, 2}};
The third problem in your code is that you choose capital letters for the name of variables, it's not a good choice since all the built-in functions in Mathematica are begun with capital letter so it may cause problems, and for your code, your C
gets caught: it's a protected symbol. We can change it into c
:
c = 5;
After running all the code above, we can solve your equation (by the way, your syntax of Solve
is also wrong, it should not be {X, Y, Z}
because X
and Y
are not unknown variables):
Solve[X + c Y == Z, Flatten@Z]
(* {{z1 -> 11, z2 -> 11, z3 -> 11, z4 -> 11}}
or
{{z[1, 1] -> 11, z[1, 2] -> 11, z[2, 1] -> 11, z[2, 2] -> 11}} *)
X = {{1, 1}, {1, 1}}; Y = {{2, 2}, {2, 2}}; C0 = 5; Z = X + C0 Y
. $\endgroup$