0

I am using octave and when I am writing this:

1/[1;2;3]

It returns the result as this:

ans = 0.071429   0.142857   0.214286

I can't understand this behavior, although I know the difference between '/' and './'.
I know './' refers to element wise division but how is '/' working in this case.

Reckoner
  • 151

2 Answers2

2

$1/[1;2;3]$ solves the system $x \cdot [1;2;3] = 1$ in the least-square sense.

Klaus
  • 10,578
1

Since the 'matrix' is not square, the inverse is not defined. In that case, Octave uses the pseudoinverse, which in this case is given by $\frac{1}{14}\begin{pmatrix}1&2&3\end{pmatrix}$.

molarmass
  • 2,014
  • 13
  • 16
  • The $/$-operator always solves a linear system and does not compute any inverses. While this is the same in exact arithmetic, there are differences in the stability. The same reason you should never use $x=A^{-1}b$ to solve $Ax=b$. – Klaus Mar 21 '19 at 12:11
  • Thanks for the answer. Though I really need to know why only square matrices have inverse and what are pseudo-inverse matrices, but I will study about those on my own now. Just needed a way. – Reckoner Mar 22 '19 at 09:01