New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

det of empty matrix is 1 #10383

Closed
akritas opened this Issue Jan 12, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@akritas
Copy link
Contributor

akritas commented Jan 12, 2016

If M = Matrix(0, 0, []), then M.det() returns 1. Is this on purpose?

In other CAS's it returns an error message that the matrix is not square or something to that effect.

skirpichev added a commit to diofant/diofant that referenced this issue Jan 12, 2016

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jan 13, 2016

I believe it is set on purpose. It simplifies coding as it is not necessary make preparations for exceptions.

The value 1 is analogous to the value of an empty product. In fact, the determinant of a diagonal matrix is the product of its diagonal entries. For a 0x0 matrix this product takes conventionally the value 1.

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Jan 13, 2016

Or applying the Leibniz formula, which (at least according to Wikipedia) is the definition of the determinant, you get Sum(sgn(sigma(i))*Product(a_i,sigma(i), (i, 1, n)), (sigma in S_n)). n=0, so the Product is the empty product (i.e., 1), and the Sum is over S_0, which contains one element (the identity; S_n is a group so it always has at least one element). sgn(e) = 1, so the determinant is 1.

Note that Matrix(1, 0, []).det() does give a NonSquareMatrixError. But a 0x0 matrix is square.

@asmeurer asmeurer closed this Jan 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment