Maths is a piece of cake
You are here
Maths is a piece of cake
Following a recipe, mixing ingredients, cutting a cake, or making seating arrangements are routine when hosting dinner guests. What is more unexpected is that these various preparations can all be analysed from the perspective of mathematics or computer science. This is precisely the standpoint adopted by the exhibition In My Kitchen, set up by the MMI mathematics and computer science centre in Lyon (southeastern France).
“Cooking is a treasure trove! Nearly each and every one of its activities ties in with mathematics or computer science,” states Olivier Druet, the scientific curator for the exhibition, and a mathematician at the CNRS1. “And conversely, almost every notion from these disciplines can be elucidated by drawing parallels with cooking.”
Recipes and algorithms are one and the same thing
The first links appear from the word go. “A recipe looks a lot like an algorithm [7],” says Nina Gasking, the exhibition curator. Both recipes and algorithms are lists of simple instructions which, when performed in a given order, lead to a more elaborate result.
“We might not know how to make stir fried lamb, but if we are given a series of steps to follow, we can cook the dish,” says by way of example Laurent Feuilloley, a CNRS researcher at the LIRIS laboratory2, near Lyon. “This analogy works well for computers: the task must be broken down into a series of very simple and clearly defined instructions in order to be carried out.”
A transformation phenomenon
“Recipes also have a probabilistic side,” stresses Céline Bonnet, a researcher at the Inria institute for research in digital science and technology, and a member of the Lyon-based Cancer Dynamics, Adaptation and Modelling team3, who helped set up the exhibition. “The same recipe can turn out differently. Lots of little things can impact and change the result.”
That is the reason why the researcher also sees recipe books as models, simple representations for the transformation of ingredients. With this in mind, contents, equipment, and precision are so many parameters that determine the success of a recipe.
A question sometimes arises after reading the instructions: do we need a food processor, which is effective but also cumbersome and difficult to use, or can we simply make do with elbow grease? It just so happens that researchers ask similar questions in their research. Highly detailed models (such as one that would describe the dynamics of the entire human body) are interesting, but too complicated to be manipulable in practice. “In both cases, it’s a matter of cost,” points out Bonnet. “Is a big machine worth it for what we want to do?”
The entropy of cake batter
When it comes to preparing cake batter, mathematics offers insight into a seemingly obvious question, but one whose answer is anything but simple: is it possible, after mixing, to return to the initial situation, and separate the flour from the sugar? “Everyone knows that is impossible, but for what reason? When asked, visitors are uncertain,” Gasking relates.
The notion of entropy, which is to say how physicists measure disorder in a system, explains this phenomenon. The second principle of thermodynamics (the discipline that describes changes in energy) indicates that a system’s entropy can only increase.
No turning back
While entropy is a macroscopic notion, shifting to the microscopic scale explains why the sugar and flour cannot be separated. To illustrate this, the exhibition uses two urns, one filled with 10 white balls, the other with as many black ones. “This is how we chose to model the situation,” explains Druet. “When randomly taking a ball from each urn and putting it in the other, effectively mixing the black and white beads, it soons becomes obvious that it is practically impossible to return to the original situation by continuing to mix.”
Even if there is just 1 white ball among 9 black ones, there is only 1 chance in 10 of picking it in that urn, and 1 in 10 of picking the last black one in the other. The probability is not zero, but it is very low. “And if we move to millions of grains of sugar and particles of flour, it becomes zero.”
Optimising cooking time
Like the previous example, mathematics and computer science can often provide solutions to questions that may seem trivial at first. This is true of optimising [12] time when preparing multiple dishes.
In such a situation, we naturally tend to perform tasks simultaneously. But what is the best way to proceed? Is it better to start with the quickest dish to prepare, or with the one that has the shortest cooking time?
“There is an optimal algorithm that combines these two ideas,” points out Aline Parreau, a CNRS researcher at the LIRIS. “But the greater the complexity, the harder it gets to find the best organisation.”
The geometry of biscuits
Optimisation in cooking can save not only time, but also space. When putting biscuits in the oven, one often seeks to maximise the number that fits on the baking sheet. Intuitively, the best configuration that comes to mind is when one row of pastries is shifted slightly down, forming a hexagonal network.
Yet this solution is not as simple as it may seem. It is even central to ongoing research, notably that of the Ukrainian mathematician Maryna Viazovska, who was awarded the 2022 Fields medal [14] for the packing of spheres in spaces of constant curvature.
Equal shares
When it comes to sharing, favouritism is out of the question – everyone must get the same thing. For a pizza [15] or an epiphany cake, trigonometry provides practical tools for dividing a disk-shaped dish into perfectly equal slices.
However, if it is a Yule log decorated with multiple pieces of fruit, an entirely different approach is needed. “In the exhibition, we ask participants to share the log between two people, ensuring that each one has as much fruit as the other, all while cutting the least amount of slices possible,” adds Gasking. The idea is to guess how many cuts are needed, based on the number of different pieces of fruit on the cake. “It turns out that if we have two types of fruit, two cuts are enough, three cuts if there are three, and so on and so forth,” expounds Parreau.
The ham sandwich theorem
Another mathematical theorem refers to an entirely different food: ham sandwiches. “This theorem4 tells us that no matter how a sandwich was made, there will always be a way to divide it into two pieces that have the same quantity of ingredients, even if this may not be the most natural way to cut it,” details Gasking.
Whether a Yule log or a sandwich, these solutions for sharing can be demonstrated using a single theorem, the Borsuk-Ulam theorem. This result in algebraic topology from the 1930s states that for any value varying continuously over a sphere (even in larger sizes), there are always two points located at opposite ends that have the same value.
Making a dash for olives!
Even when fairness is not the priority, and the goal is to maximise one’s gustatory pleasure, computer science provides solutions. “If you want to have the most slices of pizza with olives on them, and you can only choose between the two slices next to the one previously chosen, the best option is to opt for the portion with the most olives,” indicates Bonnet. “This is known as the ‘greedy algorithm’.”
This simple method optimises gains at each step in hopes of achieving the best final result possible. “However, you sometimes have to resort to another algorithm, because the ‘greedy’ one does not always increment the number of olives in the end.”
In any event, game theory [17] demonstrates that in this game for two, there is always a winning strategy for one of the players. “When the number of pizza slices is even, the strategy always favours the first one,” Parreau affirms. “Yet it was recently demonstrated that for an odd number of slices, there are cases in which the second player is at an advantage.”
Graphs for seating arrangements
All that remains is to sit down at the table, but making seating arrangements based on people’s affinity is often a headache. Another mathematical tool can prove very effective in this case – graphs.
“These objects can model so many things, it is easy to use them in a range of applications,” observes Parreau. By representing each guest with a dot, and drawing lines connecting people who don’t get on, graph colouring makes it possible to seat diners at multiple tables without creating conflict.
“Trying to make a seating arrangement simply by talking about it is very complicated,” states Elise Raphael, the director of the GEM department at the University of Geneva (Switzerland), which is dedicated to scientific mediation in mathematics. “Using this tool makes it much easier.”
Plating and presentation
In addition to solutions from mathematics and computer science, researchers also establish connections between how they work and the act of cooking. “Some said in the exhibition that writing a research article is a little like preparing a dish,” states Gasking. “You have to make it enticing for both those who read it – and those who taste it. This is true even though ‘presenting something nicely’ does not amount to the same thing in each case.”
Inventiveness is also important in these fields. “Sometimes you have to try surprising combinations in order to achieve an interesting result, whether that involves foods not normally associated with one another, or tools from very distinct fields.”
From the concrete to mathematical reasoning
“The exhibition does not really seek to explain how mathematics and computer science are useful for cooking, but it rather aims to explore the links between these disciplines and an activity as ordinary as cooking,” Gasking points out.
“Since everyone is familiar with cooking, using everyday concepts is a good way of reassuring the public,” stresses Raphael. “We can rely on these elements to think mathematically, and talk about maths more easily.”
Cooking shows how concrete problems can be formalised into mathematical reasoning. “It turns out that actions related to food preparation, such as cutting, arranging, and organising, are actually central to mathematics and computer science,” says Parreau. Feuilloley goes even further: “I believe that exploring cooking is a very good idea. On the one hand, it is a miniaturised world of sorts, because it models many aspects of society, including resource sharing and transformation, collaboration, etc. On the other, mathematics, as it happens, strives to model the world.”
Visit
In My Kitchen, exhibition at the Fermat Museum in Beaumont-de-Lomagne (Tarn-et-Garonne, southwestern France), from 24 February 2026 to 1 November 2027.
See also
Stéphane Mallat, a pioneer bridging mathematics and computer science [18]
How the brain manages our appetite [19]
The eternal quest for healthy eating [20]
- 1. CNRS research professor at the Camille Jordan Institute (CNRS / École centrale de Lyon / INSA Lyon / Lyon 1 Université / Université Jean Moulin Lyon 3), and director of the Lyon-based MMI mathematics and computer science centre.
- 2. Laboratoire d’Informatique en Image et Systèmes d’Information (CNRS / INSA Lyon / Lyon 1 Université).
- 3. CNRS / Centre Léon Bérard / ENS de Lyon / INRIA / INSERM / Lyon 1 Université.
- 4. https://en.wikipedia.org/wiki/Ham_sandwich_theorem [21]













