Almost A Magic Square

Algebra Level 2

Place distinct digits from 1 to 9 in the boxes so that the sums of 3 digits along any of the 4 colored lines are all equal.

What is the maximum possible sum that can be achieved?


For example, using the values in the magic square gives us a sum of 15 along each colored line. Can we do better?

15 16 17 18 19 20

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

12 solutions

Arjen Vreugdenhil
Apr 30, 2017

There are four lines in the diagram, each producing the sum S S . Adding these four sums together, we add together the numbers in all nine boxes, but the middle number m m is counted four times. Thus: 4 S = 4 m + other boxes 4 S = 3 m + all boxes 4 S = 3 m + numbers from 1 to 9 4 S = 3 m + 45. 4S = 4m + \sum \text{other boxes} \\ 4S = 3m + \sum \text{all boxes} \\ 4S = 3m + \sum \text{numbers from 1 to 9} \\ 4S = 3m + 45.

Therefore the sum is greatest if m m is greatest. Also, because S S is an integer, 3 m + 45 3m + 45 must be a multiple of four. This is only possible if m m is one more than a multiple of four; in other words, m = 1 , 5 , 9 m = 1, 5, 9 .

It makes sense first to try m = 9 m = 9 . This means S = 18 S = 18 , so that the numbers not in the middle should add up to 9 in pairs. It is easy to do this: 9 = 1 + 8 = 2 + 7 = 3 + 6 = 4 + 5. 9 = 1+8 = 2+7 = 3+6 = 4+5. Thus we place 1 across from 8, 2 across from 7, and so on. It does not matter where! This proves that the maximum sum is 18 \boxed{18} , and that this can actually be done.

I like your observation that we must have m = 1 , 5 , 9 m = 1, 5, 9 :)

I didn't realize that when I wrote this up. Maybe, by selecting a different set of numbers, we could make that observation crucial to solving the problem.

Chung Kevin - 4 years, 1 month ago

Log in to reply

As long as the nine numbers are evenly spaced integers, any solution will have m m equal to the least, middle, or greatest value.

Arjen Vreugdenhil - 4 years, 1 month ago

I really liked your clear, logical reasoning. Cheers.

Kafi Kfishna - 4 years, 1 month ago

Same way! :)

Andrea Virgillito - 4 years, 1 month ago

Brilliant! One question: how did you know that m has to be one more than a multiple of four?

Khalil Hajbi - 4 years, 1 month ago

Log in to reply

Because 4 S = 3 m + 45 4S = 3m + 45 , and S S is an integer, I know that 3 m + 45 3m + 45 must be a multiple of four. The number 45 45 is one more than a multiple of four, so 3 m 3m should be one less (or, in other words, three more) than a multiple of four. Finally, if 3 m 3m is three more than a multiple of four, then m m is one more than a multiple of four.

This is an example of arithmetic modulo 4. In symbolic notation, 4 S 3 m + 45 mod 4 ; 0 S ( 1 ) m + 1 mod 4 ; 0 1 m mod 4 ; m 1 mod 4 . 4S \equiv 3m + 45\ \text{mod 4}; \\ 0\cdot S \equiv (-1)\cdot m + 1\ \text{mod 4}; \\ 0 \equiv 1 - m \ \text{mod 4}; \\ m \equiv 1\ \text{mod 4}.

Arjen Vreugdenhil - 4 years, 1 month ago

I didn't even realize there were four lines >.> I assumed it meant for ALL vertical, horizontal, and diagonal sums to be equal x.x .... so I just did sum (1 thru 9) * 3 since every box is used 3 times except the middle one. Then assumed the middle is the highest number - 9. And got (135+9)/9=18.

Marina Longnickel - 4 years, 1 month ago

Log in to reply

Is it possible to construct a square whose sum of each row, column and diagonal is 18?

Pranshu Gaba - 4 years, 1 month ago
Venkatachalam J
May 1, 2017

By using Gauss' number paring Trick we can easily solve the problem without any algebraic equations.

But why does this algorithm work? Can you provide the motivation?

Agnishom Chattopadhyay - 4 years, 1 month ago

Log in to reply

I updated solution with possible cases how the algorithm works.

Venkatachalam J - 4 years, 1 month ago

Log in to reply

Great. This makes more sense now.

Agnishom Chattopadhyay - 4 years, 1 month ago

I see how you did that, but what are the LOGICAL steps? Could you please elaborate a bit? I am sure it has to do with integers, but I just cannot verbalize what prompted you to organize the numbers in the first place. Thanks.

Kafi Kfishna - 4 years, 1 month ago

Log in to reply

My take on his logic is like this: if you want to maximize the sum, 9 should be até the center. You then have to pair each of 8 remaining number such that their respective sums are the same, you can do that if you order then by size in a line and pair the first with the last each time. The sum you get doing this is 18 for each of the pairs + 9.

Augusto Hoppe - 4 years, 1 month ago

I updated solution with possible cases with the logical steps.

Venkatachalam J - 4 years, 1 month ago

i found the same result, using kind of the gauss theory, without even knowing it was his. i mean in the specific problem it was clear that you had to take as the center block, the biggest number as you want to maximize the sum. the step ahead was to find a way to make every couple of the other numbers equal with the other, so you just need to pair first and last of the remainng 8,and couple them. What i am trying to say is that i think the specific problem is more of a logical than a mathematical

Antonis Dmt - 4 years, 1 month ago

The sequence of digits given in the problem is an arithmetic progression and in an A.P sum of terms equi-distant from beginning and end is constant.

Aditya Sky - 4 years, 1 month ago
Hana Wehbi
Apr 23, 2017

The answer is 18 18 but I did it by trial and error. I placed the numbers in the boxes until I got the maximum sum.

There's a quick way to show it's the maximum. Think about the sum of these numbers.

Chung Kevin - 4 years, 1 month ago

Log in to reply

Ok, I will give it a try. Thank you.

Hana Wehbi - 4 years, 1 month ago

I just placed the larger number in the center square.

Fernando Marquez - 3 years, 8 months ago
Chuck Gershman
May 3, 2017

If I am looking for the largest value and I must use all numbers then I start with the smallest value. Which is 1. So what is the largest value I can achieve if 1 is one of the numbers. That is 1+8+9=18. No larger sum can be achieved. Placing 9 in the center with 1 on one side and 8 on the other. It becomes easy to fill in the remaining boxes to add each to 18.

Jason Forrest
May 2, 2017

I thought you always put the highest in the middle. The next number (8) is offset by (1) so on and so forth, no advanced math needed for this one

Yash Ghaghada
Apr 30, 2017

We can start by writing sum of all digits i.e 45. If we assign variables a,b,c,d,e,f,g,h,i. Putting e at the centre box. As condition is the sum along the lines is same but actually the centre box doesn't bothers the sum, i.e the sum of boxes other than the central box is also the same. a+b+c+d+e+f+g+h+i= 45
a+i=b+h=d+f= g+c=∆-e (∆=sum along lines)
4(a+i)+e=45. So 4(∆-e)+e=45
4∆-3e=45. So. ∆=45+3e\4 So ∆is max. When e is max. But ∆ is integer only when e=5,9 But we want max. So e=9. So ∆= [18]


L e t Let t h e the h i g h e s t highest n u m b e r number g o go i n in t h e the m i d d l e middle a n d and t h e the h i g h e s t highest s u m sum t h a t that c a n can b e be f o r m e d formed b e t w e e n between t w o two n u m b e r s numbers f o r for a l l all t h e the r e m a i n i n g remaining n u m b e r s numbers g o go i n in t h e i r their r e s p e c t i v e respective p l a c e s , places,

9 9 i s is t h e the h i g h e s t highest n u m b e r number a n d and t h e the h i g h e s t highest n u m b e r number t h a t that c a n can b e be f o r m e d formed f r o m from t h e the r e m a i n i n g remaining n u m b e r s numbers .

H e n c e , Hence, 9 + 9 = 18 9+9=18

T h e r e f o r e , Therefore, t h e the m a x i m u m maximum p o s s i b l e possible s u m sum t h a t that c a n can b e be a c h i e v e d achieved i s is 18. 18.

Soufiane Khatibi
May 3, 2017

to maximise each line I needed to put the max number possible in the middle box which is : 9 and then I tought that every two boxes must have same outcome, and instinctly got 9 8+1 7+2 6+3 5+4

Chris Lee
May 2, 2017

To maximize our value - We put 9 in the middle, then we have 1-8 notice that pairing off gives us 1+8 2+7 3+6 4+5 this is 9 for all pairs, then putting this on our line we get 18 as our sum.

How do you know that "To maximize our value - We put 9 in the middle"?

Chung Kevin - 4 years, 1 month ago

I know this because the 9 will go to all pairs, and therefore increasing the value.

Chris Lee - 4 years, 1 month ago
Andrea Zanin
May 1, 2017

Every line shares the central, so for all lines to add up to the same value the outer numbers of every line also have to add up to the same value.

Chosen any central number the biggest of the remaining numbers has to be matched with the smallest, otherwise, the smallest number should be matched with a number bigger than the biggest in order for the pair to have the required sum.

We can, therefore, say that the sum of any line is equal to the sum of the central number and the biggest and smallest of the remaining. The number 9 will always be either the central one or the biggest one. Similarly, the number 1 will always be either the central one or the smallest one. Therefore 9 and 1 will always be in the same line.

We can choose the last number of the line however we want and therefore to maximize the sum we choose 8. So the result is 9 + 8 + 1 = 18 9+8+1=18

I find that hard to follow, but ultimately understood your third paragraph.

At the end, you only explain why the maximium cannot be more than 18. We still have to show that 18 can work.

Chung Kevin - 4 years, 1 month ago
Quen Tino
May 1, 2017

For each sum of numbers in a line to be a maximum each must contain the number 9, Hence place 9 in the middle.

Now for the surrounding numbers realize that for all numbers in a line to sum to the same each number startng with 1 must be paired with the largest number yet unused.

Hence the pairs (1,8) , (2,7), (3,6) , (4,5)

Why is the first line true?

Chung Kevin - 4 years, 1 month ago
Azadali Jivani
May 1, 2017

1+2+3+........+9 = 45
as per magic box total is equal to 60.......[45 + 3 * 5 = 60
now by considering 9 instead of 5 total becomes.....45 + 3 * 9 = 72
72/4 = 18


What do you mean by "by considering 9 instead of 5"?

Chung Kevin - 4 years, 1 month ago

Means replace digit 5 with 9,
Note; if we replace digit 5 with 6 or 7 or 8 we do not get ans. in hole no. only it is possible with 9

azadali jivani - 4 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...