I have already solved this riddle, but I didn't like the method I had to use and would like to be able to solve it with more mathematical rigor.
I understand the basic idea for a problem like this: come up with a system of equations with at least as many equations as there are variables. But, I found myself having a hard time translating a portion of this riddle into algebra and had to resort to trying out values to find the solution. There has to be a better way, and that is what I'm looking for: how to rigorously express the portion of this riddle I am missing so that I can solve for it instead of experimentally plugging in values until all the equations are satisfied. Here is the riddle:
I'm thinking of four numbers:
- Rule 1: The sum of all four numbers is 31
- Rule 2: Only one of the four is an odd number
- Rule 3: The highest number minus the lowest number is 7
- Rule 4: The difference between the two middle numbers is 2
- Rule 5: There are no duplicate numbers
Which four numbers are they?
- From Rule 2, I defined
Aas the odd number, and
Das the even numbers
- Arbitrarily, I assigned
B < C < D(we can do this because there are no repeats)
- From Rule 1, I defined
A + B + C + D = 31
- From Rule 5: I get
A != B != C != D(using
!=to convey not equal)
- From Rule 4, I get
C - B = 2
- From Rule 2 and 4, I know
B is evenand
C is even, leaving A and D, one of which is odd, the other even. I have defined
Das even, so
Amust be odd.
- At this point I don't know which is bigger,
D, but I do know that
A < B or A > D, one of the two.
- From Rule 3,
D - A = 7 or D - B = 7, but since I know
D - Bis an even number, I now know
A < B < C < D < 31
C = B + 2and
D = A + 7
- Substituting, I know
A + 2B + D = 29, and then
2A + 2B = 22
- Divide by 2 to get
A + B = 11
- With the constraints that A is odd and B is even, that leaves only three possibilities for
1 + 10or
3 + 8or
5 + 6Note that this is the step I don't like. I think there should be a better way to figure it out, rather than plugging in values. What am I missing? Probably something super simple.
- Trying all three of these combinations leads to
A=1 B=10 C=12 D=8, which violates the total-order scheme I set up (arbitrarily), or
A=3 B=8 C=10 D=10which violates Rule 5, or
A=5 B=6 C=8 D=12, which obeys all the rules and sums to 31.
So that's how I got the answer of 5, 6, 8, and 12. But there has to be a more robust way to solve this. Please show me. High school was a long time ago. I'm probably just forgetting something basic.