# Sleep math: red clay blue clay

post by KatjaGrace · 2021-03-08T00:30:11.938Z · LW · GW · 9 commentsTo me, going to bed often feels more like a tiresome deprivation from life than a welcome rest, or a painless detour through oblivion to morning. When I lack patience for it, I like to think about math puzzles. Other purposeful lines of thought keep me awake or lose me, but math leads me happily into a world of abstraction, from which the trip to dreamland comes naturally.

(It doesn’t always work. Once I was still awake after seemingly solving two Putnam problems, which is about as well as I did in the actual Putnam contest.)

A good puzzle for this purpose should be easy to play with in one’s head. For me, that means it should be amenable to simple visualization, and shouldn’t have the kind of description you have to look at multiple times. A handful of blobs is a great subject matter; an infinite arrangement of algebra is not.

Recently I’ve been going to sleep thinking about the following puzzle. I got several nights of agreeable sleep out of it, but now I think I have a good solution, which I’ll probably post in future.

Suppose that you have 1 kg of red clay that is 100 degrees and 1 kg of blue clay that is 0 degrees. You can divide and recombine clay freely. If two pieces of clay come into contact, temperature immediately equilibrates—if you put the 1kg of red clay next to 0.5 kg of blue clay, all the clay will immediately become 66 degrees. Other than that the temperature of the clay doesn’t change (i.e. no exchange with air or your hands, no radiation, etc.). Your goal is to end up with all of the blue clay in a single clump that is as hot as possible. How hot can you make it? (Equivalently: how cold can you make the red clay?)

HT Chelsea Voss via Paul Christiano

Clue: it’s more than 50 degrees.

## 9 comments

Comments sorted by top scores.

## comment by Stevie Lantalia Metke (stevie-lantalia-metke) · 2021-03-08T17:32:43.321Z · LW(p) · GW(p)

Divide both clay blocks into n pieces

For each piece of blue, equalize it with each piece of red in turn, from coldest to warmest

The first red piece will be 100*(1/2^n)

The last red piece will be 50

The best I've done in my head is to get red down to a bit below 25, at 5x5, but a spreadsheet I just rolled up says blue passes above 90 at 32x32

I may have made an error of course, but breaking down the 3x3 case (and expressing T and fractions of 100)

B1 1/2, 3/4, 7/8

B2 1/4, 1/2, 11/16

B3 1/8, 5/16, 1/2

R1 1/2, 1/4, 1/8

R2 3/4, 1/2, 5/16

R3 7/8, 11/16, 1/2

And recombining gets us R 5/16, B 11/16

As far as I can tell, you can push the temperature of blue arbitrarily close to 100, and the temperature of red arbitrarily close to 0. Am I missing something, as this seems substantially better than the other answers

## ↑ comment by swarriner · 2021-03-08T19:49:17.523Z · LW(p) · GW(p)

Your notation is confusing but I achieved a similar result.

Replies from: stevie-lantalia-metke## ↑ comment by Stevie Lantalia Metke (stevie-lantalia-metke) · 2021-03-08T22:35:35.581Z · LW(p) · GW(p)

It isn't really notation so much as a recording of the 3 states each of the pieces goes through (each piece is equilibrated n times for when the other block is split into n pieces, so I record the state of the piece after each of it's equilibrations), expressed as how much of the maximum temperature the piece has (I suppose it would have been cleaner if I'd included the implicit initial states of 0 for the blue pieces, and 1 for the red pieces)

## comment by Timothy Johnson (timothy-johnson) · 2021-03-08T14:44:12.328Z · LW(p) · GW(p)

Edit: As others have pointed out, this is not the best strategy.

___________________________

Nice problem! The best strategy seems to be to mix the red clay with the blue clay in small infinitesimal steps. Every bit of red clay then becomes as cold as possible, meaning that as much energy as possible is transferred to the blue clay.

Here's what we get with two steps:

- Mix 1/2 red at 100 degrees + 1 blue at 0 degrees => 33.33 degrees.
- Now remove the red clay, and add the other half.
- 1/2 red at 100 degrees + 1 blue at 33.33 degrees => 55.55 degrees.

Now let's compute this with steps. So at each step we add a fraction of the red clay to the blue clay, then remove it. Let the temperature of the blue clay after steps be .

Initial:

Adding a piece of red clay to the blue clay:

To simplify our expression, let be the ratio: .

Unrolling our definition gives a geometric series:

Replacing the geometric series with its sum:

Simplifying,

So .

Now . As approaches infinity, it's well-known that this approaches .

Final temperature:

= 63.2 degrees.

As a final note, the LaTeX support for LessWrong is the best I've seen anywhere. My thanks to the team!

## comment by Richard_Kennaway · 2021-03-08T14:36:35.433Z · LW(p) · GW(p)

100(1-1/e) = 63.2°

Feed the red clay past the blue clay a little at a time.

Do you know Lewis Carroll's *Pillow Problems*?

## comment by ike · 2021-03-08T04:46:30.464Z · LW(p) · GW(p)

Lbh pna trg O neovgenevyl pybfr gb 100.

Cebbs ol vaqhpgvba. Fhccbfr fbzr cebprqher pna trg O gb 100-K, naq N gb K. Gura gurer vf n cebprqher gung jvyy trg N gb K-(K/20)^2. Ercrng rabhtu gvzrf gb trg O neovgenevyl pybfr gb 100.

Gur cebprqher: gnxr unys bs O naq unys bs N naq qb gur bevtvany cebprqher. Gura gnxr guvf unys bs N naq pbzovar jvgu gur bgure unys bs O, gura gnxr gur bgure unys bs N (ng 100) naq pbzovar jvgu gur 2aq unys bs O ol hfvat gur bevtvany cebprqher, gura zvk gur Nf naq Of gbtrgure frcnengryl.

Erfhygf ng rnpu fgrc:

- Unys bs O: 100-K. Unys bs N: K
- 2aq unys bs O: K/2. 1fg unys bs N: K/2
- 2aq unys bs O: K/2 + (100-K)*(100-K/2)/100 2aq unys bs N: K/2 + K(100-K/2)/100
- Nirentr bs Nf: K/2 + K(100-K/2)/200 K-(K/20)^2

Jr pna gura cyht va K=50 naq frr jurer jr trg: K=43.75 K=38.96 K=35.17 K=32.08

Guvf shapgvba znl gnxr n ybat gvzr gb trg gb mreb ohg vs lbh vgrengr ybat rabhtu vg unf gb trg gurer, gurer'f ab bgure cbvagf nybat gur jnl vg pbhyq fgbc ng.

Haven't fully verified this.

## comment by Waxwing · 2021-03-08T15:40:47.511Z · LW(p) · GW(p)

Treat the blue clay (mass 1, temperature T) as a single lump. Feed it infinitesimal lumps of red clay (mass , temperature ). After each infinitesimal feeding, the temperature of the blue clay changes by

(Final equality comes from series expansion).

Then you can integrate:

i.e.

The final solution is:

.

It's worth saying that this is the most efficient way to transfer energy from red to blue because each feeding step is thermodynamically reversible.

Replies from: stevie-lantalia-metke## ↑ comment by Stevie Lantalia Metke (stevie-lantalia-metke) · 2021-03-08T17:32:16.171Z · LW(p) · GW(p)

Can't you do better by splitting both blocks up, and doing equilibrating each piece of blue with each piece of red, in turn? By not dividing blue, you are leaving the red pieces a lot warmer than necessary

Replies from: Waxwing## ↑ comment by Waxwing · 2021-03-08T22:45:33.759Z · LW(p) · GW(p)

Having checked this, you're totally correct.

Here's a short Python program that checks this empirically.

import numpy as np

n = 100

b = np.zeros(n)

r = np.ones(n)for ib in range(n):

for ir in range(n):

old_b = b[ib]

old_r = r[ir]

new_b = new_r = np.mean([old_b,old_r])r[ir] = new_r

b[ib] = new_bprint(np.mean(b))

A graph of the scaling of the max blue temperature with respect to number of divisions is here:

When T is 1000 you can get the blue to 0.98 of what red was initially... so I imagine in the infinite limit you can get all the way there.

This seemed weird to me, so I looked at the final temperature distribution of all of the blue blobs, as increases. I've plotted them here (blue lines have being small; red lines have being big). You can see that as the number of blobs becomes very big, the fraction which have temperature less than 1 falls... (i.e. knee of graph moves to the right...)