Ask Your Question

Revision history [back]

Note that your case is very particular since in general, there is no reason why the free parameters coincide with some of the variables.

It is probably not be what you are looking for, but here is a generic way to deal with systems of linear equations:

sage: M = matrix(QQ,[[1,1,1],[1,1,-1]])
sage: M
[ 1  1  1]
[ 1  1 -1]

sage: part_sol = M.solve_right(vector([4,5])) ; part_sol
(9/2, 0, -1/2)

sage: kern = M.right_kernel() ; kern
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[ 1 -1  0]
sage: kernel_basis = kern.basis()
[
(1, -1, 0)
]

Then the solution set is the sum of part_sol with any linear combination of the elements of the basis of the kernel, in your case it is : (9/2, 0, -1/2) + t*(1, -1, 0) for any t in your field (i chosed $\mathbb{Q}$).