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

# Thread Subject: Determinant of a non-square matrix?

Subject: Determinant of a non-square matrix?

From: Joerg Buchholz

### Joerg Buchholz

Date: 1 Jul, 2010 05:39:05

Message: 1 of 11

Is there a determinant of a non-square matrix?

>> det ([sym('a'), sym('b')])

ans =

a

Subject: Determinant of a non-square matrix?

From: Jan Simon

### Jan Simon

Date: 1 Jul, 2010 09:15:20

Message: 2 of 11

Dear Joerg,

> Is there a determinant of a non-square matrix?
> >> det ([sym('a'), sym('b')])
> ans =
> a

How do you define "determinant of a non-square matrix" ?
As far as I know and after asking wikipedia I have the impression, that "determinant" are defined for square matrices only.

Jan

Subject: Determinant of a non-square matrix?

From: John D'Errico

### John D'Errico

Date: 1 Jul, 2010 09:37:04

Message: 3 of 11

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <i0h9lp$3t6$1@fred.mathworks.com>...
> Is there a determinant of a non-square matrix?
>
> >> det ([sym('a'), sym('b')])
>
> ans =
>
> a

No. Determinant has no mathematical definition for a
non-square matrix, at least not traditionally so.

There is one attempt to make such a definition, already
found on the file exchange. I recall that I strongly
disagreed with dett when the file was submitted, but
it does still exist on the FEX.

Why do you wish to use such a tool? If your goal is
simply to identify if the matrix is singular, then a
determinant is ALWAYS the WRONG thing to use!!!!
Any such determinant here will have numerical
problems, and will not reliably predict the singularity
status of your matrix in floating point arithmetic.
is found in every matlab installation. If rank returns
a number that is less than min(size(A)) for a given
matrix A, then A is numerically singular, and this is a
reliable test.

John

Subject: Determinant of a non-square matrix?

From: Faraz Afzal

### Faraz Afzal

Date: 1 Jul, 2010 09:49:04

Message: 4 of 11

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <i0hmb8$h3l$1@fred.mathworks.com>...
> Dear Joerg,
>
> > Is there a determinant of a non-square matrix?
> > >> det ([sym('a'), sym('b')])
> > ans =
> > a
>
> How do you define "determinant of a non-square matrix" ?
> As far as I know and after asking wikipedia I have the impression, that "determinant" are defined for square matrices only.
>
> Jan

Dears,

If you have a 2xn Rectangular matrix then you can find its determinant for sure.
I dont know if MATLAB can do this for you or not. But there is no problem them algorithm is simple enough to write in MATLAB .. For reference look through this paper appeared in EMIS (The European Mathematical Information Service) Journal.
Beiträge zur Algebra und Geometrie
Contributions to Algebra and Geometry
Volume 46 (2005), No. 1, 321-349.
May be you have a matrix in 2xn form then you have your problem solved.
Let me know if it helped.

Regards,

Subject: Determinant of a non-square matrix?

From: Jan Simon

### Jan Simon

Date: 1 Jul, 2010 10:32:04

Message: 5 of 11

Dear Faraz,

> If you have a 2xn Rectangular matrix then you can find its determinant for sure.

How?

> I dont know if MATLAB can do this for you or not. But there is no problem them algorithm is simple enough to write in MATLAB .. For reference look through this paper appeared in EMIS (The European Mathematical Information Service) Journal.
> Beiträge zur Algebra und Geometrie
> Contributions to Algebra and Geometry
> Volume 46 (2005), No. 1, 321-349.

Could you post the name of the article, please? Looking in the online service, I cannot find anything after the page 300:
http://www.emis.de/journals/BAG/vol.46/no.1/17.html

Jan

Subject: Determinant of a non-square matrix?

From: Joerg Buchholz

### Joerg Buchholz

Date: 1 Jul, 2010 10:47:03

Message: 6 of 11

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <i0hnk0$6nv$1@fred.mathworks.com>...
> "Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <i0h9lp$3t6$1@fred.mathworks.com>...
> > Is there a determinant of a non-square matrix?
> >
> > >> det ([sym('a'), sym('b')])
> >
> > ans =
> >
> > a
>
> No. Determinant has no mathematical definition for a
> non-square matrix, at least not traditionally so.
>
> There is one attempt to make such a definition, already
> found on the file exchange. I recall that I strongly
> disagreed with dett when the file was submitted, but
> it does still exist on the FEX.
>
> Why do you wish to use such a tool? If your goal is
> simply to identify if the matrix is singular, then a
> determinant is ALWAYS the WRONG thing to use!!!!
> Any such determinant here will have numerical
> problems, and will not reliably predict the singularity
> status of your matrix in floating point arithmetic.
> is found in every matlab installation. If rank returns
> a number that is less than min(size(A)) for a given
> matrix A, then A is numerically singular, and this is a
> reliable test.
>
> John

John,

I second every word you say! But - Matlab computes the determinant of a symbolic non-square matrix without the slightest warning (see my example). I just wanted to make sure that there is not a mathematically agreed definition of a non-square determinant before I file a bug report.

Joerg

Subject: Determinant of a non-square matrix?

From: Faraz Afzal

### Faraz Afzal

Date: 1 Jul, 2010 11:18:04

Message: 7 of 11

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <i0hqr4$sdb$1@fred.mathworks.com>...
> Dear Faraz,
>
> > If you have a 2xn Rectangular matrix then you can find its determinant for sure.
>
> How?
>
> > I dont know if MATLAB can do this for you or not. But there is no problem them algorithm is simple enough to write in MATLAB .. For reference look through this paper appeared in EMIS (The European Mathematical Information Service) Journal.
> > Beiträge zur Algebra und Geometrie
> > Contributions to Algebra and Geometry
> > Volume 46 (2005), No. 1, 321-349.
>
> Could you post the name of the article, please? Looking in the online service, I cannot find anything after the page 300:
> http://www.emis.de/journals/BAG/vol.46/no.1/17.html
>
> Jan

Hey Jan ..

I m sending you email but it is popping back. DNS requested is not being recognized..
I already attached the paper and sent it to Joerg.
If you have a direct access try this

Regards,

Subject: Determinant of a non-square matrix?

From: Jan Simon

### Jan Simon

Date: 1 Jul, 2010 11:45:06

Message: 8 of 11

Dear Faraz,

> I m sending you email but it is popping back. DNS requested is not being recognized..

There are some obviously more or less obvious changes in my email address.

Thanks! And the name of the article is "About a determinant of rectangular $2\times n$ matrix and its geometric interpretation", Mirko Radi'c

Jan

Subject: Determinant of a non-square matrix?

From: Joerg Buchholz

### Joerg Buchholz

Date: 1 Jul, 2010 12:34:04

Message: 9 of 11

Mirko Radic defined a determinant of a rectangular matrix in 1966:

http://www.zentralblatt-math.org/zmath/scans.html?volume_=168&count_=027

Nevertheless, Matlab does not use Mirko's definition to compute symbolic rectangular matrices. Matlab seems to returns the determinant of the left mxm submatrix of an mxn matrix if m<n:

>> a = [a11 a12 a13; a21 a22 a23]

a =

[ a11, a12, a13]
[ a21, a22, a23]

>> det (a)

ans =

a11*a22 - a12*a21

If m>n, Matlab throws an error:

>> a = [a11 a12; a21 a22; a31 a32]

a =

[ a11, a12]
[ a21, a22]
[ a31, a32]

>> det (a)
Error in MuPAD command: second index out of range [(Dom::Matrix(Dom::ExpressionField()))::_index]

Error in ==> sym.sym>sym.det at 1437

Subject: Determinant of a non-square matrix?

From: Faraz Afzal

### Faraz Afzal

Date: 1 Jul, 2010 12:56:04

Message: 10 of 11

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <i0i1vs$p0m$1@fred.mathworks.com>...
> Mirko Radic defined a determinant of a rectangular matrix in 1966:
>
> http://www.zentralblatt-math.org/zmath/scans.html?volume_=168&count_=027
>
> Nevertheless, Matlab does not use Mirko's definition to compute symbolic rectangular matrices. Matlab seems to returns the determinant of the left mxm submatrix of an mxn matrix if m<n:
>
> >> a = [a11 a12 a13; a21 a22 a23]
>
> a =
>
> [ a11, a12, a13]
> [ a21, a22, a23]
>
> >> det (a)
>
> ans =
>
> a11*a22 - a12*a21
>
> If m>n, Matlab throws an error:
>
> >> a = [a11 a12; a21 a22; a31 a32]
>
> a =
>
> [ a11, a12]
> [ a21, a22]
> [ a31, a32]
>
> >> det (a)
> ??? Error using ==> mupadmex
> Error in MuPAD command: second index out of range [(Dom::Matrix(Dom::ExpressionField()))::_index]
>
> Error in ==> sym.sym>sym.det at 1437

Thats true.. All the information is true.
But what my concern is if the information i have given helped u solving ur problem..
Let Matlab do tehre own procedures but as long as ur problem is concerned if u got 2xn matrix that page would be enough to solve ur problem..
Let me know if i helped you in any ways..
Regards,

Subject: Determinant of a non-square matrix?

From: Joerg Buchholz

### Joerg Buchholz

Date: 1 Jul, 2010 13:34:04

Message: 11 of 11

"Faraz Afzal" <farazafzal@gmail.com> wrote in message <i0i394$gmi$1@fred.mathworks.com>...
> Thats true.. All the information is true.
> But what my concern is if the information i have given helped u solving ur problem..
> Let Matlab do tehre own procedures but as long as ur problem is concerned if u got 2xn matrix that page would be enough to solve ur problem..
> Let me know if i helped you in any ways..
> Regards,

Thank you very much for your help!

I teach mathematics with Matlab's symbolic toolbox since a decade and want my students to trust the tool they are working with. Therefore, I filed some 20 or 30 bug reports since MuPAD became the "new" symbolic engine a few years ago, most of which have been taken care of (Thanks alot Mathworks!). In this case, I just wanted to know if anybody could explain Matlab's unexpected computation of determinants of rectangular matrices to me before I called it a bug.

Joerg