数学上最优化洋葱切法
Dicing an Onion, the Mathematically Optimal Way

原始链接: https://pudding.cool/2025/08/onions/

## 完美洋葱丁背后的数学:Onion调查 受限于网上对正确洋葱丁切法的惊人兴趣,一个项目探索了实现均匀块状大小的数学原理。虽然看似简单,但洋葱丁切法揭示了有趣的几何挑战。研究人员使用标准差——衡量块状大小变化的指标——来比较不同的切割技术。 初步研究表明,径向切割的一致性低于垂直切割。然而,将径向切割瞄准洋葱半径的约60%,显著提高了均匀性,与计算出的“洋葱常数”~55.731%一致。进一步分析,考虑到现实的有限层和切割,揭示了一种*更好*的策略:在10层洋葱中,10个径向切割,深度达到96%,可以产生最低的标准差。 有趣的是,水平切割很少能提高一致性。最终,虽然存在数学优化,但厨师J. Kenji López-Alt指出,完美的均匀性对于烹饪成功并非至关重要。该项目展示了数学如何应用于日常任务,即使实际益处很小——但它*确实*为完美切出的洋葱丁提供了吹嘘的权利!

## Hacker News 讨论:数学最优洋葱切丁 一篇 Hacker News 的帖子链接到一篇关于数学最优洋葱切丁的文章 (pudding.cool)。这篇文章引发了热烈的讨论,超过 90 条评论,揭示了各种观点和技巧。 文章提出了一种最大化均匀性的特定方法,但许多评论者分享了他们偏好的技巧,这些技巧通常是通过专业的烹饪经验磨练出来的。几位用户强调了印度街头小贩和法国厨师使用方法的效率,强调实际考虑因素胜过严格的数学优化。 一个关键的争论集中在水平切口的价值上,一些人认为它们是不必要的,甚至是有害的。另一些人则提倡保留根部以保持结构完整性。许多人同意,均匀性并非总是至关重要的,略微不均匀的丁对于大多数食谱来说完全可以接受。 讨论还涉及了食品加工机和专用切丁器等工具,权衡便利性与清洁以及享受传统刀工的乐趣。最终,共识似乎是,虽然数学分析很有趣,但在切洋葱时,实践经验和个人偏好更为重要。
相关文章

原文

This is a project about onions and math.

Why? Because tens of millions of people are curious about how to properly dice an onion, according to YouTube.

In 2021, chef and food writer J. Kenji López-Alt broke out some math to get optimal uniform piece sizes. But there is more than one way to dice an onion…

This is an onion. (Well, a simplified cross-section of one.) We’ve cut it in half lengthwise, using a sharp knife to reduce the chance of injury and onion-induced crying.

From here, what’s the best way to dice it? That is, how do we get the most uniform piece size?

For the sake of example, let’s assume our onion has 10 layers. We can represent the layers as concentric circles.

Let’s start with a common approach—vertical cuts.

The pieces near the center line are fairly consistent in shape and size.

But along the bottom there are some noticeably larger pieces. When you dice an onion, you’re probably not imagining pieces like these.

This inconsistency can be measured by calculating the standard deviation of our pieces’ areas.

A note on the standard deviation

In this article when we say standard deviation it refers to relative standard deviation. Relative standard deviation here is the ratio of the standard deviation compared to the average piece size. Because relative standard deviation is a percentage, we can make unitless comparisons about how tightly our piece sizes cluster around the average—we don’t have to make any assumptions about the exact dimensions of our onion.

Without getting too deep in the weeds, just know that a higher standard deviation means more piece size variation. So to obtain the most consistently sized pieces, we want to make the standard deviation as small as possible.

Adjust the slider below to see how the number of cuts affects the standard deviation. Oh, and don’t forget to check out the exploded view toggle to see the variation.

Okay, let’s try a different technique—radial cuts.

The piece size still isn’t very consistent—those near the outside are much larger than those near the center.

How does the standard deviation of pieces cut radially compare to those cut vertically?

When making 10 cuts into a 10-layer onion radially, the standard deviation (57.7%) is greater than when cutting vertically (37.3%), which means that our piece size is now less consistent.

But we can improve the radial cut strategy.

Kenji claims that the most uniform pieces can be produced by aiming at a point ~60% of the onion’s radius below the cutting surface.

The pieces now look more consistent, except for a few smaller ones along the bottom.

Does the math confirm ~60% depth as the superior technique?

Indeed, 34.5% is the smallest standard deviation we’ve seen so far. This finding is further supported by Dr. Dylan Poulsen, an associate professor of mathematics at Washington College, who calculated that the ideal “onion constant” is ~55.731% depth (source, another source). Kenji backs Dr. Poulsen’s method in this more recent New York Times article.

But we can improve the radial cut strategy even more!

Dr. Poulsen’s analysis is based on making infinitely many cuts into an onion with infinitely many layers:

Screenshot from Dr. Poulsen’s slides. A diagram shows an onion cross-section with an unrealistically large number of layers. A caption reads: ‘So, we might as well consider the limiting case as the number of layers approaches infinity.’
A slide from Dr. Poulsen’s breakdown on the math behind onion cutting.

However, in the physical world we’re only capable of making a finite number of cuts, and real onions have a finite number of layers. The diagrams from Kenji’s original claim show 10 cuts being made into an onion with 10 layers. How can we optimize that?

When making 10 cuts into a 10-layer onion, the smallest standard deviation (29.5%) occurs when making radial cuts aimed 96% of the onion’s radius below the cutting surface! 😮

Before we explain how we got that result, let’s briefly consider another popular technique: making 1-2 horizontal cuts before vertical, which Kenji recommended in 2016. What does the math say about this strategy? How does combining it with vertical/radial cuts affect our piece size?

How do you find the size of an onion piece?

Onions and onion pieces are 3D objects with volumes, but we’re analyzing areas of 2-dimensional cross-sections to simplify the math.

When making vertical cuts, we can obtain the area of an onion piece in the bottom layer by calculating the area under a circular curve in the piece’s horizontal range. When we want the area of an onion piece in an upper layer, we take the area under its higher circular curve and subtract the area under its lower circular curve.

The calculation for radially cut onion pieces is generally the same. However, cutting radially produces diagonal lines. We also add the area under the diagonal line to the left of the piece, and subtract the area under the diagonal line to the right of the piece.

Optimal techniques

We looked at all 19,320 combinations of onion layer numbers, vertical/radial cut numbers, radial cut depth (as whole number percentages), and horizontal cut numbers that are possible with this model. We then found which technique results in the minimum standard deviation when making 1-10 vertical/radial cuts into an onion with 7-13 layers:

Method
10 radial, 96% depth 96% radial, 96% depth29.5%
9 radial, 76% depth 76% radial, 76% depth32.5%
6 radial, 69% depth 69% radial, 69% depth33.2%
7 radial, 87% depth 87% radial, 87% depth33.2%
8 radial, 53% depth 53% radial, 53% depth34.2%
5 radial, 96% depth 96% radial, 96% depth35.4%
4 radial, 53% depth 53% radial, 53% depth41.0%
3 radial, 69% depth 69% radial, 69% depth41.6%
1 vertical, 1 horizontal cut vertical, 1 horizontal cut43.5%
2 vertical vertical43.5%

Insights

  • It turns out that making horizontal cuts almost never helps with consistency.
  • Radial cuts are usually more consistent than vertical cuts, but you have to aim below the center of the onion.
  • The ideal radial depth varies depending on the number of layers and cuts—but it’s always ≥48%. As the layer and cut numbers increase and approach infinity, this ideal radial depth converges to the onion constant of ~55.731%, mentioned above.

Armed with this knowledge, we can apply the optimal dicing strategy to any onion. But how big a difference does being mathematically optimal make when it comes to cooking? We got in touch with Kenji via email to find out.

Us— How much does uniformity matter?

Kenji— “It matters far more for winning internet debates and solving interesting math problems than it does for cooking. For home cooks, having onion dice that are a little off from perfect is not really an issue anyone should seriously worry about.”

Oh…

Well anyways, we hoped you enjoyed reading this deep-dive about onions and math. And even if your food still tastes the same, you can show off your optimally uniform onion pieces in your next meal. Good luck finding an infinitely thin knife and an onion made of perfect circles.

联系我们 contact @ memedata.com