This is a 3x3 magic square of summation,
in which sums of each row, column, and diagonal are equal.

$$\begin{array}{c|c|c} 4&9&2\\\hline 3&5&7\\\hline 8&1&6 \end{array}$$

Now modify the magic square by defining a simple function $f(x)$,
so it becomes a new magic square of multiplication,
i.e. in which products of each row, column, and diagonal are equal.

$$\begin{array}{c|c|c} f(4)&f(9)&f(2)\\\hline f(3)&f(5)&f(7)\\\hline f(8)&f(1)&f(6) \end{array}$$

Note: Create the function as simple as possible.

  • 5
    $\begingroup$ Obviously f(x) = 0 X x will work but I guess that's not what we are after. $\endgroup$ – rhsquared Aug 22 '16 at 7:59
  • $\begingroup$ You don't mention that all nine entries should be unique both before and after the transformation. That's usually part of the definition of a magic square. $\endgroup$ – Wildcard Aug 23 '16 at 4:07
  • $\begingroup$ @Wildcard, Elias's 1st answer produce unique numbers after the transformation. $\endgroup$ – Jamal Senjaya Aug 23 '16 at 4:13
  • $\begingroup$ @JamalSenjaya, yes, I know. And that is actually the only answer (I believe but cannot prove); all others are special cases of that one. $\endgroup$ – Wildcard Aug 23 '16 at 4:46
  • $\begingroup$ Ugh, why does everybody think a function must be of the form $f(x)=$stuff, where x appears in stuff? $f(x)=0$ is a perfectly valid function, rather than $f(x)=0x$ or even $f(x)=x^0-1$ $\endgroup$ – Wen1now Sep 9 '17 at 3:09

How about:

$f(x)=c_1\times({c_2}^x)$ with any $c_1$ and $c_2$.


$f(x)\times f(y)\times f(z)=(c_1\times({c_2}^x))\times(c_1\times({c_2}^y))\times(c_1\times({c_2}^z))={c_1}^3\times{c_2}^{x+y+z}$
As previously $x+y+z$ was equal in the desired columns, rows and diagonals, these products will be as well.

An answer which is not of this form is:

As each row, column and diagonal has an odd number, this product will always give 0, although $f$ is $1$ for the even numbers.

| improve this answer | |
  • $\begingroup$ Very elegant solution. $\endgroup$ – rhsquared Aug 22 '16 at 7:58

My Shot:

$f(x) = e^x$.


$e^x \times e^y \times e^z = e^{x+y+z}$
Since the sums match in the magic square, the products will match in this case. They will all be $e^{15}$.

Second try.

$f(x) = x^0$.
all the products will be 1.

And maybe the simplest function

$f(x) = c$ where c is any number, real, complex, integer, rational, irational.

| improve this answer | |
  • $\begingroup$ Nice, though $x^0$ is just a fancy way to say $1$. Constant $1$ and $e^x$ are both special cases of my generic answer. $\endgroup$ – elias Aug 22 '16 at 8:01
  • 3
    $\begingroup$ @elias. True. That's why +1'd your answer. I'm a simple man, I think in simple terms. $\endgroup$ – Marius Aug 22 '16 at 8:01
  • 4
    $\begingroup$ Cool. Your answer of $c$ even beats mine in simplicity, which was asked for in the question. $\endgroup$ – elias Aug 22 '16 at 8:09
  • $\begingroup$ I would like to point out that at least in most magic squares, all the numbers need to be unique, so I don't think that c or (x+1) mod 2 are valid. +1 for creativity, though! $\endgroup$ – ash4fun Aug 22 '16 at 18:36
  • $\begingroup$ This answer should get the golden checkmark. $\endgroup$ – COTO Aug 22 '16 at 18:38

What about

$f(x) = 1^x$


$1^x = 1$ for every $x$ ($\in \mathbb{R}$)

of course.

Maybe a bit trivial, but it works. :)

| improve this answer | |
  • $\begingroup$ Also a special case $$c_1 = 1$$ $$c_2 = 1$$ of elias's earlier answer. $\endgroup$ – Ben Voigt Aug 22 '16 at 22:00
  • $\begingroup$ True, the question said "Create the function as simple as possible." (Although technically $f(x) = 0$ is simpler. [As Brian Risk and Marius pointed out.]) $\endgroup$ – Kevin Aug 23 '16 at 10:58

LOL not in spirit, but technically an answer:

$f(x) = 0x$.

| improve this answer | |
  • $\begingroup$ why not directly 0? It makes the function even shorter. $\endgroup$ – Marius Aug 22 '16 at 14:34
  • $\begingroup$ Also a special case $$c_1 = 0$$ of elias's earlier answer. $\endgroup$ – Ben Voigt Aug 22 '16 at 22:00

This is an old post with already excellent answers addressing the neatly disguised mathematical problem of How to turn addition into multiplication?

Below is the way to easily construct multiplicative 3x3 magic squares with nonnegative integer values. Let $x, y, z$ be nonnegative integers so that $xy$ is a square number. Then

$\sqrt{xy}z^2 \qquad x^2y \qquad yz\sqrt{xy}$

$xy^2 \qquad\quad xyz \qquad xz^2$

$xz\sqrt{xy} \qquad yz^2 \qquad xy\sqrt{xy}$

is a magic square of (not necessarily distinct) nonnegative integers where the product of the rows, columns, and diagonals are all equal to $(xyz)^3$. It is left as an exercise to see that a magic square with the listed properties is necessarily in this form.

To see a slightly less abstract (and working!) example, set $x:=1$, $y:=4$, and $z:=3$, obtaining a magic square with distinct elements, and with the magic product $1728=(1\cdot 4\cdot 3)^3$.

$18 \quad 4\quad 24$

$16 \quad 12\quad 9$

$6 \quad 36 \quad 8$

Here we see that the elements are not pure integer powers, and, in addition, it is quite easy to see that, e.g., the numbers in the first row cannot be represented by the function proposed by elias.

Finally, to answer the OP's question, we remark that the obvious bijection between the two squares serves as an "as simple as possible" function $f$. (So in particular, $f(4)=18$, $f(9)=4$, ..., $f(6)=8$, and undefined otherwise.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.