### Math Problem Cracked, Part 2

As you recall from my blogpost a few days ago, I found a few solutions to the following fun math problem:

*Solve this problem, using each of the digits 1 through 9 exactly once:*

*_ _ _ + _ _ _ – _ _ _ = 0*

***Note: There’s more than one answer. Can you come up with all of them?? Or at least one of them?***

I noticed that the digits of the largest of the three numbers always added to 18, and I set about trying to prove unequivocally that in ALL solutions to this problem, the largest number’s digits must add up to 18.

Well…I finally did it! Here’s the proof:

*I called the hundreds digits of the smaller two numbers a1 and a2, then b1 and b2 for the tens, then c1 and c2 for the units. Then I called the hundreds, tens, and units digits of the biggest number x, y, and z, respectively.*

*So it looks like this:*

*a1b1c1
+ a2b2c2
———-
= x y z , where each is a distinct digit 1 through 9*

*The formal equation would be…
*

**Equation 1: **

**100(a1 + a2) + 10(b1 + b2) + (c1 +c2) = 100x + 10y + z, where each variable is a distinct digit 1 through 9.**

*It’s also true that…*

*Equation 2:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) + x + y + z = 45*

*(since the first 9 positive integers add up to 45)*

*First, I’m going to prove by contradiction that we can have one and only one column in which we’ll end up carrying a 1 (you’ll see why later)…*

*And for the record, only a 1 can end up being carried, because the greatest possible total for a column happens if the second column is 8 + 9 plus a carried 1, which is less than 20.*

*We can’t end up carrying three 1s, since the hundreds column won’t add up to anything 10 or greater. That means we can potentially carry zero, one, or two 1s.*

*So, let’s assume we never carry a 1. That means that:*

*a1 + a2 = x
b1 + b2 = y
c1 + c2 = z*

*Combine those to form:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) = x + y + z*

*But we know from Eq. 2 that:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) + x + y + z = 45*

*That would mean that x + y + z = 22.5*

*But we know that x, y, and z are all integers, so they can’t add up to a non-integer, and we therefore have a contradiction.*

*Similarly, let’s assume we carry two 1s. That means that:*

*a1 + a2 = x – 1
b1 + b2 = (y + 10) – 1 = y + 9
c1 + c2 = z + 10*

*Combine those to form:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) = x + y + z + 18*

*Again, from Eq. 2, we know that:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) + x + y + z = 45*

*That would mean that x + y + z = 13.5, and we have the same contradiction.*

*So we know that the only option is to have one and only one column in which we’ll end up carrying a 1.*

*Okay, with that out of the way…*

*Since there is only one column in which a 1 is carried, there are two scenarios:*

*1. b1 + b2 > 10, in which case, the one would carry to the hundreds column, and:*

*a1 + a2 = x – 1
b1 + b2 = y + 10
c1 + c2 = z*

*2. c1 + c2 > 10, in which case, the one would carry to the tens column, and:*

*a1 + a2 = x
b1 + b2 = y – 1
c1 + c2 = z + 10*

*In both cases, the resulting combined equation is:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) = x + y + z + 9*

*Substitute in Eq 2:*

*(a1 + a2) + (b1 + b2) + (c1 + c2) + x + y + z = 45*

*(x + y + z + 9) + x + y + z = 45*

*2(x + y + z) = 36*

*x + y + z = 18 !!!!!!!!!!!!!!!!!!!!*

*Done and done!!!!*

Epilogue: In that last blogpost, I also listed the 34 three-digit numbers that I thought fit as solutions:

*981 972 963 954 945 936 927 918
891 873 864 846 837 819
792 783 765 756 738 729
693 684 675 657 648 639
594 576 567 594
495 486 468 459*

It turns out that four of them (765, 756, 684, 576) don’t work for some reason. The other 30 do, and I showed in the blogpost why each of those 30 has four unique solutions:

“*For each one of these, there are 4 unique ways to solve the problem (or 8, if you discount additive commutativity). This is because you can switch the hundreds, tens, and units digits of the two smaller numbers. For example:*

*235 + 746 = 981
236 + 745 = 981
245 + 736 = 981
246 + 735 = 981*

*746 + 235 = 981
745 + 236 = 981
736 + 245 = 981
735 + 246 = 981*

*I’m guessing most wouldn’t count the second four as unique solutions.”*

So, with 30 possibilities for the largest number and 4 unique solutions each, there are 120 unique solutions to this problem.

I guess the only thing left to do is prove just why the aforementioned four numbers don’t work.

But this was fun! It was nice to re-exercise my logic prowess.

## Leave a Reply