How to inverse matrix and integer result in Octave?

The inverse of each element is:

x .^ -1

Which results

0.1111    0.0667
0.0526    0.5000

Why you want to get [22,17;25,21]? What mathematical operation would yield such result?


Invert a matrix in octave:

You are confused about what an inverse of a matrix is, don't nobody here knows what you want with your output, so here are some clues.

If you Invert an identity matrix, you get the identity matrix:

octave:3> a = [1,0;0,1]
a =

   1   0
   0   1

octave:4> inv(a)
ans =

   1   0
   0   1

Non-square matrices (m-by-n matrices for which m != n) do not have an inverse

x = [9,15;19,2;5,5]; 
inv(x) 
%error: inverse: argument must be a square matrix

Inverting a matrix with a zero on the diagonal causes an infinity:

octave:5> a = [1,0;0,0]
a =

   1   0
   0   0

octave:6> inv(a)
warning: inverse: matrix singular to machine precision, rcond = 0
ans =

   Inf   Inf
   Inf   Inf

Inverting a matrix with full values like this:

octave:1> a = [1,2;3,4]
a =
   1   2
   3   4

octave:2> inv(a)
ans =    
  -2.00000   1.00000
   1.50000  -0.50000

For a description of what is happening under the hood of the inverse function:

https://www.khanacademy.org/math/precalculus/precalc-matrices/inverting_matrices/v/inverse-of-a-2x2-matrix