Cookie calculations

Every time I bake cookies, I wonder if I’m making the most of the space on the cookie sheet. I finally decided to stop wondering and figure it out.

Experimental methods

My investigation involved circular cookies of two different sizes:

cookie sizesTwo examples of large cookies and three examples of small cookies. There was some standard deviation in the size of each group, but it wasn’t too bad.

They were arranged on cookie sheets of two different sizes:

cookie sheet sizesThe sides are, in fact, straight. It’s just the camera that makes them look curved.

Now, the most common way to arrange cookies is in equally spaced rows and columns. This is called a square lattice; when you draw a line from the center of a cookie to each of its four “nearest neighbors,” you end up with a pattern of squares.

Another option is, instead of putting the cookies in row two directly under the cookies in row one, to arrange them in the “gaps” between the cookies on the first row. If you do this, you get a triangular lattice, also called a hexagonal lattice; when you draw a line from the center of a cookie to each of its six “nearest neighbors,” you get a pattern of triangles.

proto-cookies in square latticeproto-cookies in triangular latticeCookie dough arranged in a square lattice (OK, so this one is a slightly rectangular lattice, but you get the idea) versus a triangular lattice.

As you can see, the cookies are more densely packed when they’re in a triangular lattice, even though they’re the same distance away from the cookies closest to them. If you work out the geometry problem, it turns out that cookies arranged in a triangular lattice take up 86.6 percent as much space as cookies in a square lattice. In other words, you can fit 15 percent more cookies into the same amount of area.

Well, problem solved! Triangular lattice it is.

But wait! What if your cookie sheet isn’t wide enough for an offset second row? Is the triangular lattice still the way to go? Is it still worth it to get the rows closer together, when it means every other row is a cookie short?

To find the answer to these questions, I first tested the four different set-ups in my kitchen (small cookies on a small cookie sheet, small cookies on a large cookie sheet, large cookies on a small cookie sheet, and large cookies on a large cookie sheet). Then I used equations and graphs to generalize the answers.

Results

Interestingly, there are two different ways to line up a triangular lattice with a rectangular pan: with sides of the triangles aligned with the short side of the pan, or aligned with the long side. (This is related to the way that triangular lattices have six-fold symmetry, rather than the four-fold symmetry of square lattices.) In all four cases, the two different triangular lattices held different numbers of cookies.

two latticesEighteen cookies versus twenty.

The table below shows how many cookies of each size fit in each pan, arranged each of the three ways. (Click on the number to see the arrangement.)

small pan

large pan
square triangular 1 triangular 2 square triangular 1 triangular 2
small cookies 15* 18 20 24 25 22
large cookies 15 13 14 15 18 20

* You might think that I’d be able to fit one more row of small cookies in the small pan here. So did I, at first. But I was wrong:

(It doesn't quite fit.) Trying to fit a third cookie in the second row here was similarly unsuccessful.

I realize that any bakers out there are thinking, “But the cookies shouldn’t be touching each other or the sides of the pan!” Just pretend that each cookie represents a slightly smaller cookie and the requisite space around it. (It’s hard to eyeball spacing, and it would have been impractical to measure out every gap.)

Left: Smaller cookies, as baked; click on the image to switch to a photo of larger cookies without space between them.
Right: The corresponding triangular lattice of perfect circles (which, admittedly, my cookies are not) shows where my spacing estimates were off.

Analysis

To make things both easier and more general, let’s express lengths in units of cookies. Here are my pan sizes in units of small cookies and large cookies:

small (9”x13” = 22.9 x 33.0 cm) large (10”x15” = 25.4 x 38.1 cm)
small cookies (5.9 cm) 3.88 x 5.59 4.31 x 6.46
large cookies (6.6 cm) 3.47 x 5.00 3.85 x 5.77

Since the small pan measured in small cookies and the large pan measured in large cookies are nearly identical in size, it’s not surprising that these two configurations accommodated identical numbers of cookies in each of the three arrangements. Nor is it surprising that triangular lattices were significantly better than their square alternatives, since all the rows in the triangular lattice had an equal number of cookies. The cookie sheet had enough extra width (or length) to accommodate that:

The difference between a cookie sheet that’s 5 cookies wide and one that’s 5.5 cookies wide.

Even when there isn’t an extra half cookie of length or width, though, the triangular lattice might still win out. Case in point: “triangular 1” for small cookies on the large pan. Three of the rows have only three cookies instead of four, but the extra row of four that can now be added on at the end more than makes up for them:

Small cookies on large pan: square (left) and triangular 1 (right).

When every other row would have to be one cookie short, whether or not the triangular lattice is a good approach depends on A.) how many extra rows you can fit (thanks to the rows being closer together), and B.) how many cookies each row holds. Here’s a graph showing the competition between those two factors:

graphClick on the graph to see a more elaborate version, showing how the plot lines up with the photos, more or less. (Where they don’t agree, it’s due to a few of the cookies being undersized.)

Hence, if your cookie sheet is four cookies long and less than 10 cookies wide, there’s no clear rule for whether a square lattice or a triangular lattice holds more cookies; it flips back and forth depending on how wide your cookie sheet is.

What if your cookie sheet is 10 cookies long? Now, every other row has 9 cookies instead of 10, rather than three instead of four. In other words, there are 10 percent fewer in the “short” rows, instead of 25 percent fewer. As a result, although there’s still flip-flopping for smaller widths, if your cookie sheet is wider than 7.1 cookies, triangular is always the way to go.

For comparison, here’s what the graph looks like for a length of 3.5 cookies. Again, because there’s that extra half cookie of length (allowing every row to have the same number of cookies), the triangular lattice will never fit fewer cookies than the square one, and will often fit more. And that’s true even for very small numbers of rows, columns, and/or cookies.

Technical details
If you’re interested in the full mathematical treatment of the cookie calculation problem, check out this bonus page (complete with many equations).

Conclusions

So here’s what I took away from this exercise:

1. If you can make the second row offset with the same number of cookies as the first row, definitely use a triangular lattice. You won’t do any worse than a square lattice, and you will probably do better. Be aware, though, that unless you have a square pan, a triangular lattice lined up with the shorter side might be better or worse than a triangular lattice lined up with the longer side.

2. If an offset second row would need to be one cookie short, it could go either way. Generally speaking, the larger the cookie sheet (measured in cookies), the more likely it is that triangular lattice is the way to go. If you have very small cookie sheets or very large cookies, the square lattice might well be better. But it also might not be.

3. The optimal lattice to use is highly dependent on the the size of your cookie sheet (both length and width) relative to the size of your cookies. The two points above are rough guidelines, but really, you have to do the math. Or you could refer to this handy graph:

Which is best?You may notice that there’s a symmetry to the graph. Blue on one side of the diagonal is mirrored to green on the other side, and the same is true for yellow and magenta. This is because a “triangular 1” set-up with length A and width B is identical to a “triangular 2” set-up with length B and width A.

To figure out which lattice to use, first measure your cookie sheet, then divide by the distance between cookie centers to get the dimensions of the sheet measured in cookies. Find the point on the graph that represents the length and width of your sheet, and the color tells you which lattice will fit the most cookies! (“Triangular 1” means the cookies are lined up against the side that’s been chosen to be the length, whereas “triangular 2” means they’re lined up against the width side.)

4. And finally, keep in mind that if you are studying one pan of cookies, it is best to make sure that someone else is watching the other. (Of course, this probably doesn’t apply to you, unless your cat is as voracious as ours.)

Xerion, master cookie thief

4 thoughts on “Cookie calculations

    • It was really only one batch of cookies, rearranged several times. Nevertheless, one would expect there to have been extras to bring in to lab; defying expectations, though, the aforementioned husband (and cat) ate them all!

  1. I’ve always used a square lattice, for the sake that I at least feel like I’m getting a denser cookie pattern.

    If I’m reading correctly, you didn’t use the same center – center measurements (which would obviously affect density) in each lattice? I’m curious how the layout work if you were forced to those constraints. I may have to try some mockups the next time I’m making cookies (also, a fantastic excuse to make some cookies).

    • Actually, all of the lattices for a given cookie size had the same center-to-center measurements. Unless you mean how the two different cookie sizes had different spacings? (That was just to get more data, since I only had two different pan sizes.)

Leave a Reply

Your email address will not be published.