In your example code, solve_linear_system expects an extended system, i.e. if the right side is zero, then the matrix should be declared as Matrix.zeros(8,8) . With this modification, your code gives
{a3: 0, a1: 0, a5: 0, a7: 0, a6: 0, a2: 0, a4: 0}
which is really a solution, albeit not an interesting one ...
To fix this, you can explicitly request that one component of the solution be normalized, say 1. So, if you are doing something like the following:
from sympy import Matrix, symbols, pprint, lcm, latex, solve top_matrix = Matrix.zeros(8,7) p1,p2 = symbols("p1, p2") top_matrix[0,0] = 1 top_matrix[0,1] = -1 top_matrix[1,1] = (1-p1) top_matrix[1,2] = -1 top_matrix[2,2] = 1 top_matrix[2,4] = p2-1 top_matrix[3,1] = p1 top_matrix[3,3] = -1 top_matrix[4,3] = 1 top_matrix[4,4] = -p2 top_matrix[5,4] = 1 top_matrix[5,5] = -1 top_matrix[6,1] = -1 top_matrix[6,6] = -1 top_matrix[7,4] = 1 top_matrix[7,6] = 1 pprint(top_matrix) a1,a2,a3,a4,a5,a6,a7 = list(symbols("a1, a2, a3, a4, a5, a6, a7")) B = Matrix([[1],[a2],[a3],[a4],[a5],[a6],[a7]]) C = top_matrix * B print(solve(C, (a2,a3,a4,a5,a6,a7,p1,p2)))
and solve for the remaining variables, as well as the parameters p1,p2 , the result:
[{a2: 1, a7: -1, a4: p2, a6: 1, a5: 1, p1: p2, a3: -p2 + 1}]
what really is the solution you are looking for.