If eating is universal, science should be too. That’s the underlying premise behind “Science and Cooking,” which was the topic of a HarvardX lecture offered at the new Harvard Ed Portal in Allston on Wednesday.

Addressing a mix of Allston-Brighton residents and University affiliates, Robert Lue, faculty director of the Ed Portal and of HarvardX, proposed that theory as he welcomed the overflow crowd to the airy facility on Western Avenue, which is designed in part to bring HarvardX content to the community.

The free event, Lue explained, was dedicated to “breaking down the barriers between science and the humanities,” exploring the connections “between the fundamental physical sciences and eating.” Specifically, he talked about how everyday cooking can illuminate basic principles in physics and engineering, and vice versa.

“There have long been classes on the discoveries of new stars,” said Michael Brenner, elaborating on the theme. The Glover Professor of Applied Mathematics and Applied Physics and Harvard College Professor at the Harvard School of Engineering and Applied Sciences (SEAS) then pointed out how the next step has been missing. “But there haven’t been intellectual exercises asking: Why does that delicious dish work? How does that happen?”

These questions were at the heart of a 2008 guest lecture by innovative chef Ferran Adrià, Brenner explained, sparking what has since become an immensely popular Harvard course. (The open online version will once again be offered in June.) Along with his colleagues David Weitz, Mallinckrodt Professor of Physics and of Applied Physics, and Pia Sörensen, preceptor of “Science and Cooking,” both at SEAS, Brenner offered an introduction to the course as a kind of intellectual amuse-bouche. Although the multiple celebrity chefs who play a major role in both the live and the online class were absent, the three offered a lively tag-team approach to the subject, mixing lecture and lab work and illustrating their points with M&Ms, marshmallows, and a sprinkling of sweet equations.

The M&Ms — the peanut variety — were central to Weitz’s presentation on packing. “You might think of it as not really important,” he said. “But packing is what keeps me up at night.” With handfuls of the roughly spherical candies, he illustrated a basic principle of packing: that spheres can only be packed to about 64 percent of a container’s total volume. Describing this as “one of the most widely studied and most poorly understood problems,” he added, “you can calculate this, but you can’t say why it is.”

But what does packing have to do with cooking? That question was briefly put on hold for a discussion of surfactants, which sit at the interface of air and liquid and allow bubbles to form. Using audience volunteers for some adventures in whisking, the lecture turned a little messy. But with the help of an immersion blender, soon Weitz was demonstrating how that packing equation — only this time, with bubbles as opposed to candies — plays into the making of a mayonnaise or a meringue.

The role of all those bubbles — or, specifically, the air inside them — came into play again as Sörensen brought out a container of liquid nitrogen and bags of marshmallows. Winding up the hour, the three discussed heating, cooling, and supercooling, and how these affect the states of everything we eat and drink. Why, asked Brenner, can you thaw a frozen egg white back into liquid form but can’t uncook one? That question, along with so many others, piqued the audience’s appetite for more.

“There is science in food,” said Brenner in conclusion. “If you understand that when you cook you are trying to follow a simple physical principle, it makes you a better cook. It allows you to make things you couldn’t make before.”

“Marvelous,” was the verdict of Brighton resident Patty Sutliff. “I’m looking forward to taking the [online] course. I’ve always thought of cooking as science,” she added. “I mean: bread rising!”