from sympy import * x, y, z, t = symbols('x y z t') n = Matrix([[x, 1 / t], [t, x * x]]) copie = n * n n = n + 3 * Matrix([[1, 0], [0, 1]]) n = pow(n,2) n = n - copie print(n) print(simplify(n))