Given three tanks $A, B, C$ with capacities of $12,8,5$ litres of water each and initial condition tank $A=12$ we want to fill containers $A$ and $B$ to have equal amount of water.
Allowed actions are in both ways, chose whichever:
$A\iff B$
$B\iff C$
$C\iff A$
These actions drain/fill the tank to the maximum depending on whether capacity allows, i.e. say if:
a) IC $(A, B, C)=(2, 5, 5)$,
perform Left-Right action 3. $C\implies A$,
the state becomes $(A, B, C)=(7, 5, 0)$
b) IC $(A, B, C)=(2, 5, 5)$,
perform Right-Left action 2. $B\impliedby C$,
the state becomes $(A, B, C)=(2, 8, 2)$
I was able to solve the problem intuitively:
$A\implies B, B\implies C, C\implies A, B\implies C, A\implies B, B\implies C, C\implies A$.
However, eager to know how it is possible to somehow construct a system of linear equations or something like this, and generalize the method. Also whether a solution exists is not clear. Moreover, I am unsure which math area is most closely related to this problem, please kindly advise and feel free to edit if necessary!
Thanks in advance!