box% sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 2020-10-24 │ │ Using Python 3.8.6. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: A = matrix([[0,0,-3],[1,0,6],[0,1,-3]]) sage: A [ 0 0 -3] [ 1 0 6] [ 0 1 -3] sage: A.characteristic_polynomial() x^3 + 3*x^2 - 6*x + 3 sage: (1/A^2) [ 3 2 1] [-7/3 -1 0] [-2/3 -1/3 0] sage: (1/A^2).characteristic_polynomial() x^3 - 2*x^2 + 7/3*x - 1/9