My guess is that this type of question is more about problem solving technique, and demonstrating some cool number tricks, rather than the arithmetic.
So, if we look at the examples we see:
21 - 12 = (2 - 1) * 9 = 9
710 - 170 = (7 - 1) * 90 = 540
So, the first part of the pattern is that for the flipped digits a subtraction is performed: i.e. given ab - ba then the first operation is (a - b).
The second part of the pattern is that the result of (a - b) is multiplied by 9 * 10^n where n is determined by the number of digits after ab.
So, in the trickiest case:
2729 - 2279
we would solve as:
2ab9 - 2ba9 (where a = 7, b = 2)
1 digit (the number 9) after ab so n = 1
which gives:
2ab9 - 2ba9 = (a - b) * 9 * 10^n = (7 - 2) * 90 = 450