Dicing an Onion, the Mathematically Optimal Way

surprisetalk | 352 points

https://onion-cutting-simulator.streamlit.app/

I made my own version of this a while back, and it lets you create your own cutting methods, plot the statistical distribution, and share your ideas via permalink. It also lets you tweak onion parameters, such as number of layers and the layer thickness distribution curve).

Along the way I discovered two things:

1. I came up with my own method ("Josh’s method" in the app above) where the neither the longitudinal cuts nor the planar cuts are full depth, so the number of cuts at the narrower core is less than at the wider perimeter.

2. After all this hyper-optimization about size, it turns out what really matters when cooking is the THICKNESS, since ultimately determines the cooking rate. The only way to avoid thin outliers that burn long before the rest are cooked is to discard more of the tip of the onion, where the layers are the thinnest.

The 3D version of the simulator is still in progress--turns out 3D geometry is a lot harder than 2D. :)

Pull requests are welcome! https://github.com/joshwand/onion-simulator

joshwa | 3 days ago

This is fun!

I really struggled to effectively cut onions until this: https://www.youtube.com/watch?v=CwRttSfnfcc

Haven't looked back since.

1a527dd5 | 4 days ago

> It turns out that making horizontal cuts almost never helps with consistency.

They made the horizontal cuts evenly spaced between the cutting surface and the top of the onion, which is nonsensical to me. I believe that a single horizontal cut at around 15-20% height would be better for uniformity than a horizontal cut at 50% height.

re | 4 days ago

But is uniformitiy the goal?

If you want diced onions, the cook generally wants onion chunks below a certain cubic mass, so they cook and dissolve easily and uniformly. It does not matter if some pieces are 50% of that size, some are 20% and some are 80%.

With that, 1-2 horizontal slices and a bunch of straight downward slices are the safest and easiest way to achieve that.

That technique also expands to onion rings, sauteed onions and such.

tetha | 4 days ago

This ignores the obvious solution of not cutting all the way through. If every other radial cut is only through half the layers, you avoid making the inner pieces too small. It's funny how common it is for people to claim some sort of optimality with lots of math and analysis while completely failing to consider a better possibility. Never take seriously claims that someone found a "mathematically optimal" way of doing something. They didn't.

feoren | 4 days ago

The most uniform pieces come from this onion dicer: https://latacocarts.com/products/onion-dicer

I used to work in fast food and this bad boy has a rate of 0.5 onions/sec and all of the resulting pieces are perfectly uniform squares. If you've ever wondered where the perfectly diced onions garnishing your burger came from, this is it.

It was a pain to clean though, as the blades were exceedingly sharp. Someone would cut their fingers about once a week on those things.

glitchc | 3 days ago

Standard deviation is a poor measure because you care more about avoiding big pieces than small ones. Penalizing for having a few tiny pieces doesn’t make sense.

zeroonetwothree | 4 days ago

Small nitpick, it's not just the variation in area that you'd care about, but the variation in shape. Two pieces of the same area/volume can cook very differently depending on the shape. The thing is, there isn't a single canonical metric for measuring shape similarity afaik, but you could pick something e.g. based on Hausdorff distance https://en.wikipedia.org/wiki/Hausdorff_distance#Definition A quick search leads to some cool papers https://webspace.science.uu.nl/~veltk101/publications/art/sm...

t_mann | 3 days ago

To translate the final answer from math to human (as I’m going to be explaining this to my mother when I chat with her next!):

Imagine the half onion is a half rainbow. You know there’s another half rainbow lurking below the surface, the onion’s ghost of the sphere it once was. Place your knife as usual for each of your ten dice cuts, but instead of cutting straight down towards the cutting board, angle it slightly inward towards the end of the onion’s ghostly half-rainbow sphere below the board. Check your fingers for safety and then make your cut. Assuming your knife isn’t a plasma cutter, you’ll be stopped at the cutting board without ever reaching the onion at the end of the rainbow, and that’s cool. Set your knife at the next dice point and try again :)

(This still improves on the other dicing cases and only costs 1% uniformity by using 100% radius as the target.)

altairprime | 4 days ago

Enjoyed reading this. I've followed J Kenji Lopez-alt for a while and I've practiced the "aim below" method for a few years now.

I also like that the article ends with the perfect Kenji-ism. "Yes, technically my method is statistically ideal, but like, it's home cooking and it doesn't matter, heterogenity isn't the enemy". Reminds me of Adam Ragusea (https://www.youtube.com/watch?v=5cWRCldqrxM), we're not making fancy french cuisine, we don't need a perfect brunoise!

criley2 | 4 days ago

Someone, somewhere, will now spend time growing square onions to fix the problem. Probably someone in Japan.

https://en.wikipedia.org/wiki/Square_watermelon

1970-01-01 | 4 days ago

What I want is a cutting technique that’s good enough while still being practical for people to do. I am not sure I’m dexterous enough to slightly and consistently tilt the knife as I go through the onion.

saagarjha | 4 days ago

It's funny seeing people dunking on taking this much effort to analyze onion cuts. The rewards for improving your onion dice are indeed probably low. But in mainstream western cooking, you need to do it almost every meal, and the analysis/learning is a one-time cost rather than a cost applied at every prep. Seems like an extremely reasonable thing to noodle on!

tptacek | 4 days ago

For sure this research can be nominated for an Ig Nobel Prize :-)

On a more serious note, thanks for posting this and letting me (us?) know about "The Pudding".

NKosmatos | 4 days ago

It's a fun intellectual puzzle, but I find it questionable that onion dice uniformity is always a worthwhile goal. Sure, it ensures more even cooking, but in most dishes, is that desirable? Texture and contrast are nice.

DamnInteresting | 3 days ago

I dislike easily 90%+ of the images I recognize as AI-generated, but the ones on this internet web site I think are a good use of the tech.

hashmap | 4 days ago

So using some complicated angle gets you 4% less std dev than just doing it the easy way that everone already does it. Ok.

fumeux_fume | 4 days ago

I make fresh Pico de Gallo twice a week so I chop a lot of onions. Besides an even dice, I’m interested in not dicing my fingertips. Radial slicing a 180 segment or adding horizontal slices is too unstable.

My method is to cut in quarters, give a quarter a vertical dice, rotate 90, do another vertical dice, then go longitudinal.

buildsjets | 4 days ago

This remembers I have a challenge to figure out with some friends.

How to split a round cheese in in 5 perfectly without using any tools except the knife.

Assume you have the ability to cut in half perfectly always

Assume that if you can slice it in 10 equals pieces it is also a valid solution because you can just give two pieces for each

motbus3 | 4 days ago

Why limit it to just two horizontal cuts?

I’ve always just made equal horizontal and vertical cuts, then slice the onion crosswise.

This results in pretty much no large pieces, and only some smaller pieces (which I prefer over larger ones, anyway).

I don’t care about standard deviation — I only care about minimizing the maximum size (but still without turning them to mush).

(Also, I know this was more of a fun mathematical look at chopping onions vs. practical. But still the “two horizontal cuts” thing seemed to be practical guidance, when it seemed like just equal horizontal and vertical cuts is far superior. But, granted, it’s a little trickier to do.)

EDIT: looking at Youtube, looks like the 2-cut thing is normal. But adding a few more cuts isn’t that much harder, and eliminates the larger pieces from the 2-cut method. I’ll stick to my method, even if it’s a little more work.

jader201 | 4 days ago

The authors rightly point out how the pieces near the bottom get elongated in a vertical cut, but don't realize that the whole point of the horizontal cut is to cut those elongated pieces in half. It's not meant to be a cut halfway up the onion.

mafuku | 4 days ago

Once upon a time, my father, who could not cook, harshly criticised my onion chopping technique. This knocked my confidence in the kitchen quite a bit. I refused to learn the fancy techniques of the TV gameshow celebrity chef that my dad was enamoured with.

In my opinion, so long as you are chopping onions, all is well. Sure it could be dangerous, with fingers and egos at stake, but far worse is to not be chopping onions as that means ready meals, take out meals and having a poorer diet.

Theodores | 4 days ago

While math may offer "optimal" theoretical options, reality is messier. Likely the most efficient for humans and simpler technique to dice onions is the street food vendor way:

https://youtu.be/qDFc-5Zc3HU

https://youtu.be/LOqwl2KTzd4

burnt-resistor | 3 days ago

This is exactly the kind of nerdy, hyper-specific deep dive that makes me love the internet

RataNova | 3 days ago

Lol love the extent of clarity of the experiment, findings and interface. I think that for practical purposes, it would be better if the std-dev of pieces with size above a certain threshold is observed. From my experience, pieces above a certain size cause inconsistency in cooked onions. But maybe it depends on the recipe.

gndp | 4 days ago

I figure since it's only an onion I'm glad that that mathematical optimization is not really necessary.

After all there are many more approaches that can be more mathematically rewarding, might as well enjoy it when you can ;)

fuzzfactor | 4 days ago

Sometimes I want this, other times I prefer random sizes.

For example, with tomato based sauces, I often have left overs. For those, sometimes it is not enough so I might add extra crushed tomato to the left overs.

Yet I won't cook that as long as the original dish. So I effectively end up with crushed tomatoes cooked to different amounts.

And you can taste it. It widens the flavour. Gives more depth. Since I noticed this, I often hold back a tablespoon or two of crushed tomatoes, giving long, short, and fresh tomato flavour. The fresh amount added is tiny, like adding spice!

For some dishes, I add fresh garlic but a tiny bit of garlic powder. Just a subtle hint of a slightly different garlic flavour.

Back to onions, different sized pieces cook more/less, and create more variance in flavour, as long as the cook isn't so long to completely cook them all.

I also like adding more than one type of onion to a dish.

Anyhow. Widen those flavours!

bbarnett | 3 days ago

I agree with the conclusion - it doesn't matter.

locallost | 3 days ago

Posted less than a day ago (8 points, 2 comments) -

https://news.ycombinator.com/item?id=44894302

thunderbong | 4 days ago
[deleted]
| 3 days ago

From their 2-d diagram, I'm having a hard time understanding what they mean by "vertical cuts" and "radial cuts"

fnord77 | 4 days ago

and then there is Marco Pierre White, How to finely chop onions:

https://www.youtube.com/watch?v=UBj9H6z6Uxw

sixtram | 3 days ago

also should consider how easy it is to hole each shape steady as you cut it. how hard is it to actually implement the radial cutting procedure?

bippihippi1 | 3 days ago
[deleted]
| 4 days ago

Throws it in the food processor.

pfdietz | 4 days ago

[dead]

footlong2 | 4 days ago

[dead]

footlong2 | 4 days ago