# [Linear Algebra] Pouring Problem

1. Jun 10, 2014

### mattchen82

1. The problem statement, all variables and given/known data
Two glasses.
First glass has 1 L of water.
Second glass has 1 L of alcohol.
Step (1) Pour 1/2 of liquids from glass 1 to glass 2.
Step (2) Pour 1/2 of liquids from glass 2 to glass 1.

What is the limiting situation after 1 billion steps.

2. Relevant equations

N/A

3. The attempt at a solution

I tried solving the question with a series. if Q = the size of the transfer each time.
Glass 1: Xn+1 = (1-q)Xn + q (1+(q-1)Xn)/(1+q)
Glass 2: 1-Xn+1 = (1-(1-q)Xn)/(1+q)

And by proving that 1/2 0 xn will converge to 0, I reach a conclusion.

However, I was told my by instructor that I actually need to use transitional matrixes and the solution should indicate that the content of alcohol / water in both glasses will fluctuation between 1/2 and 1/3.

Thanks for anyone's help!

Last edited: Jun 10, 2014
2. Jun 10, 2014

### haruspex

Is Q supposed to be a fixed volume? The amount transferred at each step varies.

3. Jun 10, 2014

### mattchen82

Xn is the quantity of liquids after the pour. Q is my particular case in 0.5.
I'm looking for a solution in transitional matrix in this case so i don't think my solution in relevant, i just wanted to post it to prove that I actually thought through the problem and is looking for help for an alternative method to solve it.

4. Jun 10, 2014

### haruspex

There are two liquids and two glasses. That suggests two variables (since two pairwise sums are constant). Xn could be a vector of these, but then I cannot interpret your equations.
(You seem to have made the total of each liquid be 1, which is fine.)

5. Jun 11, 2014

### Ray Vickson

If I interpret your description literally, here is what I get. We start with 1 L water in G1 and 1 L Alc in G2. We pour 1/2 L from G1 into G2, so we now have 1/2 L of water in G1 and 1.5 L of water-alc mix in G2. Now we pour 1/2 the contents of G2 into G1, so we will pour 3/4 L from G2 into G1. That means we now have 0.5 + 0.75 = 1.25 L of water-alc mix in G1 and 0.75 L of water-alc mix in G2 (but the proportions in G1 and G2 are different). Now we pour (0.5)*(1.25) = 0.625 L from G1 into G2, leaving 0.625 L in G1 and giving us 0.625+0.75 = 1.375 L in G2, etc, etc, etc. Is that really how you want it to work?

6. Jun 11, 2014

### HallsofIvy

If I am reading this correctly, step1 takes half the liquid in glass 1 and adds it to glass 2. That is, if glass 1 contains volume A and glass 2 volume B, after step 1, glass 1 will contain volume A/2 and glass B will contain volume B+ A/2. we can represent that by the matrix multiplication
$$\begin{pmatrix}\frac{1}{2} & 0 \\ \frac{1}{2} & 1 \end{pmatrix}\begin{pmatrix}A \\ B \end{pmatrix}= \begin{pmatrix}\frac{1}{2}A \\ \frac{1}{2}A+ B\end{pmatrix}$$

Step 2 takes half the liquid in glass 2 and adds it to glass 1. That is, if glass A contained volume A and glass 2 volume B, after step 2, glass 1 will contain volume A+ B/2 and glass 2 will contain volume B/2. We can represent that by the matrix multiplication
$$\begin{pmatrix}1 & \frac{1}{2} \\ 0 & \frac{1}{2}\end{pmatrix}\begin{pmatrix}A \\ B\end{pmatrix}= \begin{pmatrix}A+ \frac{1}{2}B \\ \frac{1}{2}B\end{pmatrix}$$.

Rather than deal with individual "steps" I would combine those into 1 round: If glass1 contains volume A and glass 2 contains volume B after a single round of 2 "steps" the glasses will contain:
$$\begin{pmatrix}1 & \frac{1}{2} \\ 0 & \frac{1}{2}\end{pmatrix}\begin{pmatrix}\frac{1}{2} & 0 \\ \frac{1}{2} & 1\end{pmatrix}\begin{pmatrix}A \\ B \end{pmatrix}=\begin{pmatrix} \frac{3}{4} & \frac{1}{2} \\ \frac{1}{4} & \frac{1}{2}\end{pmatrix}\begin{pmatrix}A \\ B\end{pmatrix}$$

For example, if A is "1 liter of alcohol" and B is "1 liter of water", after a single two step "round" the first glass will contain 3/4 liter of alcohol and 1/2 liter of water and the second glass will contain 1/4 liter of alcohol and 1/2 liter of water. (The amount of liquid in the two glasses does NOT stay the same. After step 1, there is more liquid in the second glass than the first so, in step 2, when we pour half of glass 2 into glass 1, we are putting more liquid back in than we took out.)

1000000000 "steps" will be 500000000 two step "rounds" so what you want to find is
$$\begin{pmatrix} \frac{3}{4} & \frac{1}{2} \\ \frac{1}{4} & \frac{1}{2}\end{pmatrix}^{500000000}\begin{pmatrix}A \\ B\end{pmatrix}$$

The simplest way to find a high power of a matrix is to "diagonalize". This matrix has 2 distinct eigenvalues (1 and 1/4) so two independent eigenvectors. If Y is the matrix having eigenvectors of matrix X as columns then $$X= YDY^{-1}$$ where "D" is the diagonal matrix with the eigenvalues of X on the diagonal and then $$X^{500000000}= YD^{500000000}Y^{-1}$$.

Last edited by a moderator: Jun 11, 2014
7. Jun 17, 2014

### mattchen82

Thank You

Hello HallsofIvy,

Thanks for the response, I will look into solving the system that you have outlined myself.
I had a quick question, the system that you created was only because you had assumed that based on the question, there will be a equilibrium states for both glass 1 and glass 2 (and for the record you understood the question correctly), the question is that how do I prove that these equilibrium states exist for both glasses?

Best,
mattchen82