Re: Matrix Inverse Issue
- To: mathgroup at smc.vnet.net
- Subject: [mg80600] Re: [mg80556] Matrix Inverse Issue
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sun, 26 Aug 2007 23:10:38 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200708260700.DAA03587@smc.vnet.net>
- Reply-to: murray at math.umass.edu
If A and B are matrices of the same size, then A B is NOT the matrix
product of A and B; rather, it is the matrix of that same size that you
get by multiplying corresponding elements of A and B. Multiplication of
numbers is Listable -- it extends to lists, and lists of lists, ...,
when their dimensions permit it.
The matrix product of two compatibly-sized matrices A and B is A.B,
shorthand for Dot[A,B].
So Mathematica gave you precisely what you asked for. What you wanted
-- and it could not read your mind -- is:
A = Table[If[j==i, 1-i/10, If[j==i+1, i/10, 0]], {i, 9}, {j, 9}];
A.Inverse[A]==IdentityMatrix[9]
True
(I used the test for equality with identity matrix there to spare
showing the multi-line output of the identity matrix.)
Brian Gladman wrote:
> I am having a problem with the matrix inverse for the following matrix in
> Mathematica 6:
>
> A = Table[If[j == i, 1 - i/10, If[j == i + 1, i/10, 0]], {i, 9}, {j, 9}]
>
> {{9/10, 1/10, 0, 0, 0, 0, 0, 0, 0}, {0, 4/5, 1/5, 0, 0, 0, 0, 0,
> 0}, {0, 0, 7/10, 3/10, 0, 0, 0, 0, 0}, {0, 0, 0, 3/5, 2/5, 0, 0, 0,
> 0}, {0, 0, 0, 0, 1/2, 1/2, 0, 0, 0}, {0, 0, 0, 0, 0, 2/5, 3/5, 0,
> 0}, {0, 0, 0, 0, 0, 0, 3/10, 7/10, 0}, {0, 0, 0, 0, 0, 0, 0, 1/5, 4/
> 5}, {0, 0, 0, 0, 0, 0, 0, 0, 1/10}}
>
> A Inverse[A]
>
> {{1, -1/72, 0, 0, 0, 0, 0, 0, 0}, {0, 1, -1/14, 0, 0, 0, 0, 0, 0}, {0,
> 0, 1, -3/14, 0, 0, 0, 0, 0}, {0, 0, 0, 1, -8/15, 0, 0, 0, 0}, {0,
> 0, 0, 0, 1, -5/4, 0, 0, 0}, {0, 0, 0, 0, 0, 1, -3, 0, 0}, {0, 0, 0,
> 0, 0, 0, 1, -49/6, 0}, {0, 0, 0, 0, 0, 0, 0, 1, -32}, {0, 0, 0, 0,
> 0, 0, 0, 0, 1}}
>
> I expected the identity matrix here but I get extra terms.
>
> Am I doing something wrong?
>
> Brian Gladman
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- Matrix Inverse Issue
- From: "Brian Gladman" <brg@nowhere.org>
- Matrix Inverse Issue