http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696
MATLAB Central Newsreader  What is the determinant of [] ?
Feed for thread: What is the determinant of [] ?
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 25 Oct 2010 07:10:43 +0000
What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790327
Greg Heath
I get<br>
<br>
det([]) = 1<br>
<br>
Is this reasonable?<br>
<br>
This was discovered via x = magic(0) = [] when<br>
I looking for a sequence of matrices for some<br>
regression examples<br>
<br>
:>> for i = 0:20, disp([ i det(magic(i))]),end<br>
0 1<br>
1 1<br>
2 10<br>
3 360<br>
4 0<br>
5 5070000<br>
6 0<br>
7 348052801600<br>
8 0<br>
9 7.50357380590272e+016<br>
10 0<br>
11 4.1037749689304e+022<br>
12 0<br>
13 4.61380654818195e+028<br>
14 0<br>
15 9.58679544904057e+034<br>
16 0<br>
17 3.43347181141828e+041<br>
18 0<br>
19 1.96249341949157e+048<br>
20 0<br>
<br>
Greg

Mon, 25 Oct 2010 08:07:20 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790334
Nasser M. Abbasi
On 10/25/2010 12:10 AM, Greg Heath wrote:<br>
> I get<br>
><br>
> det([]) = 1<br>
><br>
> Is this reasonable?<br>
><br>
<br>
good question. It seems this is something not well defined becuase I <br>
tried it on 2 other systems, Maple gave me back zero, and Mathematica <br>
complained that the matrix was empty.<br>
<br>
Mathematica:<br>
<br>
In[1]:= Det[{{}}]<br>
<br>
During evaluation of In[1]:= Det::matsq: Argument {At Line = 1, the <br>
input was:,Det[{{}}],{{}}} at position {At Line = 1, the input <br>
was:,Det[{{}}],1} is not a nonempty square matrix. >><br>
<br>
Out[1]= Det[{{}}]<br>
<br>
<br>
Maple<br>
with(LinearAlgebra):<br>
v1:=Matrix(1,1,[]):<br>
Determinant(v1);<br>
0<br>
<br>
<br>
<br>
Nasser

Mon, 25 Oct 2010 12:27:03 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790403
Bruno Luong
Greg Heath <heath@alumni.brown.edu> wrote in message <99996f6f471e49b69c95a6ff3efed38b@j2g2000yqf.googlegroups.com>...<br>
> I get<br>
> <br>
> det([]) = 1<br>
> <br>
> Is this reasonable?<br>
<br>
Perfectly reasonable.<br>
<br>
It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigenvalues. In zerodimension space the eigen value is empty, then the most logical is returning the neutral element.<br>
<br>
Bruno

Mon, 25 Oct 2010 14:19:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790449
Matt J
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia3t2n$c7m$1@fred.mathworks.com>...<br>
><br>
> Perfectly reasonable.<br>
> <br>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigenvalues. In zerodimension space the eigen value is empty, then the most logical is returning the neutral element.<br>
========<br>
<br>
Well, fair enough, but it can create some weird inconsistencies.<br>
<br>
For example, we know that inv(1)=1 and by extension that<br>
<br>
inv([1, []; [], []] ) =1<br>
<br>
However, what about the theorem that says that<br>
<br>
inv(A)= Adjucant(A)/det(A)<br>
<br>
If A=[1,[];[],[]] and det([])=1 then shouldn't the adjucant of A be<br>
[1,1;1,1]<br>
<br>
Then according to the adjucant formula shouldn't<br>
<br>
inv(A)=inv(1)=[1,1;1 1]<br>
<br>
?

Mon, 25 Oct 2010 14:40:07 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790462
Mark Shore
> > <br>
> > det([]) = 1<br>
> > <br>
> > Is this reasonable?<br>
> <br>
> Perfectly reasonable.<br>
> <br>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigenvalues. In zerodimension space the eigen value is empty, then the most logical is returning the neutral element.<br>
> <br>
> Bruno<br>
<br>
This seems perilously close to defining 0/0 as 1. What would be wrong with NaN instead?

Mon, 25 Oct 2010 14:54:03 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790468
Bruno Luong
"Mark Shore" <mshore@magmageosciences.ca> wrote in message <ia44s7$l6p$1@fred.mathworks.com>...<br>
> > > <br>
> > > det([]) = 1<br>
> > > <br>
> > > Is this reasonable?<br>
> > <br>
> > Perfectly reasonable.<br>
> > <br>
> > It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigenvalues. In zerodimension space the eigen value is empty, then the most logical is returning the neutral element.<br>
> > <br>
> > Bruno<br>
> <br>
> This seems perilously close to defining 0/0 as 1. What would be wrong with NaN instead?<br>
<br>
IMO, 0 has nothing remotely to do here. 1 is *the* neutral element of product.<br>
<br>
Bruno

Mon, 25 Oct 2010 16:38:03 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790492
Matt J
<br>
Isn't this also a little weird?<br>
<br>
<br>
>> isequal(prod([1 []]) , []*1)<br>
<br>
ans =<br>
<br>
0

Mon, 25 Oct 2010 17:09:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790504
Sean
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4bpb$jid$1@fred.mathworks.com>...<br>
> <br>
> Isn't this also a little weird?<br>
> <br>
> <br>
> >> isequal(prod([1 []]) , []*1)<br>
> <br>
> ans =<br>
> <br>
> 0<br>
<br>
I don't think this is weird. You're concatenating 1 and nothing in the first step which creates a scalar value. The product of [1] is 1. If it didn't behave like this you'd be able to have [] at any random place in a matrix which would be bad for all sorts of reasons:<br>
<br>
A = magic(3)<br>
A(5) = [];<br>
<br>
Instead of the vector being returned, a matrix with an empty fifth spot would be.

Mon, 25 Oct 2010 17:54:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790520
Roger Stafford
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia3t2n$c7m$1@fred.mathworks.com>...<br>
> Greg Heath <heath@alumni.brown.edu> wrote in message <99996f6f471e49b69c95a6ff3efed38b@j2g2000yqf.googlegroups.com>...<br>
> > I get<br>
> > <br>
> > det([]) = 1<br>
> > <br>
> > Is this reasonable?<br>
> <br>
> Perfectly reasonable.<br>
> <br>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigenvalues. In zerodimension space the eigen value is empty, then the most logical is returning the neutral element.<br>
> <br>
> Bruno<br>
     <br>
I tend to side with Bruno (and MathWorks) on this question. Besides his argument about eigenvalues, you can reason this way. The determinant of a square n x n matrix is obtained as the sum, with appropriate signs, of n factorial products, each of which is composed of n factors. If we let n be zero, this is zero factorial terms each composed of zero factors  that is to say one term composed of no factors and therefore possessing the value one. Hence the sum must be one.<br>
<br>
Of course when stated in such a manner it sounds a bit absurd, but just as with the definition of zero factorial, it is convenient to define it in this manner because it hopefully constitutes the best extension of a notion that is welldefined for positive values of n. I suppose in reality this question depends on how many contradictions one encounters such as Matt's in trying to make use of it. In the case of factorial, the correctness of the extension to zero factorial was absolutely assured by the natural analytic extension furnished by the gamma function. Perhaps there is a similar argument for an empty determinant.<br>
<br>
Roger Stafford

Mon, 25 Oct 2010 17:58:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790521
Bruno Luong
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4bpb$jid$1@fred.mathworks.com>...<br>
> <br>
> Isn't this also a little weird?<br>
> <br>
> <br>
> >> isequal(prod([1 []]) , []*1)<br>
> <br>
<br>
[1 []] is 1, this is perfectly clear as Sean explained.<br>
<br>
[]*1 is [] because of the rule of scalar expansion. More generally, a (scalar * matrix) or the opposite return the result that has the same size as the matrix. In your example is 0x0, thus [].<br>
<br>
Therefore isequal(1,[]) is false.<br>
<br>
Bruno

Mon, 25 Oct 2010 18:17:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790523
Matt J
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4gfc$lj4$1@fred.mathworks.com>...<br>
><br>
> <br>
> [1 []] is 1, this is perfectly clear as Sean explained.<br>
> <br>
> []*1 is [] because of the rule of scalar expansion. More generally, a (scalar * matrix) or the opposite return the result that has the same size as the matrix. In your example is 0x0, thus [].<br>
========<br>
<br>
The reasons/rules for what's observed are quite clear, but my point was, these rules are in conflict. You would think that prod([1 []]) ought to be the same as []*1, just<br>
as prod([1,2]) is the same as 1*2.

Mon, 25 Oct 2010 18:33:05 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790526
Bruno Luong
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4hj0$3qk$1@fred.mathworks.com>...<br>
<br>
> <br>
> The reasons/rules for what's observed are quite clear, but my point was, these rules are in conflict. You would think that prod([1 []]) ought to be the same as []*1, just<br>
> as prod([1,2]) is the same as 1*2.<br>
<br>
It is not conflict. I usually avoid do any extrapolation on Matlab syntax. The evaluation order of an expression is specified strictly with Matlab syntax. The conflict arises only when we start to *interpret* the command with out own view.<br>
<br>
No where in the document prod([1 [2 3] 4]) is specified to be understood as 1*[2 3]*4. This is an (wrong) interpretation.<br>
<br>
Bruno

Mon, 25 Oct 2010 18:39:44 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790528
Steven_Lord
<br>
<br>
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <br>
news:ia4hj0$3qk$1@fred.mathworks.com...<br>
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <br>
> <ia4gfc$lj4$1@fred.mathworks.com>...<br>
>><br>
>><br>
>> [1 []] is 1, this is perfectly clear as Sean explained.<br>
>><br>
>> []*1 is [] because of the rule of scalar expansion. More generally, a <br>
>> (scalar * matrix) or the opposite return the result that has the same <br>
>> size as the matrix. In your example is 0x0, thus [].<br>
<br>
Yes. In this particular case scalar expansion is not really performing <br>
"expansion" but contraction, but we still call it scalar expansion.<br>
<br>
> The reasons/rules for what's observed are quite clear, but my point was, <br>
> these rules are in conflict. You would think that prod([1 []]) ought to be <br>
> the same as []*1, just<br>
> as prod([1,2]) is the same as 1*2.<br>
<br>
Ah, but the commands "prod([1 ones(2)])" and "ones(2)*1" do not have the <br>
same behavior, and each has (IMO) the correct behavior; the former throws an <br>
error while the second returns ones(2).<br>
<br>
IF x is a scalar value, then prod([1 x]) and x*1 should return the same <br>
result. If not, they may not. Is [] a scalar value?<br>
<br>
 <br>
Steve Lord<br>
slord@mathworks.com<br>
comp.softsys.matlab (CSSM) FAQ: <a href="http://matlabwiki.mathworks.com/MATLAB_FAQ">http://matlabwiki.mathworks.com/MATLAB_FAQ</a><br>
To contact Technical Support use the Contact Us link on <br>
<a href="http://www.mathworks.com">http://www.mathworks.com</a>

Mon, 25 Oct 2010 18:41:07 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790531
Bruno Luong
To convince PROD([]) must be 1, I invite those who still have any doubt to fill ??? in the following recursive function. This function must do more or less the same thing as PROD with input vector:<br>
<br>
function p = myprod(a)<br>
<br>
if length(x)==0<br>
p = ???<br>
else<br>
p = myprod(a(1:end1))*a(end)<br>
end<br>
<br>
Bruno

Mon, 25 Oct 2010 18:47:05 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790533
Matt J
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4ih1$4j8$1@fred.mathworks.com>...<br>
><br>
> It is not conflict. I usually avoid do any extrapolation on Matlab syntax. The evaluation order of an expression is specified strictly with Matlab syntax. The conflict arises only when we start to *interpret* the command with out own view.<br>
> <br>
> No where in the document prod([1 [2 3] 4]) is specified to be understood as 1*[2 3]*4. This is an (wrong) interpretation.<br>
========<br>
<br>
That's also a fair point, but it seems to me that "interpretations" like these are what motivated conventions like prod([])=1 in the first place. That is, it makes identities<br>
<br>
prod([1,[]])=prod(1)*prod([])<br>
<br>
and<br>
<br>
sum([1,[]])=sum(1)+sum([])<br>
<br>
valid and consistent with behavior for non[] arguments.

Mon, 25 Oct 2010 18:59:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790535
Bruno Luong
"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4jb9$rsq$1@fred.mathworks.com>...<br>
<br>
> That's also a fair point, but it seems to me that "interpretations" like these are what motivated conventions like prod([])=1 in the first place. That is, it makes identities<br>
> <br>
> prod([1,[]])=prod(1)*prod([])<br>
> <br>
> and<br>
> <br>
> sum([1,[]])=sum(1)+sum([])<br>
<br>
Yes, there is the recursion relation that must be satisfied PROD and SUM, that can goes down to empty vector as I showed in the previous post.<br>
<br>
That the reason prod([]) is logically 1. Another way to confirm the logic is<br>
<br>
prod(a) = exp(sum(log(a)))<br>
<br>
Is A is empty, log(A) is empty, sum([]) is 0 (because 0 is neutral element of +), and finally prod([]) = exp(0) = 1.<br>
<br>
Bruno

Mon, 25 Oct 2010 20:24:04 +0000
Re: What is the determinant of [] ?
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294696#790545
Roger Stafford
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4k1o$dva$1@fred.mathworks.com>...<br>
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4jb9$rsq$1@fred.mathworks.com>...<br>
> <br>
> > That's also a fair point, but it seems to me that "interpretations" like these are what motivated conventions like prod([])=1 in the first place. That is, it makes identities<br>
> > <br>
> > prod([1,[]])=prod(1)*prod([])<br>
> > <br>
> > and<br>
> > <br>
> > sum([1,[]])=sum(1)+sum([])<br>
> <br>
> Yes, there is the recursion relation that must be satisfied PROD and SUM, that can goes down to empty vector as I showed in the previous post.<br>
> <br>
> That the reason prod([]) is logically 1. Another way to confirm the logic is<br>
> <br>
> prod(a) = exp(sum(log(a)))<br>
> <br>
> Is A is empty, log(A) is empty, sum([]) is 0 (because 0 is neutral element of +), and finally prod([]) = exp(0) = 1.<br>
> <br>
> Bruno<br>
       <br>
Inspired by Bruno's recursion argument for prod([]), here is one for det([]). By the Laplace expansion any determinant can be expressed as the sum of the elements of any row or column by their corresponding cofactors. These cofactors are the determinants found by deleting the row and column of the respective elements and multiplying by (1)^(i+j) where i and j are the column and row numbers of each element. This amounts to a recursion on the definition of a determinant.<br>
<br>
It is understood that the 1 x 1 determinant of any x is just x itself. Applying the recursion backwards to this case, the cofactor of x should be (1)^(1+1) = +1 times the determinant of the empty matrix. Hence the determinant of an empty matrix must always equal 1 in order that the Laplace expansion hold.<br>
<br>
Roger Stafford