Friday, July 31, 2026

Relocating a Hydra

There are infinite rooms, numbered with the integers.

 There is initially a single hydra in room $0$. Each room can hold any number of hydras.

At any time, you can either:

i) Cut off the head of one of the hydras in room $n$, and that results in two hydra spawning, one in room $n-1$ and one in room $n+1$. 

ii) If there are hydras in both room $n-1$ and room $n+1$, you can cut off the heads of one hydra each in both those rooms, and that results in a single hydra spawning in room $n$.

Starting with one hydra in room $0$, with some  sequence of the above head-cuts, can you relocate the hydras to some other room $R$? (i.e. you end up with some number of hydras only in room $R$ and nowhere else). 

What are the possible values of this $R$?

Scroll down for a solution.

.

.

.

.

.

Suppose there are $a_n$ hydra in room $n$.

Consider the function

$$f(z) = \sum a_n z^n $$

Now by chopping off a hydra head in room $n$, the change in the value of $f$ is

$$ z^{n-1} - z^n + z^{n+1} = z^{n-1}(z^2 - z + 1)$$

The other step (which is basically a reverse of the other) results in a change of 

$$-z^{n-1}(z^2 - z + 1)$$

Now if we pick $z = -w$ where $w$ is the cube root of unity, we see that $f(-w)$ is unchanged!

Initially $f(-w) = 1$. If we manage to get exactly r hydras in room $R$ (and no other hydras), then we must have that

$$1 = r (-w)^R$$

This implies $r = 1$ and $R = 6k$.

Thus it is necessary that $R$ must be a multiple of $6$.

It is also sufficient!

All we need to demonstrate is that we can relocated the hydra to room 6.

Now consider the transformation (which shows the state of the rooms -1 to 7)

$$\begin{aligned}& \dots 0 1 0 0 0 0 0 0 \dots \\& \dots 1 0 1 0 0 0 0 0 \dots \\& \dots 1 1 0 1 0 0 0 0 \dots \\& \dots 1 1 1 0 1 0 0 0 \dots \\& \dots 0 2 0 0 1 0 0 0 \dots\end{aligned}$$

Now the steps above are reversible, can be done in any direction starting from anywhere where there is a hydra.

So we apply the above set of steps (call it the 1 to 2-1 step) to the single hydra above to get (note we are no longer showing the room -1 and room 7)

$$ \dots 2 0 0  2 0 0 1\dots $$

Now apply the 1 to 2-1 step in the left direction to the single hydra to get

$$  \dots 2 0 0 3 0 0 2 \dots$$

Now we apply the reverse of the 1 to 2-1 steps (thus effectively changing a 2-1 to 1) to get

$$ \dots 1 0 0 2 0 0 2 \dots $$

And again to get

$$ \dots 0 0 0 1 0 0 2  \dots $$

And again

$$ \dots  0 0 0 0 0 0  1  \dots $$

Which gives us the relocated hydra in room 6, and we are done!

No comments:

Post a Comment