For the one with polynomials, all you have to do it pick any weird number you want for 'x', and then translate the whole numbers into expressions with 'x' in them.
For example, if you say that 'x' is 1.6 . . . just a wild pick. Then ...
1 = x - 0.6 2 = x + 0.4 3 = 2x - 0.2 and so forth, and you could fill these into the second magic square in place of the whole numbers.
Or if you don't want to mess with all the decimals, then just pick a whole number for 'x'. I don't know ... maybe ' 4 '. Then ...
1 = x -3 2 = -x + 6 3 = (1/2)x + 1 and so forth. You just pick any old number you want for 'x', and then make up expressions with it to substitute for all the whole numbers in the first magic square.