# Answer to my generalized MMM6 question

So I posed the more generalized question to  Monday Math Madness 6, which read:

1) Mix in 3 gallons of mayonaise and 7 gallons of ketchup. Stir until completely mixed.
2) Remove 10 gallons of the mixture.
3) Repeat steps 1 and 2 until the mixture is approximately 40% mayonaise and 60% ketchup (200 gallons mayo, 300 gallons ketchup).

How many iterations will it take to do this?

My solution below the fold.

We previously saw that $X_n=k^n X_0+(k^n+k^{n-1}+...+k^2+k)Y$.

This is all we need. In this case, $X_0=[500 \hspace{12pt} 0]$ and $Y=[3 \hspace{12pt} 7]$.

Let’s find out how much mayo we’ll have after $n$ iterations. We want it to equal 200 gallons. This will be: $500k^n+3(k^n+k^{n-1}+...+k^2+k)=200$.

However, you’ll note that we have a geometric series for the $k^n+k^{n-1}+...+k^2+k$ bit. That actually is the same as $\frac{k-k^{n+1}}{1-k}$. [If you know a formula for an infinite geometric series, think about how you could use that to get this formula.]

This gives us, multiplying everything by $1-k$: $500k^n(1-k)+3(k-k^{n+1})=200(1-k)$ $500k^n-500k^{n+1}+3k-3k^{n+1}=200-200k$

Keeping all “n”s to one side and getting everything over to the other side, we get: $k^n(500-500k-3k)=200-200k-3k$ $k^n=\frac{200-203k}{500-503k}$

That can then be solved with simple logarithms. Remember, $k=500/510$. So our answer for n is about 98.265. You’ll need to do 98 iterations to get about 200 gallons of mayo in the vat. (It will be 200.26 gallons of mayo for 98 iterations, 199.28 gallons of mayo for 99 iterations.)

I was then interested in using this to find out how many iterations it would take to get to 250 gallons of mayo, or 421 gallons of mayo. So I just graphed it (x-axis is gallons of mayo, y-axis is iterations): Interesting! There’s a limiting factor — as you do more and more iterations, you get closer and closer to 150. Hmmmmm. Markov Chains anyone?