2
$\begingroup$

How can I check if two homogeneous systems of linear equations are equivalent in Mathematica?

Given two systems of equations:

System 1: \begin{cases} 2x - 3y + 4z = 0 \\ -5x + 6y - 7z = 0 \end{cases}

System 2:

\begin{cases} -3y + 2x + 4z = 0 \\ 5x - 6y + 7z = 0 \end{cases}

What I mean by equivalent is that each equation in one system also exists in the same form or an equivalent or linear-combination form in the other system. In this case, the two systems are equivalent according to my definition above. How can I check if these systems are equivalent in Mathematica?

Another example of two equivalent systems:

System 3:

\begin{cases} x + 2y - z = 0 \\ 2x + 4y - 2z = 0 \end{cases}

System 4:

\begin{cases} x + 2y - z = 0 \\ 3x + 6y - 3z = 0 \end{cases}

(* Define the equations for System 1 *)
eq1 = 2 x - 3 y + 4 z == 0;
eq2 = -5 x + 6 y - 7 z == 0;

(* Define the equations for System 2 *)
eq3 = -3 y + 2 x + 4 z == 0;
eq4 = 5 x - 6 y + 7 z == 0;
$\endgroup$
1
  • $\begingroup$ I’d use RowReduce to see if they have the same echelon form. $\endgroup$ Commented Aug 6 at 8:27

3 Answers 3

3
$\begingroup$
(*System 1*)
eq1 = 2  x - 3  y + 4  z == 0;
eq2 = -5  x + 6  y - 7  z == 0;
(*System 2*)
eq3 = -3  y + 2  x + 4  z == 0;
eq4 = 5  x - 6  y + 7  z == 0;

(*System 3*)
eq5 = 2  x + 2  y - z == 0;
eq6 = 2  x + 4  y - 2  z == 0;
(*System 4*)
eq7 = 2  y + x - z == 0;
eq8 = 3  x + 6  y - 3  z == 0;

Using CoefficientArrays and RowReduce:

f = RowReduce[Normal[CoefficientArrays[#1, #2]][[2]]] &;

f[{eq1, eq2}, {x, y, z}] === f[{eq3, eq4}, {x, y, z}]

f[{eq5, eq6}, {x, y, z}] === f[{eq7, eq8}, {x, y, z}]

True

False

$\endgroup$
3
$\begingroup$

This is mechanized by quantifiers.

eq1 = 2   x - 3   y + 4   z == 0;eq2 = -5   x + 6   y - 7   z == 0;
eq3 = -3   y + 2   x + 4   z == 0;eq4 = 5   x - 6   y + 7   z == 0;
Resolve[ForAll[{x, y, z}, Equivalent[eq1 && eq2, eq3 && eq4]]]

True

$\endgroup$
1
  • $\begingroup$ eq5 = 2 x + 2 y - z == 0; eq6 = 2 x + 4 y - 2 z == 0; (*System 4*) eq7 = 2 y + x - z == 0; eq8 = 3 x + 6 y - 3 z == 0;Resolve[ForAll[{x, y, z}, Equivalent[eq5 && eq6, eq7 && eq8]]] results in False. $\endgroup$
    – user64494
    Commented Aug 6 at 5:59
2
$\begingroup$

You may solve the equations using Reduce and compare the results. E.g. System 1 and 2:

eq1 = 2 x - 3 y + 4 z == 0;
eq2 = -5 x + 6 y - 7 z == 0;

eq3 = -3 y + 2 x + 4 z == 0;
eq4 = 5 x - 6 y + 7 z == 0;

Reduce[{eq1, eq2}, {x, y, z}]
Reduce[{eq3, eq4}, {x, y, z}]

y == 2 x && z == x
y == 2 x && z == x

Therefore system 1 and 2 are equavalent.

Now system 3 and 4:

eq5 = 2 x + 2 y - z == 0;
eq6 = 2 x + 4 y - 2 z == 0;

eq7 = 2 y + x - z == 0;
eq8 = 3 x + 6 y - 3 z == 0;

x == 0 && z == 2 y
z == x + 2 y

These are not equivalent. This is easy to see if we rewrite these equations as:

eq50 = 2 x + 2 y - z == 0;
eq60 = x + 2 y - z == 0;

eq70 = x + 2 y - z == 0;
eq80 = x + 2 y - z == 0
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.