Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
What is the determinant of [] ?

Subject: What is the determinant of [] ?

From: Greg Heath

Date: 25 Oct, 2010 07:10:43

Message: 1 of 17

I get

det([]) = 1

Is this reasonable?

This was discovered via x = magic(0) = [] when
I looking for a sequence of matrices for some
regression examples

:>> for i = 0:20, disp([ i det(magic(i))]),end
     0 1
     1 1
     2 -10
     3 -360
     4 0
     5 5070000
     6 0
     7 -348052801600
     8 0
     9 7.50357380590272e+016
    10 0
    11 -4.1037749689304e+022
    12 0
    13 4.61380654818195e+028
    14 0
    15 -9.58679544904057e+034
    16 0
    17 3.43347181141828e+041
    18 0
    19 -1.96249341949157e+048
    20 0

Greg

Subject: What is the determinant of [] ?

From: Nasser M. Abbasi

Date: 25 Oct, 2010 08:07:20

Message: 2 of 17

On 10/25/2010 12:10 AM, Greg Heath wrote:
> I get
>
> det([]) = 1
>
> Is this reasonable?
>

good question. It seems this is something not well defined becuase I
tried it on 2 other systems, Maple gave me back zero, and Mathematica
complained that the matrix was empty.

Mathematica:
------------------------------
In[1]:= Det[{{}}]

During evaluation of In[1]:= Det::matsq: Argument {At Line = 1, the
input was:,Det[{{}}],{{}}} at position {At Line = 1, the input
was:,Det[{{}}],1} is not a nonempty square matrix. >>

Out[1]= Det[{{}}]
------------------------------

Maple
with(LinearAlgebra):
v1:=Matrix(1,1,[]):
Determinant(v1);
                                0
-------------------------------


--Nasser

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 12:27:03

Message: 3 of 17

Greg Heath <heath@alumni.brown.edu> wrote in message <99996f6f-471e-49b6-9c95-a6ff3efed38b@j2g2000yqf.googlegroups.com>...
> I get
>
> det([]) = 1
>
> Is this reasonable?

Perfectly reasonable.

It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigen-values. In zero-dimension space the eigen value is empty, then the most logical is returning the neutral element.

Bruno

Subject: What is the determinant of [] ?

From: Matt J

Date: 25 Oct, 2010 14:19:04

Message: 4 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia3t2n$c7m$1@fred.mathworks.com>...
>
> Perfectly reasonable.
>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigen-values. In zero-dimension space the eigen value is empty, then the most logical is returning the neutral element.
========

Well, fair enough, but it can create some weird inconsistencies.

For example, we know that inv(1)=1 and by extension that

inv([1, []; [], []] ) =1

However, what about the theorem that says that

inv(A)= Adjucant(A)/det(A)

If A=[1,[];[],[]] and det([])=1 then shouldn't the adjucant of A be
[1,-1;-1,1]

Then according to the adjucant formula shouldn't

inv(A)=inv(1)=[1,-1;-1 1]

?

Subject: What is the determinant of [] ?

From: Mark Shore

Date: 25 Oct, 2010 14:40:07

Message: 5 of 17

> >
> > det([]) = 1
> >
> > Is this reasonable?
>
> Perfectly reasonable.
>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigen-values. In zero-dimension space the eigen value is empty, then the most logical is returning the neutral element.
>
> Bruno

This seems perilously close to defining 0/0 as 1. What would be wrong with NaN instead?

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 14:54:03

Message: 6 of 17

"Mark Shore" <mshore@magmageosciences.ca> wrote in message <ia44s7$l6p$1@fred.mathworks.com>...
> > >
> > > det([]) = 1
> > >
> > > Is this reasonable?
> >
> > Perfectly reasonable.
> >
> > It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigen-values. In zero-dimension space the eigen value is empty, then the most logical is returning the neutral element.
> >
> > Bruno
>
> This seems perilously close to defining 0/0 as 1. What would be wrong with NaN instead?

IMO, 0 has nothing remotely to do here. 1 is *the* neutral element of product.

Bruno

Subject: What is the determinant of [] ?

From: Matt J

Date: 25 Oct, 2010 16:38:03

Message: 7 of 17


Isn't this also a little weird?


>> isequal(prod([1 []]) , []*1)

ans =

     0

Subject: What is the determinant of [] ?

From: Sean

Date: 25 Oct, 2010 17:09:04

Message: 8 of 17

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4bpb$jid$1@fred.mathworks.com>...
>
> Isn't this also a little weird?
>
>
> >> isequal(prod([1 []]) , []*1)
>
> ans =
>
> 0

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:

A = magic(3)
A(5) = [];

Instead of the vector being returned, a matrix with an empty fifth spot would be.

Subject: What is the determinant of [] ?

From: Roger Stafford

Date: 25 Oct, 2010 17:54:04

Message: 9 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia3t2n$c7m$1@fred.mathworks.com>...
> Greg Heath <heath@alumni.brown.edu> wrote in message <99996f6f-471e-49b6-9c95-a6ff3efed38b@j2g2000yqf.googlegroups.com>...
> > I get
> >
> > det([]) = 1
> >
> > Is this reasonable?
>
> Perfectly reasonable.
>
> It's the same reason why prod([]) = 1. 1 is the neutral element of the (R,*). Determinant is the product of eigen-values. In zero-dimension space the eigen value is empty, then the most logical is returning the neutral element.
>
> Bruno
- - - - - -
  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.

  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 well-defined 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.

Roger Stafford

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 17:58:04

Message: 10 of 17

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4bpb$jid$1@fred.mathworks.com>...
>
> Isn't this also a little weird?
>
>
> >> isequal(prod([1 []]) , []*1)
>

[1 []] is 1, this is perfectly clear as Sean explained.

[]*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 [].

Therefore isequal(1,[]) is false.

Bruno

Subject: What is the determinant of [] ?

From: Matt J

Date: 25 Oct, 2010 18:17:04

Message: 11 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4gfc$lj4$1@fred.mathworks.com>...
>
>
> [1 []] is 1, this is perfectly clear as Sean explained.
>
> []*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 [].
========

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
as prod([1,2]) is the same as 1*2.

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 18:33:05

Message: 12 of 17

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4hj0$3qk$1@fred.mathworks.com>...

>
> 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
> as prod([1,2]) is the same as 1*2.

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.

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.

Bruno

Subject: What is the determinant of [] ?

From: Steven_Lord

Date: 25 Oct, 2010 18:39:44

Message: 13 of 17



"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message
news:ia4hj0$3qk$1@fred.mathworks.com...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message
> <ia4gfc$lj4$1@fred.mathworks.com>...
>>
>>
>> [1 []] is 1, this is perfectly clear as Sean explained.
>>
>> []*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 [].

Yes. In this particular case scalar expansion is not really performing
"expansion" but contraction, but we still call it scalar expansion.

> 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
> as prod([1,2]) is the same as 1*2.

Ah, but the commands "prod([1 ones(2)])" and "ones(2)*1" do not have the
same behavior, and each has (IMO) the correct behavior; the former throws an
error while the second returns ones(2).

IF x is a scalar value, then prod([1 x]) and x*1 should return the same
result. If not, they may not. Is [] a scalar value?

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 18:41:07

Message: 14 of 17

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:

function p = myprod(a)

if length(x)==0
    p = ???
else
    p = myprod(a(1:end-1))*a(end)
end

Bruno

Subject: What is the determinant of [] ?

From: Matt J

Date: 25 Oct, 2010 18:47:05

Message: 15 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4ih1$4j8$1@fred.mathworks.com>...
>
> 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.
>
> 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.
========

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

prod([1,[]])=prod(1)*prod([])

and

sum([1,[]])=sum(1)+sum([])

valid and consistent with behavior for non-[] arguments.

Subject: What is the determinant of [] ?

From: Bruno Luong

Date: 25 Oct, 2010 18:59:04

Message: 16 of 17

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4jb9$rsq$1@fred.mathworks.com>...

> 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
>
> prod([1,[]])=prod(1)*prod([])
>
> and
>
> sum([1,[]])=sum(1)+sum([])

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.

That the reason prod([]) is logically 1. Another way to confirm the logic is

prod(a) = exp(sum(log(a)))

Is A is empty, log(A) is empty, sum([]) is 0 (because 0 is neutral element of +), and finally prod([]) = exp(0) = 1.

Bruno

Subject: What is the determinant of [] ?

From: Roger Stafford

Date: 25 Oct, 2010 20:24:04

Message: 17 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ia4k1o$dva$1@fred.mathworks.com>...
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ia4jb9$rsq$1@fred.mathworks.com>...
>
> > 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
> >
> > prod([1,[]])=prod(1)*prod([])
> >
> > and
> >
> > sum([1,[]])=sum(1)+sum([])
>
> 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.
>
> That the reason prod([]) is logically 1. Another way to confirm the logic is
>
> prod(a) = exp(sum(log(a)))
>
> Is A is empty, log(A) is empty, sum([]) is 0 (because 0 is neutral element of +), and finally prod([]) = exp(0) = 1.
>
> Bruno
- - - - - - - -
  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.

  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.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us