# Puzzle: Each entry in a number grid is the average of its neighbors

I'm trying to solve the following puzzle:

Each number should be the average of its four neighbors. For example, $x$ should be equal to $\frac{1}{4}(4+10+y+z)$.

I don't know how to make a formula out of it. What's the trick? Can anyone give me a clue ?

• You can introduce 10 variables and 10 equations. Then use matrices to solve it. – Kamil Jarosz Mar 16 '16 at 17:14
• Do only the numbers in the middle have this property? Because if the ones on the edge do you can puzzle it out by $7=\frac{4+Y+1}{3} \implies Y=16$ – J. Bush Mar 16 '16 at 17:17
• @j-bush , X,y and z , they all have the same property – Ket Mar 16 '16 at 17:21

This is a Laplace equation with Dirichlet boundary condition, you can construct a matrix and solve it using Matlab, or you can use Jacobi iteration to solve it manually as the number of unknowns is very small.

You start with all unknowns set to zero. Then starting from the boundary, replace each unknown with the average of its four neighbors. Since this is a puzzle, the answer is likely to be integers so you can round the result safely. After two or three iterations you get the answer. Mine is: $$6, 5, 3, 2, 1 \\ 5, 4, 4, 2, 1$$