If you’ve ever been camping— and for us Mainers, that’s practically a rite of passage — you’ve probably built a campfire. It may have been your father or mother or scout leader who showed you the way to “properly” build a fire, but even if you weren’t “taught”, you most likely still place the wood in a triangular shape before igniting.

Did you ever think of why this design is best for incendiary purposes?

Adrian Bejen, J.A. Jones Professor of Mechanical Engineering at Duke University sure did and now we have some math behind how to build the perfect campfire.

The best fires are the ones whose width are roughly the same length as their height, assuming all other variables are equal, according to a recent study published in Nature Scientific Reports by Bejen.

“Humans from all eras have been relying on this design,” Bejen writes. . “The reason is that this shape is the most efficient for air and heat flow.”

Sure, you might say, that’s fairly intuitive. What’s the big deal?

Well, aside from being easy to understand, the math behind the triangular design that allows you to cook the best s’mores is also finding application in design and engineering.

This is due to a theory that Bejen himself came up with in 1996 called the Constructal Law. This law proposes that things that flow, such as rivers, trees, air currents — or, in our case, fires —  “must evolve in such a way that provides easier access to the imposed currents that flow through it” if they are to survive.

You can check out how Constructal Law works in a video published on Slate.com last week.

“Our bonfires are shaped as cones and pyramids, as tall as they are wide at the base,” Bejen said. “They look the same in all sizes… And now we know why.”

So the next time you’re out camping with some family or friends,  you can explain the math behind the method while you build them the perfect campfire. You’re bound to impress at least one person.