4. In three gardens there is water. If half of the water in the first garden is poured into the second, and then one third of the water that ended up in the second garden is poured into the third, and finally one quarter of the water in the third garden is poured into the first, then each garden will have 6 liters. (At the same time, the gardens are large enough to allow for the mentioned pouring).

How much water was there in each garden before the start of this procedure?
Solution. First method. If the first tank has $x l$, the second $y l$, and the third tank $z l$, then after the first transfer, the first tank will have $x-\frac{x}{2}=\frac{x}{2} l$, the second tank will have $y+\frac{x}{2} l$, and after the transfer from the second tank to the third, the second tank will have

$$
y+\frac{x}{2}-\frac{1}{3}\left(y+\frac{x}{2}\right)=\frac{1}{3}(2 y+x)
$$

and the third tank will have

$$
z+\frac{1}{3}\left(y+\frac{x}{2}\right)=\frac{1}{6}(6 z+2 y+x)
$$

liters. After the transfer from the third tank to the first, the third tank will have

$$
\frac{1}{6}(6 z+2 y+x)-\frac{1}{24}(6 z+2 y+x)=\frac{1}{8}(6 z+2 y+x)
$$

liters of water, and the first tank will have

$$
\frac{x}{2}+\frac{1}{24}(6 z+2 y+x)=\frac{1}{24}(6 z+2 y+13 x)
$$

Considering the condition of the problem and (1), (2), and (3), we get the following system of equations

$$
\left\{\begin{array}{l}
x+2 y=6 \cdot 3 \\
x+2 y+6 z=6 \cdot 8 \\
13 x+2 y+6 z=6 \cdot 24
\end{array}\right.
$$

whose solution is: $x=8, y=5, z=5$. Therefore, the first tank initially had $8 l$ of water, and the second and third tanks each had $5 l$ of water.

Second method. After the third transfer, each tank had $6 l$ of water, and since one quarter of the water was poured from the third tank during the third transfer, the remaining $6 l$ is three quarters of the water, meaning the third tank had $\frac{4}{3} \cdot 6=8 l$ before the third transfer, and the first tank had $6-\frac{1}{4} \cdot 8=4 l$. These $4 l$ in the first tank are half of the water that was initially in the first tank, which means that at the beginning, the first tank had $2 \cdot 4=8 l$. After the second transfer, the second tank had $6 l$ of water, and since one third of the water was poured from it, two thirds of the water remained, meaning $3 l$ was poured out. Therefore, before the second transfer, the second tank had $6+3=9 l$, and the third tank had $8-3=5 l$ of water. Finally, during the first transfer, $4 l$ was added to the second tank, which means that initially, it had $9-4=5 l$.

Therefore, the first tank initially had $8 l$ of water, and the second and third tanks each had $5 l$ of water.