Function Repository Resource:

LinearlyConsistentQ

Source Notebook

Determine if a linear system has a solution

Contributed by: Jordan Hasler, Wolfram|Alpha Math Team

ResourceFunction["LinearlyConsistentQ"][eqns, vars]

computes whether there is at least one solution to the linear system eqns in terms of variables vars.

ResourceFunction["LinearlyConsistentQ"][mat]

computes whether there is at least one solution to the linear system represented by the augmented matrix mat.

Details

A system of equations can be written as a matrix-vector equation m.x=b, which can be further written as an augmented matrix.

Examples

Basic Examples (1) 

Determine if the system of equations has a solution:

In[1]:=
ResourceFunction[
 "LinearlyConsistentQ", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{x + y + 2 z == 1, x + y + 3 z == 0, 2 x + 2 y + 3 z == 3}, {x, y, z}]
Out[1]=

Scope (2) 

The system has no solution:

In[2]:=
ResourceFunction[
 "LinearlyConsistentQ", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{{1, 1, 2, 1}, {1, 1, 2, 0}}]
Out[2]=

Note that the equation cannot be solved:

In[3]:=
LinearSolve[{{1, 1, 2}, {1, 1, 2}}, {1, 0}]
Out[3]=

The system has a solution:

In[4]:=
ResourceFunction[
 "LinearlyConsistentQ", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{{1, 1, 2, 0}, {1, 1, 2, 0}}]
Out[4]=

Find the solution to the system:

In[5]:=
LinearSolve[{{1, 1, 2}, {1, 1, 2}}, {0, 0}]
Out[5]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 16 December 2022

Related Resources

Author Notes

To view the full source code for LinearlyConsistentQ, evaluate the following:

In[1]:=
SystemOpen[
 FileNameJoin[{DirectoryName[FindFile["ResourceFunctionHelpers`"]], "SystemConsistency.wl"}]]

License Information