[Math] A beautiful game of gold and silver coins

algebra-precalculuscombinatoricsgame theory

A stack of silver coins is on the table.

For each step we can either remove a silver coin and write the number of gold coins on a piece of paper, or we can add a gold coin and write the number of silver coins on another piece of paper.

We stop when only gold coins are left.

Prove that the sums of numbers on these two papers are equal.

Tried playing the game and the problem seems right each time, but I can't proceed from there. Is it done by induction?

Best Answer

The state of the game can be desribed by $$ (g,s,G,S), $$ where $g$ is the number of golden coins on the table, $s$ is the number of silver coins on the table, $G$ is the sum of the numbers in the first paper, and $S$ is the sum of the numbers in the second paper. The initial state is $(0,n,0,0)$, and we want to show that if the state of the game is $(g,0,G,S)$, then $G=S$.

If we are at $(g_i,s_i,G_i,S_i)$ and add a golden coin, the state changes to $$ (g_{i+1},s_{i+1},G_{i+1},S_{i+1}) = (g_i+1,s_i,G_i,S_i+s_i), $$ and if we remove a silver coin, the state changes to $$ (g_{i+1},s_{i+1},G_{i+1},S_{i+1}) = (g_i,s_i-1,G_i+g_i,S_i). $$

One plan to solve the problem is to find an invariant, for example, a function from $(g,s,G,S)$ to integers, such that these transformations do not change the value of that function. Looking at the equations for a while suggests something with $gs$ because that's how we would get changes of size $g$ and $s$. A bit more looking gives us $$ f(g,s,G,S) = gs+G-S. $$ Once we have found the above formula, it is easy to verify that a step does not affect the value of $gs+G-S$.

Thus if we start from $f(0,n,0,0)=0$ and end with $f(g,0,G,S) = G-S$, we can see that $G=S$.