'Solve linear equation with 2 unkown and 3 equations in numpy with np.linalg.solve

3 euqations with two unknow have 3 solutions: One solution, infinte solutions, no solution. How would you write this in Numpy to get the solutions? I tried it the way you would do it with 3 unknowns:

import numpy as np

a = np.array([-9,-8, 14])

A = np.array([[ 1, 2, -2],
              [-3,-1, 4],
              ])
x = np.linalg.solve(A, a)
print(x)

But gives an Error, as A is not square. Sadly if I remove the last column of a and A, although i get an answer the system might still have no solution as it might not fit in the third equation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source