# How should I interpret being told that a system of linear equations has no solution?

Consider the following system of linear equations with parameters a and b

$2 x_1 - x_2 = a$

$-6 x_1 + 3 x_2 = b$

When $a = -1/3$ and $b = 1$ the system has the following solution

$x_1 = -1/6$ and $x_2 = 0$

There are infinitely many other values of $a$ and $b$ that also result in solutions.

However, when I evaluate

G = {{2, -1}, {-6, 3}};
LinearSolve[G, {a, b}]


I get the message

LinearSolve: Linear equation encountered that has no solution.

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.

So when LinearSolve tells us that the above system has no solutions, what is it actually saying?

• Note that $G$ is singular, so the solution, if exists, is not unique. – AccidentalFourierTransform Apr 27 '18 at 23:31
• When I am told that, I usually go off and sulk for a couple of days. – Daniel Lichtblau Apr 28 '18 at 18:51

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.
• "Generic" here meaning valid for unconstrained {a, b}; or more generally for a dense subset of {a, b}. – ulvi Apr 27 '18 at 23:56
There is no solution for general {a,b}. Under "Properties and Relations", the documentation for LinearSolve suggests using LeastSquares to get a solution, minimizing the error, for a singular system like this.
LeastSquares[G, {a, b}]