Solve this math puzzle. Then explain it to me.
August 28, 2007 12:23 PM   Subscribe

Math puzzle filter. How do you go about solving this puzzle?

In the back of Scientific American Mind (SAM), there is a math puzzle that states:

"Each letter stands for a different digit. Determine their values to solve the subtraction problem.


I worked on this for an embarrassing number of hours yesterday, but didn't get a solution. SAM gives the solution at the bottom of the page, but I am more interested in understanding what math principles one must utilize in order to solve this problem or similar ones.

I am not a mathematician, so explanations that don't employ calculus or other mathematical esoterica are preferred.


If you are reading this and need to know if you've got the right answer to the problem, I include it below (highlight to see):

A = 7, E = 1, N = 6, T = 4
posted by batcrazy to Education (25 answers total) 2 users marked this as a favorite
I'm no math expert by any means whatsoever, but I would look at this as four separate algebra problems where:

A - E = N
N - T = E
T - N = A
E - A = T

Just looking at it, it might seem that A needs to be bigger than E, so that N wouldn't be a negative number. Also, N and T need to be bigger than E so that they can equal E when subtracted from each other.

That's as far as I get. My brain hurts.
posted by iamkimiam at 12:33 PM on August 28, 2007

There are no specific math principles involved other than noticing patterns and making deductions.

For example, I can see that A>E otherwise NEAT would be negative. But E-A is also the last digits which resolves to T. But there must be a carry and so really we have E+10-A=T and so on...

A fuller example is here.
posted by vacapinta at 12:33 PM on August 28, 2007


That is where I began, but you notice that those algebraic expressions don't actually work for the correct solution.

I pretty quickly went from your expressions to:

(E + 10) - A = T

(T - 1) - N = A

(N + 10) - T = E

(A - 1) - E = N

To account for carrying the one in the two digit subtractions.

I also deduced that T > A > N > E, but once I got here, I didn't have a lot of luck substituting in numbers for any of my expressions to help me solve this (other than the brute force method).

I thought maybe there was a correlation between AN - ET = NE and TE - NA = AT that I could have used to help solve the problem, but I couldn't figure out how to express it.

(And, for the record, I have *pages* of freaking jumbled notes on this from yesterday, so my brain hurts too. But, it did pass the time on my 2 hour flight pretty nicely.)
posted by batcrazy at 12:44 PM on August 28, 2007

I don't think you can safely assume any but the first (IE: A-E=N).

What you're really trying to do is solve the equation:

1000A + 100N + 10T + E - 1000E - 100T - 10N - A = 1000N + 100E + 10A + T

You can use A-E=N.

You have constraints:

A,N,E,T are all < 10,br> A,N,E,T are all >= 1, and are integers.

There may be a few more, which you could use to solve this mathematically.
posted by Comrade_robot at 12:46 PM on August 28, 2007

The trick to these kinds of find the digits problems is remembering that ANTE = (1000*A + 100*N + 10*T + E). So iamkimiam's equations will give you problems when the digits sum to over ten (you lose the "carry the one").

So you write out all ANTE - ETNA = NEAT (or better yet ANTE + NEAT = ETNA) in the form above, with each digit multiplied by it's place, tens, hundreds, thousands. Then you can work the problem.
posted by Pastabagel at 12:48 PM on August 28, 2007

Or do what Comrade_robot said two minutes before I did.
posted by Pastabagel at 12:49 PM on August 28, 2007

These are logic puzzles which use very basic mathematic principles. The challenge is realizing what principles are relevant.

For example, we can assume that neither A, E nor N are zero since they are leading numbers. Similarly, we can assume that T isn't 0, because that would mean E and A are the same value (because they're subtracted from each other in the ones column to get T). So none of these letters can be zero.

Next, we know that A must be bigger than E, since subtracting one from the other gives you N. So A can't be 1. (It also can't be 2, because the only number smaller than 2 is 1, and subtracting 1 from 2 leaves 1--a duplicate number.)

You continue to make these little logical leaps until you've narrowed down the pool of possible answers to a manageable amount and then start plugging them in until you get the right answer.

The challenge is to come up with principles that are true about the puzzle, and to avoid making mistakes like this:

A - E = N
N - T = E
T - N = A
E - A = T

This fails to take "carrying" into account and is easily disproved by substituting the correct values.

Sorry, iamkimiam... and on preview, what everyone else said
posted by turaho at 12:49 PM on August 28, 2007

Well, you won't find calculus or much esoterica to solve these kinds of puzzles.

Usually, one looks for cribs in the position. E.g.,

Means "Z" has to be "1". Nothing else could fit. Look for patterns, where they exist.

This puzzle is harder for finding patterns than one using addition or multiplication, because subtraction doesn't have the commutative property. 6 - 4 not equal 4 - 6 .

You can piece the rules together by making a few simple rules and then testing them on the rest.

For any position, it's possible to borrow, so there are two possibilities for the first part. Start from the left, and let's treat each letter as a real variable.

(not borrowing at the first position)
E - A = T and T - N = A
(borrowing at the first position)
(10+E) - A = T or (T-1) - N = A

And so on. Work out the next level/branch, N,T,E, and try substituting a few numbers and see what works.
posted by cmiller at 12:51 PM on August 28, 2007

HAHAHA. I was soooo in over my head. I think I'll stick to answering the art and surfing questions on Ask Metafilter. I wonder how many non-mathbrains approached this like I did though?
posted by iamkimiam at 12:55 PM on August 28, 2007

Oh, and if it's not obvious, I mean those rules to applied against themselves.

So, e.g.

E - A = T and T - N = A
E - (T - N) = T
E - A = A - N
posted by cmiller at 1:02 PM on August 28, 2007

Wow, thanks Pastabagel and comrade_robot. Very cool.
posted by billysumday at 1:03 PM on August 28, 2007

It's definitely possible to do this mathematically with a few logical givens. As others have said, A must be greater than E. Start with that, and the broken out equation (1000A + 100N +...).

To do it mathematically you need as many equations as there are variables. The problem is whether T > N or N > T. So, you can set up two systems of equations (one for each option) and solve both to see which one works.

Set One gives you:
(T-1) - N = A
10 + N - T = E
A - 1 - E = N

Set Two gives you
10 + (T-1) - N = A
N - 1 - T = E
A - E = N

From there it's simple substitution (or matrix algebra if you're so inclined).
posted by backseatpilot at 1:30 PM on August 28, 2007

Since comrade_robot and pastabagel chimed in with the right technique in this case, I'll just say that this is a particular example of a broad class of problems called Diophantine equations. Given a polynomial with some number of unknowns (in this case, N,E,A, and T), one asks if there are any solutions where all of the unknowns are integers. The polynomial in question here is the one that comrade_robot wrote down. Diophantine equations have turned out to be connected to quite a few interesting and deep questions in mathematics, for instance Fermat's Last Theorem.
posted by Schismatic at 1:34 PM on August 28, 2007

just for fun, you can also do this easily in a program with list comprehensions (here i'm using erlang):

> [[A,E,N,T] || A <- lists:seq(1,9), E <- lists:seq(1,9), N <- lists:seq(1,9), T <- lists:seq(1,10), (A*1000+N*100+T*10+E)-(E*1000+T*100+N*10+A)==(N*1000+E*100+A*10+T)].
> [[7,1,6,4]]
posted by andrew cooke at 1:39 PM on August 28, 2007

Diophantine equations

AKA the plague of first-year math students. Probably the only time they thought they should have enrolled in engineering instead.

And like andrew cooke's erlang example, this is trivally solvable in prolog, which I forgot several days after I learned it.
posted by GuyZero at 1:51 PM on August 28, 2007

You know, I don't actually think I set this up correctly, and I think backseat pilot has the right approach.

You have to approach this problem deductively, or logically.

For example, in the 'ones' place, you have:
1) E - A = T, if E greater than A
2) E+10 - A = T, if E less than A

but if E is greater than A, the answer to the whole equation would have to be negative, because in the thousands place AT MOST you have A - E = N. If N is positive, E cannot be greater than A, so choice (1) is out.

If choice (2) is true, you got the extra 10 from taking 1 from the T in the tens place. In other words, in the tens place it must be true that:

(3a) T - 1 - N =A, if T greater than N
(4a) T-1 + 10 - N = A, if T less than N

But if (3) is true, then in the hundreds place the (n,t,e_ N is going to have to borrow a ten, so you will have
(3b) 10+N-T=E, and
(3c) A-1-E=N

This is where backseatpilot gets those sets.


(4b) N-1-T=E, and
(4c) A-E=N

So now you have two seperate sets of 4 equations each:
(2), (3a), (3b), and (3c) OR
(2), (4a), (4b), and (4c)

Use basic algebra to isolate variables on both sets, and you'll discover that the set based on (3) (where T is greater than N) will result in fractional solutions or negative solutions, both of which violate the rules that all the letters have to be positive integers.

Working the second set (T less than N) results in the correct answer.

So my approach above may get the answer eventually, using more sophisticated math, but backseatpilot had it right.
posted by Pastabagel at 2:34 PM on August 28, 2007

If I may piggyback off of comrade_robot and pastabagel, then the simplified equation becomes:

999A + 90 N - 90 T - 999E = 1000N + 100E + 10A + T

Where does one go from here, other than guessing?

Also, I can see I made two errors in my original thinking--
The order of the numbers from greatest to least, because I didn't posit that one would have to carry a one to the "T" in ante in order to come up with a positive number.

So my equations should look like:

(E + 10) - A = T
(T + 9) - N = A *T -1 when carrying for the ones place, plus 10 when carrying from the 100's place.*
(N - 1) - T = E OR (N +9) - T = E
(A -1) - E = N OR A - E = N

posted by batcrazy at 4:19 PM on August 28, 2007

Thanks for breaking it down more pastabagel--I should have hit refresh before reposting. :)
posted by batcrazy at 4:28 PM on August 28, 2007

There's a very basic solution to this puzzle:

10 FOR A=0 TO 9
20 FOR N=0 TO 9
30 FOR T=0 TO 9
40 FOR E=0 TO 9
50 ANTE=A*1000+N*100+T*10+E
60 ETNA=E*1000+T*100+N*10+A
70 NEAT=N*1000+E*100+A*10+T

There. Can't get more basic than that.
posted by aeschenkarnos at 5:26 PM on August 28, 2007

D'oh! make that 1 to 9. Otherwise it craps out at 0000.

That's what I get for using skills twenty years out of date. Oh well, at least it's easier on the back than falling off a skateboard.
posted by aeschenkarnos at 5:34 PM on August 28, 2007

ante=7641 or 0 (either work)
I used to think. Now I just type:
        int a,n,t,e,ante,etna,neat;
        for(a= 0; a<9 ; a++)br>
        for(n= 0; n<9 ; n++)br>
        for(t= 0; t<9 ; t++)br>
        for(e= 0; e<9 ; e++){br>
                ante= 1000*a + 100*n + 10*t + e;
                etna= 1000*e + 100*t + 10*n + a;
                neat= 1000*n + 100*e + 10*a + t;
                if(ante-etna==neat)printf("%d\n", ante);

posted by hexatron at 6:26 PM on August 28, 2007


That's the problem with my first post. You break it out, but you don't have anymore equations to work with. As someone noted, you need a system of X equations to solve X variables.

The reason I automatically started in with the 1000*E, etc approach is because that's the way you break down those goofy magic trick math problems ("Take your age, add 7, subtract the digits blah blah did you get 6? See, magic!"). When I first saw this, I just assumed that's what it was.
posted by Pastabagel at 6:43 PM on August 28, 2007

I solved it doing this:

In the thousands place we notice N + E + [1] = A

That [1] means there's a potential carry we'll deal with later.

This implies E < a, which implies there's a carry in the place (when you add two numbers and get something less you carried)br>
So now substitute the thousands place equation into the ones place:

N + E + T + [1] = 10 + E

Lets deal with that carry now by assuming one way or the other.

Case 1
N + T = 10 and N > T


Case 2
N + T = 9 and N < tbr>
I'm using the same logic in the hundreds place to check for a carry.

Now just table things out:
Case 1
N + T = 10. N > T
N 8 7 6
T 2 3 4

from the tens place:
A + 1 + N = 10 + T -> A = 9 + T - N
so we can fill in A
N 8 7 6
T 2 3 4
A 3 5 7

We use T + A to calculate 1E

At this point two of our columns become invalid, and the only viable solution for this case is:

N:6 T:4, A:7, E:1

Which turns out to be the right answer (we would have had to investigate Case 2 if none of these worked out.
posted by onalark at 7:43 PM on August 28, 2007

I'm late to the party, but I did it by first rephrasing it as an addition problem(NEAT + ETNA = ANTE).

Then I took the eight (two to the third) cases of whether each column carried or not.

I set up eight systems of equations in this form:
T + A = E + [(if Carry0) 10]
A + N + [(if Carry0) 1] = T + [(if Carry1) 10]
E + T + [(if Carry1) 1] = N + [(if Carry2) 10]
N + E + [(if Carry2) 1] = A

Then tried solving all eight possibilities by back substitution. The winner was '1 1 0', that is, Carry0 and Carry1 are true.

So, kinda brute-forcey, but the nice thing about this approach is it will solve the problem in general { Though it grows faster than 2^n, (where n is the number of digits) so isn't going to be practical for very long. }
posted by blenderfish at 10:55 PM on August 28, 2007

This is probably not the "right" way to do this, but this is my brute force / intuition method -- the natural way I'd solve this. Now with unnecesary algebraic details!

I'll assume that all four letters refer to distinct single digits. I'm also going to guess that none of them are 0.
A > E, otherwise we'd need a negative sign. My intuition would be that N > T, as well, although it would be possible for the top N to borrow from the leftmost A, but that seems awkward. Let's try N > T first.

Column 4: E - A = T -- but A > E, so we need to borrow from the third column. This is really 10 + E - A = T.
Column 3: T - N = A -- but 1 was borrowed, so this is really T - 1 - N = A. AND N > T, so we need to borrow again. This becomes 10 + T - 1 - N = A.
Column 2: N - T = E -- but 1 was borrowed, so this is really N - 1 - T = E.
Column 1: A - E = N

So we have four equations, and four variables. Excellent.

N = A - E
E = N - T - 1
A = T - N + 9
T = E - A + 10

Since N = A - E, let's substitute that into the other three:

(A - E) - T - 1 = E
-> A - T - 1 = 2E
-> A = 2E + T + 1
T - (A - E) + 9 = A
-> T + E + 9 = 2A
-> E = 2A - T - 9
T = E - A + 10

Next, let's substitute A into the remaining two:

E = 2(2E + T + 1) - T - 9
-> E = 4E + T - 7
-> T = 7 - 3E
T = E - (2E + T + 1) + 10
-> T = E - 2E - T - 1 + 10
-> E = 9 - 2T

Finally, let's substitute T in and solve for E:

E = 9 - 2(7 - 3E)
-> E = 9 - 14 + 6E
-> 5E = 5
-> E = 1

Then you just substitute known values back into earlier equations:

T = 7 - 3E
-> T = 4
A = E - T + 10
-> A = 7
N = A - E
-> N = 6
posted by coined at 3:58 PM on August 29, 2007

« Older Remote background GUI login to OSX?   |   University of Graphic Design? Newer »
This thread is closed to new comments.