Let me describe three constructions of matrices which are similar to their inverses over Z. It has little to do with SageMath. That is rather linear algebra.

**Construction 1:** There are infinitely 2x2 matrices with integral coefficients that are similar over Z to their inverses

```
sage: A = matrix(2, [1,1,0,1])
sage: B = matrix(2, [1,0,1,1])
sage: P = matrix(2, [-1,0,0,1])
sage: C1 = A
sage: C2 = B
sage: C3 = A * B * A
sage: all(P * C * P**-1 == C**-1 for C in [C1, C2, C3])
True
```

You can just build your 6x6 matrix M as a block matrix

```
sage: M = matrix(ZZ, 6)
sage: M[0:2,0:2] = C1
sage: M[2:4,2:4] = C2
sage: M[4:6,4:6] = C3
sage: Q = matrix(ZZ, 6)
sage: Q[0:2,0:2] = Q[2:4,2:4] = Q[4:6,4:6] = P
sage: Q * M * Q**-1 == M**-1
True
```

**Construction 2:** The companion matrix of a symmetric polynomial

```
sage: x = polygen(ZZ, 'x')
sage: a = 13
sage: b = 25
sage: c = 18
sage: M = companion_matrix(X**6 + a*X**5 + b*X**4 + c*X**3 + b*X**2 + a*X + 1)
sage: S = SymmetricGroup(6)
sage: P = S('(1,6)(2,5)(3,4)').matrix()
sage: P * M * P**-1 == M**-1
True
```

**Construction 3:** Permutation matrices

```
sage: S = SymmetricGroup(6)
sage: M = S('(1,2,3,4)(5,6)').matrix()
sage: P = S('(1,4)(2,3)').matrix()
sage: P * M * P**-1 == M**-1
True
```

The identity matrix.

Maybe you can compare the characteristic polynomial of a matrix with the one of its inverse and try to find when the two are equal?

ok.can we have at least one such example?

On the diagonal put pairs of numbers which are each other's inverse, like 2 and 1/2.

Does this question have anything to do with SageMath?