# More than equilibrium

Assume you have 2 identical metal cubes, the only difference being their temperatures $T_1 = 0 \, \text{°C}$, $T_2 = 100 \, \text{°C}$:

The task is now to transfer as much heat as possible to the initially colder metal cube with just the heat from the initially hotter one. So far, it seems like the hottest you can get the first cube is $T_1 = 50 \, \text{°C}$ if you bring the two cubes together and let their temperature equilibrate:

But you are also allowed to split both of these cubes into any number you want. Let's assume that – contradicting physics – the splitting and recombining of parts does neither require nor release energy. You are allowed to bring together any combination of parts from any of the cubes and let their temperatures equilibrate. But in the end you have to bring together all pieces belonging to the initially colder cube and get one final $T_1$.

One simple example where the total heat transfer is more than the previously achieved $50 \, \text{°C}$ is the following: You split up the hot cube into 2 equal parts with temperatures $T_{21} = T_{22} = 100 \, \text{°C}$:

Then you connect one hot part with the cold cube and get an average temperature of $T_1 = T_{22} = 33 \frac{1}{3} \, \text{°C}$:

Then these are detached and the other part of the hot cube transfers energy to the cold one, so that it ends up with $T_1 = 55 \frac{5}{9} \, \text{°C}$:

Now the question: What is the hottest temperature $T_1$ that you can achieve? Describe your scheme and proof your claim! Give an expression for the final temperature $T_1 (n_1, n_2)$ in dependence of the number of splittings of the first ($n_1$) and second ($n_2$) cube.

This question is inspired by Ron Maimon's answer to a question on Physics Stackexchange.

• you have already found the maximum. – Oray Oct 22 '17 at 12:02
• @Oray I'm looking for the maximum that can be achieved using any arbitrary splitting $n_1$, $n_2$, not just for the example of $n_1 = 1$, $n_2 = 2$. – A. P. Oct 22 '17 at 12:18

I think I have a simple proof that you can get arbitrarily close to 100.

The jist of it is this: you've already shown you can do better than 50/50 in one of your examples. If you use the same technique for every sub-step of that example, you'll keep getting a better and better answer.

But, let's use a concrete example and do some math. We'll only ever use equally sized pieces to make the math easier.

For our starting answer we'll split both cubes in half and perform these three steps:

1 & 2: Touch the hottest piece to the coldest, and then to the other coldest.
3: Touch the new hottest piece to the new coldest.

If the left pieces start at a temperature of 8, the steps will progress like so:

Left  Right
8,8   0,0
8,4   4,0
8,2   4,2
5,2   4,5
With a final temperature of 3.5 and 4.5 respectively.

We just showed that, using only steps that transfer 50% the difference in temp from one cube to another, we can construct a superior step that transfers 56.25% of the difference.

But what if we use our superior step for each sub-step of our 3-step process? I'll be using the variable x, where before x=0.5, and we improved it to x=0.5625. This time let's suppose the left pieces start at a temperature of 1:
Left                     Right
1,1                      0,0
1,1-x                    x,0
1,(1-x)²                 x,(1-x)x
((1-x)x+1)(1-x),(1-x)²   x,((1-x)x+1)x
With final average temperatures of 1-x-0.5x2+0.5x3 and x+0.5x2-0.5x3 respectively. The final temperature for the right cube in this examples gives us our new value for x each time. The first few iterations:
x=0.5
x=0.5625
x=0.631714
x=0.705199
...

The function will return a larger, improved x for any inputted x within the range [0, 1]. At x=1 (which it will never truly reach), it will improve no further. x=1 is equivalent to fully heating the right-most cube to 100 degrees.

EDIT:

To prove that the equation x+0.5x2-0.5x3 improves and approaches 1 with repeated iterations, all we need to prove is that x+0.5x2-0.5x3 > x for all x in the range [0,1] (exclusive). Each statement will imply the next when x>0 (as is our case here):

1 > x
x > x2
x2 > x3
0.5x2 > 0.5x3
0.5x2-0.5x3 > 0
x+0.5x2-0.5x3 > x
This clearly shows it only ever improves with each iteration, and I think is also enough to imply the bound of infinite iterations is 1, and not 0.999999 or something. For some reason I'm having trouble stating exactly why that part's true, though.

EDIT EDIT:

We can prove it doesn't diverge because x+0.5x2-0.5x3 <= 1 for all x in the range [0,1] (inclusive). This is true because F(0)=0, F(1)=1, and the two critical points (found by solving when the derivative equals 0) lie at around -0.54858 and 1.21525, outside of the bounds.

We can prove it doesn't oscillate back and forth between a set of values because we already proved it never "goes back", it only improves.

Finally, we know it can't converge to any number other than 1 or 0, because any other number will improve after a single iteration. We can't converge to 0 because we start from 0.5 and can't go backwards.

So the only other possibility is that we converge to 1.

• I wish I had thought of this meta-perspective when I had the chance, Geoffrey, and am surprised it hasn't yet received more recognition. Next best thing is to multiple-vote with a bounty (which will take more than a day to work through the system). That the steps of this solution are recursive variations of the whole puzzle is sublime. Signed – recursion nut – humn Oct 25 '17 at 20:26
• Ps. Perhaps you could make it clearer that not only does the overall temperature increase with each recursive iteration but also that it won't get waylaid asymptotically along the way to its potential maximum. – humn Oct 25 '17 at 20:35
• @humn Well I tried my best for extra proof for now. Using a computer it's obvious it converges to 1, but I don't know exactly how to prove it. I feel like there's some simple theorem I should be able to call on. Maybe it's harder than I think. There's tons of different techniques for proving convergence of infinite series, after all. – Geoffrey Oct 26 '17 at 2:42
• @humn Alright, I think I've proven it rigorously enough now. – Geoffrey Oct 26 '17 at 2:59
• Thank you for taking the extra lap, @Geoffrey, now you've definitely earned the additional 50 automatically tacked onto the bounty (system rules get intricate when a bountier has also posted an answer). In any case, I really hope to recognize the same kind of recursive solution in a future puzzle. – humn Oct 26 '17 at 3:31

You can get the colder cube to

100°C (minus some epsilon)

To do this, first you take a small part of the metal from both cubes, and construct

a "ladder" of N equal sized pieces, (let's say 9), each at a different temperature, so that their temperatures split the temperature gap to N+1 equal temperature changes (here, 10 degrees between "rungs").

Then, you split both the cold and hot cube to pieces of that same size, and

feed those pieces, one by one, to the respective ends of the ladder, which works as follows:

1: touch any "hot" piece (a piece that originated in the hot cube) to a "cold" piece (from the originally cold cube) exactly two rungs down on the ladder.
2: Let the heat equalize. Both pieces will move to the rung in between
3: Lather, rinse, repeat
4: At the end, all the "hot" pieces will end up on the bottom rung (here, 10 degrees), and the "cold" pieces will end up on the top rung (90 degrees).

Some heat gradient will be lost in building and dismantling the ladder, but this can be made arbitrarily small by increasing the size of the original cubes with respect to the small bits

Also, you can get the top rung arbitrarily close to 100 degrees by increasing the number of rungs in the ladder.

This is guaranteed to be the maximum, because

if it wasn't, the second law of thermodynamics would like to have a word with you. Quite probably, a Swedish committee would, too.

• +1 Very clever application of a ROT13( urng rkpunatre ) idea! But you don't need a 'small piece of iron', just join parts directly. – CiaPan Oct 23 '17 at 12:43
• Thanks, CiaPan, my mind had converted the metal into iron already. Yes, you are supposed to use the metal from the original cubes in the construction. – Bass Oct 23 '17 at 13:02
• @Bass This is exactly the strategy that I was thinking of. If you can also prove that you can get the initially colder cube arbitrarily close to $100 \, \text{°C}$, I'll accept the answer. The problem with your argumentation so far is, that at no step of your suggested method you really have a ladder with equally spaced rungs. But still +1 for this! – A. P. Oct 23 '17 at 15:54
• Well I constructed the ladder by creating each rung by combining an appropriate portion of hot and cold metal, so I did have equal spacing all the time. Thinking about it afterward, that seems overly complicated; any method of making the original cubes linear and passing one lengthwise over the other seems to produce a counter flow heat exchanger that will swap all the heat, except at the tail end, whose effect can be made arbitrarily small by increasing the length-to-cross-section ratio of the linearized metal. Or so it would seem to me, at least. – Bass Oct 23 '17 at 16:51
• I don't understand this solution. At the start, you only have 2 populated rungs (0C, 100C). After 1 transfer, you have 1 blue (initially 0C) and 1 red (initially 100C) at 50C, and the rest of the slivers unchanged. After you get to humn's 'Last' step, how do you get any more heat into the blues? – Lawrence Oct 24 '17 at 23:22

This is a simple maximization problem:

First we need to formula this with two portions and I will try to make it as simple as possible. Let's say $x$ is the percentage portion from our sample, then the first temperature will be

$T_1=\frac{\frac{x}{100}\cdot 100}{1+\frac{x}{100}}=\frac{100x}{100+x}$

Then we remove the $x$ part with our new temperature $T_1$ and stick $100-x$ part as below:

$T_{2}=\frac{\frac{100x}{100+x}+\frac{100-x}{100}\cdot 100}{1+\frac{100-x}{100}}$

and the maximum temperature will be like on WolframAlpha with the graph below:

We can conclude that equal pieces is the optimal way to distribute temperature. and so what if there would be more piece options (let say three pieces), it just requires one more calculation before applying $100-x$ as $100-2x$ or $33.333$ as we concluded that equal pieces is optimal, which practically changes $T_2$ and adds another $T_3$ below:

$T_{1}=\frac{\frac{100x}{100+x}+100\frac{x}{100}}{1+\frac{x}{100}}=100\frac{200x+x^2}{(100+x)^2}$

And our last piece which is $100-2x$:

$T_{3}=\frac{100\frac{200x+x^2}{(100+x)^2}+100-2x}{1+\frac{100-2x}{100}}$

which can be maximized as shown on Wolfram Alpha.

which makes the temperature about $\frac{925}{16}$.

can we generalize this? let's see...

$T_{n-1}=100^{n-2}\frac{100x+\sum_{k=0}^{n-2}{(100+x)^k}}{(100+x)^{n-1}}$

and

$T_{n}=\frac{T_{n-1}+ 100-(n-1)x}{1+\frac{100-(n-1)x}{100}}$

In this goes to big enough, like $1000$ pieces, the temperature becomes:

$63.19$

Here is the small code you can find any temperature for any pieces and the value of metal converges to:

$63.21$

So what if $n_1>1$:

The idea in this method is to transfer all possible heat to the $0$ degree sticks while cooling our $100$ degree sticks to the lowest point possible. To explain it better, I will give an example: let's say there are 4 equally sized $0$ degree sticks and 4 equally sized $100$ degree sticks. first of all, we take $100$ degree stick and heat one stick, that makes one $50$ degree, and other $50$ degree sticks, then I will take previously hot stick to the another cool stick, and it will make that cool stick $25$ degree while our hot stick becomes $25$ degree too. And use this procedure until all sticks get enough heat from this small originally $100$ degree stick. That will make the cold sticks temperatures, $50$, $25$, $12.5$, $6.75$ respectively, and the hot one will be $6.75$ only. then We will switch our hot stick to another $100$ degree one and use this same procedure until we use all sticks,

at the end we will have:

This is temperature table in an order of the procedure. At the end our hot sticks become,

$6.25$, $18.75$, $34.375$ and $50$ degrees respectively.

while cold ones become

$93.75$, $81.75$, $65.625$ and $50$ degrees, respectively.

Lastly,

if we stick all cold ones together, the temperature will become their average temperature which is $72.656$.

So if our $n_1$ and $n_2$ are big enough:

As you guess, you can get to 100 degrees with some small error easily with this methodology since we are allowed to use sticks over and over.

To be honest, I believe the question will be more original if $n_1$ would not be allowed to be greater than 1.

• Good answer! You figured out that if you only split the hot cube ($n_1 = 1$, $n_2 > 1$) you achieve the maximum temperature $T_1$ if you divide it into equal parts and also give a numeric answer for the final temperature. Therefore +1 from me. But I claim that with a different strategy even more heat transfer is possible. – A. P. Oct 22 '17 at 14:09
• @A.P. didnt notice that we could split the 0 degree one too, i will edit accordingly if noone answered before me :) – Oray Oct 22 '17 at 14:59
• Huh. The answer was what I expected - it is probable that $e$ has something to do with the answer, and in fact the answer is 100-(100/e). – Wen1now Oct 23 '17 at 6:47
• @Oray The question is about the highest temperature that the whole initially colder cube can reach. The strategy with $n_1 = 2$ that you describe can reach $T_{11} = 74.8 \, \text{°C}$ in one of the initially colder parts, but after you bring both parts together you get an averaged temperature of $T_1 = 53.2 \, \text{°C}$, which is even less than the previously achieved $63.2 \, \text{°C}$. – A. P. Oct 23 '17 at 6:57
• Your 4x4 table exquisitely illustrates each stage as well as the final temperatures of all sticks, Oray, and it instantly convinced me of how well this approach works – humn Oct 23 '17 at 21:24

$T_1$ can reach...

... $66\small\,\raise.5ex2{\scriptsize\raise.5ex/}3\tiny\kern2mu\raise1.8ex\circ$ C, ...

...by...

...alter nating heat/cold transfers of infinitesimal slivers, from hot to cold and from cold to hot.   Each sliver is set aside after its heat transfer, until the end when the slivers of each cube are rejoined in order to average out their temperatures.

This approach hinges on certain considerations.

• Each transfer may be interpreted as pouring heat, like water, from warmer piece(s) into cooler pieces(s).   Temperature is like water level as it evens out among all adjoined pieces.

• Each step is intended to transfer the most possible heat from/to that step’s sliver(s). (Alas, other solutions found ways to transfer more.)

• Temperatures are symmetric after each step, always adding to 100° C.

Here are various steps (and sub-stages) when $n_1=n_2=n=5$.   Each sliver is $\tfrac{1\kern1mu}{\large\raise1mu n}$ of a cube.

The temperatures displayed above show how the left and right sides are symmetric about 50° after each step.   Now to summarize the formulation and calculation of $T_1$.

\begin{align} y_i & = {\small\textsf{ temperature of unmoved right-side slivers after step}} \, i \\[1ex] & = {\small\textsf{ resultant temperature of the left-side sliver moved in step}} \, i \\[3ex] 100 - y_i & = {\small\textsf{ temperature of unmoved left-side slivers after step}} \, i \\[2ex] T_1 & = {\small\textsf{average of all moved left-side slivers}} ~=~ {\large\tfrac{1}{\raise2mu n}} \sum_{i=1}^{n} y_i \end{align}

Here is how $y_i$ changes on the right side during step $i$, as a previously-unmoved sliver from the left side is moved to average its temperature with the $n{-}\kern2mu i{+}1$ unmoved pieces of the right side.

\begin{align} y_i & = \dfrac{(n {-} \kern2mu i {+} 1) \, y_{\, i-1} + ({\small\textsf{temperature of unmoved left-side sliver before step}~i})} {n-i+2} \\[2ex] & = \dfrac{ (n {-} \kern2mu i {+} 1) \, y_{\, i-1} + (100{-} \kern1mu y_{\, i-1}) } {n-i+2} \\[3ex] & = y_{\, i-1} + \dfrac{100 - 2 \, y_{\, i-1}}{n-i+2} \end{align}

As $n \to \infty$ this becomes a solvable differential equation in terms of $y(x)$, where ${\large\tfrac{i}{\raise2mu n}} \to x$.

\begin{align} y' & ~=~ \dfrac{100 - 2 \, y}{1-x} ~ , \kern2em y(0) = 100 ~ , \kern2em y(1) = 50 \\[4ex] \implies~~~ y & ~=~ 50 \kern1mu x^2 - 100 \kern1mu x + 100 \\[4ex] \implies~ T_1 & ~=~ \lim_{n\to\infty} \, {\large\tfrac{1}{\raise2mu n}} \sum_{i=1}^{n} y_i ~= \int_0^1 \!\! y \, dx \\[1.5ex] & ~=~ \left. \Big( {\large\tfrac{50}{3}} x^3 - 50 x^2 + 100x \Big) \right|_0^1 \end{align}

$\kern9.4em ~=~ 66 \scriptsize \, \raise1ex2 \raise.7ex/ 3$

This solution was adapted from essentially the same puzzle that I’ve coincidentally considered posing after seeing “Thermos Delight!” in Mad about Physics by Christopher Jargodzki and Franklin Potter, ©2001 (where a maximal solution was not requested).   In light of others’ hotter solutions here, things are working out better than imagined.

• Thank you for the well-explained answer and the drawing. +1 also here. But unfortunately this is still not the best you can get. – A. P. Oct 23 '17 at 7:02

Here's another answer with the same idea as my earlier answer, but with a much simpler approach.

This will, also, converge to the same maximum final temperature for the originally colder cube, which is

100°C (minus a little)

This newer approach should converge to that limit a bit faster, since it omits some steps.

The method, in all its simplicity, is

Chop up both cubes into equal sized pieces. Then

 1. Pick a 0°C cold piece, and touch it, one by one, to every hot piece.
2. Repeat until you run out of pieces. 
As long as you touch the hot pieces in the same order every time, each touch will transfer a little heat from the hot piece to the cold piece. The system will work like a counter flow heat exchanger, which can, in theory, completely reverse the heat gradient.

It's pretty easy to see that the first cold piece will be almost exactly at the target temperature in the end, and similarly for the following ones. If there are very many pieces, the number of pieces that will not reach the target temperature will be small enough not to affect the final result very much.

For your convenience, here are some actual honest to goodness simulation data:

N=Number of pieces per cube, T=Final temperature of the originally cold cube, to two decimal places

     N=1, T=50   °C
N=2, T=62.5 °C
N=3, T=68.75°C
N=4, T=72.66°C
N=5, T=75.39°C
N=10, T=82.38°C
N=100, T=94.37°C
N=1000, T=98.22°C
N=10000, T=99.44°C
N=42000, T=99.72°C

You can try or download the simple simulator I wrote at TIO.run. You can also tweak the output to include intermediate results and/or the actual temperature of each small piece. (Caveat emptor: the simulation's algorithm complexity is O(n^2), so it will get very slow for larger values of N)

The simulation data should make it obvious that the value will converge to the limit given earlier, probably getting within thermometer accuracy limit while the number of required cuts is still physically plausible.

A rigorous mathematical proof, I'm afraid, will have to be done by someone else.