0

I need your help with 2 tasks. I totally do not know how to do them.

  1. For matrix A, find the inverse matrix by fetching to echelon form. Use the block matrix() function to connect the matrices. Matrix is:
 1  3  0 -1
 0  2  1  3
 3  1  2  1 
-1  2  0  3 
  1. Consider a subspace S generated by vectors:
v1=[1,0,3],v2=[0,2,2],v3=[1,-2,0].

Are they a basis of the subspace S?

For the first task I have got this:

A = matrix ([[1,3,0,-1],[0,2,1,3],[3,1,2,1],[-1,2,0,3]])
b = block_matrix([[A,matrix.identity(4)],[~A,0*A]])
b

But what to do with the echelon form?

And for the second task I created:

V = QQ^3
v1=vector(QQ,[1,0,3])
v2=vector(QQ,[0,2,2])
v3=vector(QQ,[1,-2,0])
L = [v1,v2,v3]
V.linear_dependence(L)==[]

What is going to be next?

mmm
  • 1
  • 1
  • Note that https://stackoverflow.com/questions/75136748/how-to-create-inverse-matrix-with-echelon-form-basis-of-subspace is a less-fleshed-out duplicate. – kcrisman Jan 29 '23 at 20:15

1 Answers1

0

Focusing on your first question, which seems better-posed, you can try to get an echelon form of the block matrix (just the main part):

sage: A = matrix (QQ,[[1,3,0,-1],[0,2,1,3],[3,1,2,1],[-1,2,0,3]])
sage: b = block_matrix([[A,matrix.identity(4)]])
sage: b.echelon_form()

[     1      0      0      0| -1/14  -11/7  11/14    9/7]
[     0      1      0      0|   2/7    2/7   -1/7   -1/7]
[     0      0      1      0|  1/14   18/7 -11/14  -16/7]
[     0      0      0      1| -3/14   -5/7   5/14    6/7]

If you wanted to extract just the inverse, you could slice the matrix. Be careful with this syntax!

sage: C = b.echelon_form()
sage: inv = C[:,4:]
sage: inv*A

[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]

(Live demo here.)

kcrisman
  • 4,374
  • 20
  • 41