solving matrix equation

Could anyone please tell me how to solve a matrix equation? In the following code I have an extremely complicated matrix O. But I know that the matrix O equals to P. (I'm deriving what textbook didn't and the textbook said that they are same.)

The command t.full_simplify() tries to simplify t as much as possible and return the result. The rest of the line is the application to the list of matrix coefficients O.list(), and then rebuilding the matrix ; O.parent() is the space of matrices of the correct size over the correct ring. This matrix space can swallow the list and give back a matrix. This could also be done more simply using