# 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.)

```
var('theta, phi, psi, omega_1, omega_2, omega_3, t, f, g, h') #Variables are defined.
theta=function('theta')(t); phi=function('phi')(t); psi=function('psi')(t);
R1=matrix([[cos(phi), sin(phi),0],[-sin(phi), cos(phi), 0],[0, 0, 1]])
R2=matrix([[1,0,0],[0, cos(theta), sin(theta)],[0, -sin(theta), cos(theta)]])
R3=matrix([[cos(psi),sin(psi),0],[-sin(psi),cos(psi),0],[0,0,1]])
P=matrix([[0,omega_3,-omega_2],[-omega_3, 0, omega_1],[omega_2, -omega_1, 0]])
R=R3*R2*R1
R_T=R.T; R_dev=R.derivative(t)
O=R_dev*R_T
view(O)
```

assuming that O==P, How can I obtain the omega_1, omega_2, omega_3 as function of theta, phi, psi, t?