A perfect digit-to-digit invariant is like a secret code that always stays the same, no matter what numbers you use. Imagine you have two numbers, like 24 and 36. If you add up the digits of each number, you get 2+4=6 and 3+6=9. Now, if you subtract the smaller number's digit-sum from the larger number's digit-sum, you get 9-6=3.
That number 3 is the perfect digit-to-digit invariant for these two numbers. It always stays the same no matter what other numbers you use. So, if you had 15 and 58, the digit-sums would be 1+5=6 and 5+8=13. If you subtracted the smaller from the larger, you would get 13-6=7.
And guess what? 7 is the perfect digit-to-digit invariant for these two numbers! So you can see how this code always stays the same, even if you use different numbers. Cool, huh?