
T[Q_,x_,y_] := {{Cos[Q], -Sin[Q], x}, {Sin[Q], Cos[Q], y}, {0, 0 ,1}};
T01=T[Q1,0,0]; MatrixForm@T01
T02=T(Q2, xB,0]; MatrixForm@T02
T10=Simplify@Inverse[T01]; MatrixForm@T10
T12=Simplify[T10.T02]; MatrixForm@T12
I have this exercise and in my last output (output[65]) I want collect "THETA1" (in the image and "Q" in the code) in this way: 
I don't know how to do it. Someone can hep me?