I'll assume $a$, $b$ and $x$ to be distinct.
The trick for computing the composition of permutations is to start from an arbitrary element, say $x$, and follow its image under the permutations to compose; then write the final element next to $x$ and go on. If an element doesn't appear in a cycle, it is fixed by it. The image of an element under a cycle is the element next to it (on the right) or the initial one if at the right there's a ).
For instance, the cycle $(xa)$ represents the permutation that sends $x$ to $a$, $a$ to $x$ and leaves all other elements fixed.
Depending on conventions you start from the left or from the right; when composition of functions is the usual one, one starts from the right; so with $(xb)(xa)$
$x\mapsto a\mapsto a$
$a\mapsto x\mapsto b$
$b\mapsto b\mapsto x$
When we get back to the element we started with, we stop the cycle and start again if there's still an uncovered element. In this case we obtain the cycle $(xab)$.
If we consider $(xa)(ab)$ we get
$x\mapsto x\mapsto a$
$a\mapsto b\mapsto b$
$b\mapsto a\mapsto x$
So the composition is again the cycle $(xab)$ and we've proved equality.