Ask Your Question

Column space of a matrix

Hello Everyone,

I am new to Sage, and I am trying to use its linear algebra capabilities.

As a first exercise, I am trying to compute the column space of a matrix: A = matrix([[1,3,8],[1,2,6],[0,1,2]])

According to the documentation, the column space of A is given by A.column_space(). This function returns me:

• Vector space of degree 3 and dimension 2 over Rational Field Basis matrix: [ 1 0 1] [ 0 1 -1]

when I was expecting [1 3] [1 2] [0 1]

I clearly missed something. Any clues? With Maxima, I got the expected colum space.

I thank you in advance for any help.

Best,

edit retag close merge delete

1 Answer

Sort by ยป oldest newest most voted

Sage displays all vector spaces with the basis given in rows of a matrix; see the documentation of basis_matrix.

The basis that you got spans the same space as the basis you expected:

sage: A = matrix(QQ, [[1,3,8],[1,2,6],[0,1,2]])
sage: A.column_space() == matrix(QQ, [[1, 3], [1, 2], [0, 1]]).column_space()
True


You can also get the basis as a list of vectors instead:

sage: A.column_space().basis()
[
(1, 0, 1),
(0, 1, -1)
]


Indeed these are the rows of the matrix.

more

Comments

Thank you Ricardo, the linear relationships between didn't appear clear to me at first.

Best,

( 2023-10-05 07:14:57 +0100 )edit

Your Answer

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

Add Answer

Stats

Asked: 2023-10-04 08:23:15 +0100

Seen: 99 times

Last updated: Oct 04 '23