0

if A is a nxn matrix, then in octave, pinv(A) represent inverse of A. pinv(A)*A should then yield Identity matrix I(n). But the following code is not working.

A=[ 1 2 3,
4 5 6,
7 8 9];

pinv(A)*A


0.83333   0.33333  -0.16667
0.33333   0.33333   0.33333
-0.16667   0.33333   0.83333

The diagonal elements , (pinv(A)*(A))[i,i] for i=1,2,3 are not even near to one.What went wrong?

Vikranth Inti
  • 111
  • 1
  • 2
  • 8
  • Is it true that pseudo inverse of a matrix(nxm dimension, n may not be equal to m) is the general case of inverse of a square matrix? If so, the above diagonal elements should be close to 1? or for two matrices A,B, in octave , is it possible that : A*B*B=B even if A is not the inverse of B? – Vikranth Inti Nov 01 '15 at 14:49

2 Answers2

1

Try use inv(A) function and you will get very useful information:

 >> inv(A)
 warning: matrix singular to machine precision, rcond = 1.54198e-018

Matrix A is not invertible! It is singular. Try change matrix A:

>> A=[ 10 2 3; 4 5 6; 7 8 9]
A =
10    2    3
4    5    6
7    8    9
>> inv(A)*A
ans =
 1.00000   0.00000   0.00000
-0.00000   1.00000   0.00000
 0.00000   0.00000   1.00000
>> pinv(A)*A
ans =
 1.0000e+000  -2.2204e-016  -4.4409e-016
-1.7764e-015  1.0000e+000  -3.5527e-015
 5.3291e-015  5.3291e-015  1.0000e+000
SergV
  • 1,269
  • 8
  • 20
0

pinv() returns the pseudo-inverse.

Moore–Penrose pseudoinverse

Daniel Severo
  • 1,768
  • 2
  • 15
  • 22