Ask Your Question

Kernel not found?

asked 2019-01-02 11:24:02 +0100

anonymous user


updated 2019-01-02 11:26:53 +0100

Hi. Why is no kernel found for the 2x3 matrix A=[2,3,5];[-4,2,3] ?

sage: A = matrix([[2,3,5],[-4,2,3]])  
sage: A   
[ 2  3  5]  
[-4  2  3]  
sage: A.kernel()  
Free module of degree 2 and rank 0 over Integer Ring  
Echelon basis matrix:  

However we know that the kernel should be given by: x=-z/16 and y=-13z/8

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-02 11:32:39 +0100

rburing gravatar image

updated 2019-01-02 11:35:47 +0100

Sage returns the left kernel. This is written in the documentation that you can access by

sage: A.kernel?

You want the right kernel:

sage: A.right_kernel()
edit flag offensive delete link more


While A.right_kernel() returns [ 1 26 -16], it's only one possible solution from the solution set. Instead, I expect it to return c * [ 1 26 -16 ]. Any idea how to not miss out all the solutions?

rijndaelxyz gravatar imagerijndaelxyz ( 2019-01-02 19:02:42 +0100 )edit

What A.right_kernel() returns is not a vector but a module with basis. (If you create a matrix over a field like A = matrix(QQ, [[2,3,5],[-4,2,3]]) it returns a vector space with basis.) You can obtain the basis (which is a sequence of vectors) by b = A.right_kernel().basis(). The set of solutions to $Ax = 0$ is spanned by this basis, i.e. all solutions are linear combinations of those basis vectors. If you insist, you can introduce the appropriate number of symbolic variables c = [var('c_%d' % i) for i in range(len(b))] and create such a linear combination: sum([c[i]*b[i] for i in range(len(b))]); this is a vector over the Symbolic Ring SR.

rburing gravatar imagerburing ( 2019-01-02 19:16:17 +0100 )edit

If you want to display the linear combination in the way you wrote, you can do it like this: FormalSum([(c[i], b[i]) for i in range(len(b))], parent=FormalSums(SR)), or even the fancy display show(FormalSum([(c[i], b[i].column()) for i in range(len(b))], parent=FormalSums(SR))).

rburing gravatar imagerburing ( 2019-01-02 19:22:40 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-01-02 11:24:02 +0100

Seen: 625 times

Last updated: Jan 02 '19