My niece has shown me a problem for her advanced high school algebra class that I am personally finding fascinating, regarding the proof (or lack thereof) of the commutativity of a particular arbitrarily defined binary operator (basically, a randomly defined operator just for the sake of an interesting homework problem).
(This is not a homework-tag question; as a programmer I am personally interested in this.)
Here is the operator:
Define
a # b(aandbare positive integers) such that#is a binary operator that reverses the (decimal) digits of positive integera, adds the reversed number so obtained to positive integerb, then adds up the (decimal) digits of the result of this addition.If the result has more than one (decimal) digit, add these digits together to obtain a new result, and repeat until only one digit remains.
(NOTE: I added the final sentence of the above definition after seeing @angryavian's answer, below - the final sentence was not in the original problem, but we noticed that commutativity applies when the final sentence is added to the definition of the operator.)
Putting in a number of various examples has always worked, so that it seems from examples that # is commutative. For example, a = 791, b = 907 results in:
a # b = 791 # 907 -> 197 + 907 = 1104 --> 6
b # a = 907 # 791 -> 709 + 791 = 1500 --> 6
... Other random examples also work, such as a = 1348, b = 26935.
As a programmer, I could write a simple program that creates an iterative loop (involving taking the modulus base 10 until no more digits remain) just to test any combination of numbers. But, proving the commutativity of this operator is another story.
It strikes me as unintuitive that such an arbitrary operator as this would turn out to be commutative, but every combination of numbers we've tried results in the same value when a and b are reversed.
I do not yet have a sense of how to go about actually proving this (assuming it's true).
How would one go about proving that this operator # is commutative? (Assuming that it is, indeed, commutative and that the numbers we've tested aren't just coincidentally commutative.)
(1348, 26935)example to work). I will modify the question to indicate this. – Dan Nissenbaum Sep 22 '14 at 02:13