I am using LinearSolve[] to solve equations that theoretically should admit a unique solution, but somehow it is giving error message saying that enter image description here

For instance, if I run this command

LinearSolve[Transpose[{{0, 1.2, 0}, {-0.9, 0, 1.4}}], {-4.176802209048674`,-3.79276234742121`, 6.497247880741725`}]

which literally solves for the coefficient $a, b$ such that $$a(0, 1.2, 0)^T+b(-0.9,0,1.4)^T=(4.1768..., -3.7928..., 6.4972)^T$$ i.e., how the two vectors span the latter. To see that there is a unique solution, we do an inner product of the latter vector with the cross product of the former two, as the command below does

{-4.176802209048674`, -3.79276234742121`, 6.497247880741725`}.Cross[{0, 1.2, 0}, {-0.9, 0, 1.4}]

On my device, the result is -7.08766*10^-13, an extremely small value, which shows that the latter vector indeed lies on the plane spanned by the former two (since the inner product with their cross product, which is proportional to the normal vector, is almost $0$).

Why then does the LinearSolve[] say there is no solution? Is it due to the $10^{-13}$ error?


1 Answer 1


Yes, it is overdetermined. One can use LeastSquares for this.

 Transpose[{{0, 1.2, 0}, {-0.9, 0, 1.4}}],   
 {-4.176802209048674`, -3.79276234742121`, 6.497247880741725`}

(* {-3.16064, 4.64089} *)

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.