# Treat 2 variable as 1

Is there anyway to treat two variable, that are a result of expansion, as one?

To use Solve[] I can do

Clear[x, z, y, eq]
eq = Expand[x (z + y)] /. x z -> xz
Solve[eq == 0, xz]


Is there anyway to solve directly like

Clear[x, z, y, eq]
eq = Expand[x (z + y)]
Solve[eq == 0, x z]

• What about /. x -> z? Notice that x z is a multiplication. – Kuba Jul 7 '17 at 8:28
• @Kuba not sure, what you're getting at. Perhaps one could streamline OP's workaround somewhat like Solve[equations /. x -> xz/z, xz] /. xz -> x z taking out the not always reliable Expand – LLlAMnYP Jul 7 '17 at 8:31
• @LLlAMnYP I understood that OP does not want to define a relation but to consider x and z the same variable, therefore I suggested that. Then one can solve for z as there is only z for z or x. – Kuba Jul 7 '17 at 8:35
• – Kuba Jul 7 '17 at 8:48
• well at least in this case Solve[eq == 0, HoldPattern@Times[x, z]] works, but I don't know how stable of a solution this would be in more complex cases – glS Jul 7 '17 at 13:01

How about introducing the extra variable as a new equation and then telling Solve to solve for 2 variables? Or use Reduce instead?

Clear[x, z, y, eq];
eq = Expand[x (z + y)];
Solve[{eq == 0, xz == x z}, {xz, y}]
Reduce[{eq == 0, xz == x z}, {xz}]


Perhaps:

eq = Expand[x (z+y)];
Reduce[eq == 0 && v == x z, v]


(x == 0 && v == 0) || (y == -z && v == x z)