How should I interpret being told that a system of linear equations has no solution? - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2020-01-27T16:47:35Z https://mathematica.stackexchange.com/feeds/question/172102 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/172102 0 How should I interpret being told that a system of linear equations has no solution? Richard Gostanian https://mathematica.stackexchange.com/users/57902 2018-04-27T23:02:07Z 2018-04-27T23:47:46Z <p>Consider the following system of linear equations with parameters a and b</p> <p>\$2 x_1 - x_2 = a\$</p> <p>\$-6 x_1 + 3 x_2 = b\$</p> <p>When \$a = -1/3\$ and \$b = 1\$ the system has the following solution </p> <p>\$x_1 = -1/6\$ and \$x_2 = 0\$</p> <p>There are infinitely many other values of \$a\$ and \$b\$ that also result in solutions.</p> <p>However, when I evaluate</p> <pre><code>G = {{2, -1}, {-6, 3}}; LinearSolve[G, {a, b}] </code></pre> <p>I get the message </p> <blockquote> <p>LinearSolve: Linear equation encountered that has no solution.</p> </blockquote> <p>I would interpret this to mean that the above system has no solutions for any values of a and b. This interpretation is clearly incorrect. </p> <p>So when <code>LinearSolve</code> tells us that the above system has no solutions, what is it actually saying?</p> https://mathematica.stackexchange.com/questions/172102/-/172104#172104 6 Answer by ulvi for How should I interpret being told that a system of linear equations has no solution? ulvi https://mathematica.stackexchange.com/users/1714 2018-04-27T23:32:14Z 2018-04-27T23:32:14Z <p>This particular function is telling you that your linear system is singular: the determinant of \$G\$ is zero. The general system only has solutions when \$b=-3a\$, and then it has infinitely many solutions. You can interpret the message "no solution" as "no generic solution," as is typical in Mathematica.</p> https://mathematica.stackexchange.com/questions/172102/-/172105#172105 4 Answer by John Doty for How should I interpret being told that a system of linear equations has no solution? John Doty https://mathematica.stackexchange.com/users/27989 2018-04-27T23:42:30Z 2018-04-27T23:47:46Z <p>There is no solution for general <code>{a,b}</code>. Under "Properties and Relations", the documentation for <code>LinearSolve</code> suggests using <code>LeastSquares</code> to get a solution, minimizing the error, for a singular system like this.</p> <pre><code>LeastSquares[G, {a, b}] (* {a/25 - (3 b)/25, -(a/50) + (3 b)/50} *) </code></pre>