Well, say A is nondegenerate, then B's matrix elements are all diagonal in A's representation
You can see it quite fast, by sandwiching the commutator between two basekets.
Well considering A as nondegenerate might not help, because it switches A and B in the problem...
Writing it as:
T^{\mu\nu}=\partial^{\mu}\phi\partial^ {\nu}\phi-\eta^{\mu\nu}L
should make you see it directly.
Your metric is always symetric, and \partial^{\mu}\phi\partial^ {\nu}\phi=\partial^{\nu}\phi\partial^{\mu}\phi.
Probably posting your integration helps others to spot your mistakes.
if you really do not see it on your own.
Well you probably remember cos^2 + sin^2 = 1, so integrating over full peroids of a sine squared (or cosine squared) gives you half of the peroid length.