Let the initial volume of the container be \( V \) litres. The process involves two cycles of removing 9 litres of the mixture and refilling with 9 litres of water.
The amount of milk remaining is \( V - 9 \) litres. The proportion of milk left is \( \frac{V - 9}{V} \).
After adding 9 litres of water, the total volume remains \( V \) litres, with 9 litres of water present.
The milk from the previous stage is reduced by the same proportion. The milk remaining after the second cycle is calculated as:
Remaining milk = \( \frac{V - 9}{V} \times (V - 9) = \left( \frac{V - 9}{V} \right)^2 \times V \) litres
The final ratio of milk to water is stated as 16:9. This implies the proportion of milk in the final mixture is \( \frac{16}{16+9} = \frac{16}{25} \).
Therefore, the quantity of milk remaining is \( \frac{16}{25}V \).
We equate the two expressions for the remaining milk:
\[ \left( \frac{V - 9}{V} \right)^2 \times V = \frac{16}{25}V \]
Dividing both sides by \( V \):
\[ \left( \frac{V - 9}{V} \right)^2 = \frac{16}{25} \]
Taking the square root of both sides:
\[ \frac{V - 9}{V} = \frac{4}{5} \]
Cross-multiplying to solve for \( V \):
\[ 5(V - 9) = 4V \]
\[ 5V - 45 = 4V \]
\[ V = 45 \]
The calculated capacity of the container is 45 litres.