# How to solve this set of linear equations

I am trying to solve six linear equations, for which a solution exists (since it can be recovered by Matlab). I am trying to reproduce it here. I have the following MWE:

\[Rho] = 1/2 {{1 + z, x - I y}, {x + I y, 1 - z}};
A1 = 1/2 \[Rho];
A1d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A1]];
A2 = 1/(2 I) \[Rho];
A2d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A2]];
A3 = 1/4 PauliMatrix;
A3d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A3]];
A4 =  1/(4 I) PauliMatrix;
A4d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A4]];
A5 =  1/4 PauliMatrix;
A5d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A5]];
A6 =  1/(4 I) PauliMatrix;
A6d = Assuming[{x, y, z} \[Element] Reals, Simplify@ConjugateTranspose[A6]];
Avector = {A1, A2, A3, A4, A5, A6};
Advector = {A1d, A2d, A3d, A4d, A5d, A6d};

Q1elements = Table[Tr[Advector[[j]].Inverse[\[Rho]].Avector[[k]]], {j, 1, 6}, {k, 1, 6}] // Simplify;
b = {0, 0, 1, 0, 0, 1};
Z = {z1, z2, z3, z4, z5, z6};


I want to perform the following optimisation over the vector $$Z$$:

$$2 Q_1 \cdot Z=b$$,

where $$Q_1$$ is the matrix Q1elements introduced above. I am trying to achieve this using Solve:

Solve[Q1elements.Z == b/2, Z]


However, it keeps generating an empty list suggesting there are no solutions for $$Z$$. Am I using the wrong the syntax? Am I defining the matrix Q1elements correctly for use in Solve?

Any help is appreciated!

• If you look at MatrixRank[Q1elements] you see it's only 3 (similarly, NullSpace only has 3 elements). So for generic b there is no solution. Solve seems to be suggesting that your b isn't one of the lucky ones. – bill s Aug 24 '19 at 21:36