All published worksheets from http://sagenb.org
a=matrix(2,2,(1,5,-1,2));a #initialize a 2x2 matrix
b=matrix(2,2,(-2,1,1,1));b #initialize a 2x2 matrix
c=a+b;c #find a matrix sum
d=b-a;d #find a matrix difference
e=a*b;e #show matrix products are not commutative
f=b*a;f #show matrix products are not commutative
g=a**2;g #square a matrix
h=b**3;h #cube a matrix
i=a^(-1);i #find the inverse of a matrix
j=b**(-1);j.n() #find the inverse of a matrix
k=det(a);k #find the determinant of a matrix
l=b.det();l #find the determinant of a matrix