Theorem NPNF. Nonsingular Product has Nonsingular Factors.
Suppose that and are square matrices of size The product is nonsingular if and only if and are both nonsingular.
.inverse()
method. In the following, we compute the inverse of a xxxxxxxxxx
A = matrix(QQ,[[ 3, 7, -6],
[ 2, 5, -5],
[-3, -8, 8]])
A.is_singular()
xxxxxxxxxx
Ainv = A.inverse(); Ainv
xxxxxxxxxx
A*Ainv
xxxxxxxxxx
col_0 = A.column(0)
col_1 = A.column(1)
C = column_matrix([col_0, col_1, 2*col_0 - 4*col_1])
C.is_singular()
xxxxxxxxxx
C.inverse()
C
is explained by the matrix being singular.A
as a coefficient matrix, so be sure to execute the code above.xxxxxxxxxx
const = vector(QQ, [2, -1, 4])
A.solve_right(const)
xxxxxxxxxx
A.inverse()*const
xxxxxxxxxx
A.solve_right(const) == A.inverse()*const
xxxxxxxxxx
A^-1
.is_singular()
and .is_invertible()
. By Theorem NI we know these two functions to be logical opposites. One way to express this is that these two methods will always return different values. Here we demonstrate with a nonsingular matrix and a singular matrix. The comparison !=
is “not equal.”xxxxxxxxxx
nonsing = matrix(QQ, [[ 0, -1, 1, -3],
[ 1, 1, 0, -3],
[ 0, 4, -3, 8],
[-2, -4, 1, 5]])
nonsing.is_singular() != nonsing.is_invertible()
xxxxxxxxxx
sing = matrix(QQ, [[ 1, -2, -6, 8],
[-1, 3, 7, -8],
[ 0, -4, -3, -2],
[ 0, 3, 1, 4]])
sing.is_singular() != sing.is_invertible()
xxxxxxxxxx
A = matrix(QQ, [[ 3, -5, -2, 8],
[-1, 2, 0, -1],
[-2, 4, 1, -4],
[ 4, -5, 0, 8]])
B = matrix(QQ, [[ 1, 2, 4, -1],
[-2, -3, -8, -2],
[-2, -4, -7, 5],
[ 2, 5, 7, -8]])
A.is_invertible() and B.is_invertible()
xxxxxxxxxx
(A*B).inverse() == B.inverse()*A.inverse()
xxxxxxxxxx
A = matrix(QQbar, [
[(1+I)/sqrt(5), (3+2*I)/sqrt(55), (2+2*I)/sqrt(22)],
[(1-I)/sqrt(5), (2+2*I)/sqrt(55), (-3+I)/sqrt(22)],
[ I/sqrt(5), (3-5*I)/sqrt(55), (-2)/sqrt(22)]
])
A.is_unitary()
xxxxxxxxxx
A.conjugate_transpose() == A.inverse()
u
and v
are created randomly. Try evaluating this compute cell with your own choices.xxxxxxxxxx
u = random_vector(QQ, 3) + QQbar(I)*random_vector(QQ, 3)
v = random_vector(QQ, 3) + QQbar(I)*random_vector(QQ, 3)
(A*u).hermitian_inner_product(A*v) == u.hermitian_inner_product(v)
xxxxxxxxxx
sigma = Permutation([2,3,1])
S = sigma.to_matrix(); S
xxxxxxxxxx
tau = Permutation([1,3,2])
T = tau.to_matrix(); T
xxxxxxxxxx
S*T
xxxxxxxxxx
rho = Permutation([2, 1, 3])
S*T == rho.to_matrix()