Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Group Theory in the Bedroom, and Other Mathematical Diversions

Group Theory in the Bedroom, and Other Mathematical Diversions

3.5 2
by Brian Hayes

See All Formats & Editions

An Award-Winning Essayist Plies His Craft

Brian Hayes is one of the most accomplished essayists active today—a claim supported not only by his prolific and continuing high-quality output but also by such honors as the National Magazine Award for his commemorative Y2K essay titled "Clock of Ages," published in the November/December 1999 issue of


An Award-Winning Essayist Plies His Craft

Brian Hayes is one of the most accomplished essayists active today—a claim supported not only by his prolific and continuing high-quality output but also by such honors as the National Magazine Award for his commemorative Y2K essay titled "Clock of Ages," published in the November/December 1999 issue of The Sciences magazine. (The also-rans that year included Tom Wolfe, Verlyn Klinkenborg, and Oliver Sacks.) Hayes's work in this genre has also appeared in such anthologies as The Best American Magazine Writing, The Best American Science and Nature Writing, and The Norton Reader. Here he offers us a selection of his most memorable and accessible pieces—including "Clock of Ages"—embellishing them with an overall, scene-setting preface, reconfigured illustrations, and a refreshingly self-critical "Afterthoughts" section appended to each essay.

Editorial Reviews

Publishers Weekly

In charming prose that more or less makes up for the relative lack of rigor in many of his explorations, about which Hayes is refreshingly honest ("I see no reason to doubt this assumption, at least as an approximation, but I also have no evidence to support it"), science and technology journalist Hayes (Infrastructure) explains the engineering and arithmetic of clocks and gears, wracks his brain over questions of how best to flip a mattress and visits "the prettiest wrong idea in all of twentieth-century science... the vision of piglets suckling on messenger RNA." As he examines huge calculating tables rendered obsolete by computers, Hayes "cannot help wondering which of my labors will appear equally quaint and pathetic to some future reader." This observation is echoed by the afterwords where Hayes addresses pointed questions and observations from readers, displaying a brave willingness to admit error and acknowledge advances made since these pieces were first published in the Sciencesand American Scientist. Present-day readers would do best to approach this collection more for its literary merits than its revelation of obscure history or cutting-edge mathematical theory. 41 b&w illus. (Apr.)

Copyright 2007 Reed Business Information
School Library Journal

If your idea of fun includes puzzling over the creation of an algorithm for the Continental Divide, then this essay collection by the former editor in chief of American Scientist(AS) will tickle your imagination. Hayes, now an award-winning columnist for AS, has put together some of his best pieces and has included with each a section called "Afterthoughts," in which he enthusiastically adds new information and humbly corrects old mistakes. Hayes explores topics as diverse as the centuries-old Strasbourg clock, economic theory, randomness, DNA, gear ratios, weather forecasting, and war and international relations. And with tongue firmly in cheek, he even writes about the ways that one can flip a mattress. Although one need not be a rocket scientist-or even an undergraduate math major-to understand Hayes's work, the wit and elegance of the essays are best appreciated by those with a solid math background and an interest in math play. Recommended for large public libraries and academic libraries supporting programs in mathematics and computer science.
—Denise Dayton

Copyright © Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.

Kirkus Reviews
A selection of "Computing Science" columns by American Scientist magazine's former editor-in-chief aimed at the numerate-or at least mathematically curious-reader. While you don't have to be a geek to appreciate Hayes's lively, self-effacing style (complete with afterthoughts), it helps to understand that computer science relies on a field of math called numerical analysis and uses algorithms-rules for generating solutions to problems through an iterative process (the way you learned to do square roots in high school). The first essay explains how clockmakers developed the gears and linkages that enabled fabled medieval clocks to reach remarkable accuracy, as well as predict the day Easter would fall on. Other essays celebrate the notion of random numbers and why they are so hard to achieve. Numerical analysis also plays a role in economic models based on the kinetic theory of gases or simplified markets involving iterations of buying and selling. Hayes goes on to explain how statistics have been applied to compute which quarrels-from interpersonal to world wars-are the deadliest (surprising results here). Also, he looks at how algorithms have been developed to determine ways to divide a random series of numbers into two parts with equal sums, or nearly equal sums if the series total is odd. Gears appear again in the form of algorithms, which yield practical tables of numbers to enable engineers to make gear trains to approximate complex ratios. A couple of essays probe areas only professionals might ponder, such as computing the location of the Continental Divide or why base 3 arithmetic is better than base 10 or binary systems. But the piece de resistance is the title essay, whichexplains why there is no algorithm whose repetitions would cycle through all four possible mattress positions that would assure equal wear and tear over time. Challenging but rewarding for anyone intrigued by numbers.

Product Details

Farrar, Straus and Giroux
Publication date:
Sold by:
File size:
3 MB

Read an Excerpt


Clock of Ages

December 1999. As the world spirals on toward 01-01-00, survivalists are hoarding cash, canned goods, and shotgun shells. It’s not the Rapture or the Revolution they await, but a technological apocalypse. Y2K! The lights are going out, they warn. Banks will fail. Airplanes may crash. Your VCR will go on the blink. Who could have foreseen such turmoil? Decades back, one might have predicted anxiety and unrest at the end of the millennium, but no one could have guessed that the cause would be an obscure shortcut written into computer software by unknown programmers of the 1960s and ’70s. To save a few bytes of computer memory, they left room for only the final two digits of the year.

We now know that civilization did not collapse on January 1, 2000. Y2K was a nonevent. Nevertheless, in hindsight those programmers do seem to have been pretty short on foresight. How could they have failed to look beyond year 99? But I give them the benefit of the doubt. All the evidence suggests they were neither stupid nor malicious. What led to the Y2K bug was not arrogant indifference to the future. ("I’ll be retired by then. Let the next shift fix it.") On the contrary, it was an excess of modesty. ("There’s no way my code will still be running thirty years from now.") The programmers could not envision that their hurried hacks and kludges would become the next generation’s "legacy systems."

Against this background of throwaway products that somebody forgot to throw away, it may be instructive to reflect on a computational device built in a much different spirit. This is a machine carefully crafted for Y2K compliance, even though it was manufactured at a time when the millennium was still a couple of lifetimes away. As a matter of fact, the computer is equipped to run through the year 9999, and perhaps even beyond with a simple Y10K patch. This achievement might serve as an object lesson to the software engineers of the present era. But I am not quite sure just what the lesson is.

A Glory of Gears

The machine I speak of is the astronomical clock of Strasbourg Cathedral, built and rebuilt several times over the past six hundred years. The present version is a nineteenth-century construction, still ticking along smartly at age 160-something.

The Strasbourg Cathedral clock is not a tower clock, like Big Ben in London, meant to broadcast the hours to the city. Although it does have a face on the exterior of the building—a rather undistinguished one that would look more at home on a train station—the main body of the clock is inside the cathedral. And yet it is certainly not a clock you would put on the mantel or hang on the wall. It has a case of carved stone and wood that stands fifty feet high and twenty-four feet wide, with three ornamented spires and a gigantic instrument panel of dials and globes, plus paintings, statuary, and a large cast of performing automata. Inside the clock is a glory of gears.

"Clock" is hardly an adequate description. More than a timepiece, it is an astronomical and calendrical computer. A celestial globe in front of the main cabinet tracks the positions of five thousand stars, while a device much like an orrery models the motions of the six inner planets. The current phase of the moon is indicated by a rotating globe, half-gilt and half-black.

If you want to know what time it is, the clock offers a choice of answers. A dial mounted on the celestial globe shows sidereal time, as measured by the earth’s rotation with respect to the fixed stars. A larger dial on the front of the clock indicates local solar time, which is essentially what a sundial provides; the prick of noon by this measure always comes when the sun is highest overhead. The pointer for local lunar time is similarly synchronized to the height of the moon. (When the solar and lunar pointers coincide, an eclipse is predicted.) Still another dial, with familiar-looking hour and minute hands, shows mean solar time, which averages out the seasonal variations in the earth’s orbit to make all days equal in length, exactly twenty-four hours. A second pair of hands on the same dial shows civil time, which in Strasbourg runs thirty minutes ahead of mean solar time. (The city is half a time zone west of the reference meridian for Central European time.)

To count the years there is an inconspicuous four-digit register that anyone from our age of automobiles will instantly recognize as an odometer. Each December 31 at midnight (that’s midnight mean solar time, and thus half an hour late by French official time), the counter rolls over to a new year. The transition from 1999 to 2000 went without a hitch.

There’s more. A golden wheel nine feet in diameter, marked off into 365 divisions, turns once a year, while Apollo stands at one side to point out today’s date. What about leap years? Presto: an extra day magically appears on the wheel when needed. Each daily slot on the calendar wheel is marked with the name of a saint or with some church occasion to be observed that day. Of particular importance, the occasions include Easter and the other "movable feasts" of the ecclesiastical calendar. Calculating the dates of those holidays, and displaying them correctly on the wheel of days, require impressive feats of mechanical trickery.

Wait! There’s even more! The clock is inhabited by enough animated figures to open a small theme park. The day of the week is marked by a slow procession of seven Greco-Roman gods in chariots. At noon each day the twelve apostles appear, saluting a figure of Christ, who blesses each in turn and at the end offers benediction to all present. Every half hour a putto overturns a sandglass, and on the quarter hours another strikes a chime. Still more chimes are sounded by figures representing the four ages of mankind, followed by a skeletal Death, who rings the hours. And a mechanical cock crows on cue, flapping its metal wings.

All of this apparatus is housed in a structure of unembarrassed eclecticism, both stylistic and intellectual. The central tower of the clock is topped with a froth of German-baroque frosting, whereas a smaller turret on the left (which houses the weights that drive the clockwork) has been given a more Frenchified treatment. A third tower, on the right, includes a stone spiral staircase that might have been salvaged from an Italian Renaissance belvedere. In the base of the cabinet, two glass panels allowing a view of brass gear trains are a distinctively nineteenth-century element; they look like the windows of an apothecary shop. The paintings and statues are mainly on religious themes—death and resurrection, fall and salvation—but they also include portraits of Urania (Muse of astronomy) and Copernicus. Another painting portrays Jean Baptiste-Sosimé Schwilgué, whose part in this story I shall return to presently.

Programming with Brass

It’s all done with gears. Also pinions, worms, snails, arbors; pawls and ratchets; cams and cam followers; cables, levers, bell cranks, and pivots.

The actual timekeeping mechanism—a pendulum and escapement much like those found in other clocks—drives the gear train for mean solar time. All the other astronomical and calendrical functions are derived from this basic, steady motion. For example, local solar time is calculated by applying two corrections to mean solar time. The first correction compensates for seasonal changes in day length, the second for variations in the earth’s orbital velocity as it follows its slightly elliptical path around the sun. The corrections are computed by a pair of "profile wheels" whose rims are machined to trace out a graph of the appropriate mathematical function. A roller, following the profile as the wheel turns, adjusts the speed of the local-solar-time pointer accordingly. The computation of lunar motion requires five correction terms and five profile wheels. They all have names: anomaly, evection, variation, annual equation, reduction.

The overall accuracy of the clock can be no better than the adjustment of the pendulum, which requires continual intervention, but for the subsidiary timekeeping functions there is another kind of error to be considered as well. Even if the mean time is exact, will all the solar and lunar and planetary indicators keep pace correctly? The answer depends on how well celestial motions can be approximated by the arithmetic of rational numbers, as embodied in gear ratios. The Strasbourg clock comes impressively close. For example, the true sidereal day is 23 hours, 56 minutes, 4.0905324 seconds, whereas the mean solar day is exactly 24 hours (by definition). The ratio of these intervals is 78,892,313 to 79,108,313, but grinding gears with nearly 80 million teeth is out of the question. The clock approximates the ratio as 1+(450/611 × 1/269), which works out to a sidereal day of 23 hours, 56 minutes, 4.0905533 seconds. The error is less than a second per century.

The most intricate calculations are those for leap years and the movable feasts of the church. The rule for leap years states that a year N has an extra day if N is divisible by 4, unless N is also divisible by 100, in which case the year is a common year, with only the usual 365 days; but if N is also divisible by 400, the year becomes a leap year again. Thus 1700, 1800, and 1900 were all common years (at least in those parts of the world that had adopted the Gregorian calendar), but 2000 had a February 29. How can you encode such a nest of if-then-else rules in a gear train? The clock has a wheel with twenty-four teeth and space for an omitted twenty-fifth. This wheel is driven at a rate of one turn per century, so that every four years a tooth comes into position to actuate the leap-year mechanism. The gap where the twenty-fifth tooth would be takes care of the divisible-by-100 exception. For the divisible-by-400 exception to the divisible-by-100 exception, a further adjustment is needed. The key is a second wheel that turns once every 400 years. It carries the missing twenty-fifth tooth and slides it into place on every fourth revolution of the century wheel, just in time to trigger the quadricentennial leap year.

The display of leap years calls for as much ingenuity as their calculation. On the large calendar ring, an open space between December 31 and January 1 bears the legend "Commencement de l’année commune" ("Start of common year"). Shortly before midnight on each December 31 when a leap year is about to begin, a sliding flange that carries the first sixty days of the year ratchets backward by the space of one day, covering up the word "commune" at one end of the flange and at the same time exposing February 29 at the other end. The flange remains in this position throughout the year, then shifts forward again to cover up the 29 and reveal "commune" just as the following year begins.

The rules for finding the date of Easter are even more intricate than the leap-year rule. Donald Knuth, in his Art of Computer Programming, remarks: "There are many indications that the sole important application of arithmetic in Europe during the Middle Ages was the calculation of Easter date." Knuth’s version of a sixteenth-century algorithm for this calculation has eight major steps, some of which are fairly complex. Here’s step five:

Set E <–– (11G + 20 + Z – X) mod 30. If E = 25 and the golden number G is greater than 11, or if E = 24, then increase E by 1. (E is the so-called "epact," which specifies when a full moon occurs.)

Programming a modern computer to perform the Easter calculation requires some care; programming a box of brass gears to do the arithmetic is truly a tour de force. I have stared at diagrams of the gears and linkages and tried to trace out their action, but I still don’t fully understand how it all fits together.

In the abstract, it’s not too hard to see how a mechanical linkage could carry out the basic steps of the epact calculation given above. A wheel with 30 teeth or cogs would ratchet 11G notches clockwise, then it would add 20 steps more in the same direction, then another Z steps; finally it would turn X steps counterclockwise. The "mod 30" part of the program—reducing the sum modulo 30 (so that 30 becomes 0, 31 becomes 1, and so forth)—would be taken care of automatically by doing the arithmetic on a circle with 30 divisions. So far so good. The 30-tooth wheel does exist in the Strasbourg clock, and it is even helpfully labeled "Epacte." Where I get lost is in trying to understand the various lever arms and rack-and-pinion assemblies that drive the epact wheel, and the cam followers that communicate its state to the rest of the system. There appear to be a number of optimizations in the gear works, which doubtless save a little brass but make the operation more obscure. Perhaps if I had a model I could take apart and put together again . . .

But never mind my failures of spatiotemporal reasoning. The mechanism does work. Each New Year’s Eve a metal tag that marks the date of Easter slides along the circumference of the calendar ring and takes up a position over the correct Sunday for the coming year. (The date of Easter can range from March 22 to April 25.) All the other movable feasts of the church are a fixed number of days before or after Easter, so the indicators of their dates are rigidly linked to the Easter tag and move along with it.

Making It Go

The present Strasbourg clock is the third in a series. The first was built in the middle of the fourteenth century, just as the cathedral itself was being completed with the addition of a spire that made it the tallest structure in Europe. That original clock had animated figures of the three Magi who bowed down before the Virgin and Child every hour on the hour. Little else is known of it, and all that survives is a mechanical rooster, ancestor of the current cock of the clock.

By the middle of the sixteenth century, the Clock of the Three Kings was no longer running and no longer at the leading edge of horological technology. To supervise an upgrade, the Strasbourgeois hired Conrad Dasypodius, the professor of mathematics at Strasbourg, as well as the clockmaker Isaac Habrecht and the artist Tobias Stimmer. These three laid out the basic plan of the instrument still seen today, including the three-turreted case and most of the paintings and sculptures. A curiosity surviving from this era is the portrait of Copernicus—a curiosity because the planetary display on the Dasypodius clock portrayed not the sun-centered Copernican system but the earth-centered Ptolemaic one. The second clock lasted another two hundred years, give or take.

The story of the third clock starts with an anecdote so charming that I can’t bear to look too closely into its authenticity. Early in the nineteenth century, the story goes, a beadle was giving a tour of the cathedral, and mentioned that the clock had been stopped for twenty years and no one knew how to fix it. A small voice piped up: "I will make it go!" The boy who made this declaration was Jean Baptiste-Sosimé Schwilgué, who made good on his promise forty years later.

There was mild conflict over the terms of Schwilgué’s commission. He wanted to build a wholly new clock; the cathedral administration wanted to repair the old one. They compromised: he gutted the works, but kept the case, and built his new indicators and automata to fit the old design. The new mechanism was first started up on October 2, 1842.

Schwilgué was clearly thinking long-term when he undertook the project. As I have already noted, the leap-year mechanism includes components that engage only once every four hundred years—parts that were tested for the first time in 2000 and will lie dormant again until 2400. Such very rare events might have been left for manual correction. It would have been only a small imposition on the clock’s maintainers to ask that the hands be reset every four centuries. But Schwilgué evidently took pride and pleasure in getting the details right. He couldn’t know if the clock would still be running in 2000 or 2400, but he could build it in such a way that if it did survive, it would not perpetrate error.

The contrast with recent practice in computer hardware and software could hardly be more stark. Many computer systems—even those that survived the Y2K scare—are explicitly limited to dates between 1901 and 2099. The reason for choosing this particular span is that it makes the leap-year rule extremely simple: it’s just a test of divisibility by four. Under the circumstances, this design choice seems pretty wimpy. If Schwilgué could take the trouble to fabricate wheels that make one revolution every one hundred and four hundred years, surely a programmer could write the extra line of code needed to check for the century exceptions. The line might never be needed, but there’s the satisfaction of knowing it’s there.

Other parts of Schwilgué’s clock look even further into the future. There is a gear deep in the works of the ecclesiastical computer that turns once every 2,500 years. And the celestial sphere out in front of the clock has a still-slower motion. In addition to the sphere’s daily rotation, it pirouettes slowly on another axis to reflect the precession of the equinoxes of the earth’s orbit through the constellations of the zodiac. In the real solar system, this stately motion is what has lately brought us to the dawning of the age of Aquarius. In the clock, the once-per-sidereal-day spinning of the globe is geared down at a ratio of 9,451,512 to 1, so that the equinoxes will complete one full precessional cycle after the passage of 25,806 years. (The actual period is now thought to be 25,784 years.) At that point we’ll be back to the cusp of Aquarius again, and no doubt paisley bell-bottoms will be back in fashion.

Excerpted from Group Theory in the Bedroom, and Other Mathematical Diversions by Brian Hayes.
Copyright 2008 by Brian Hayes.
Published in 2008 by Hill and Wang.
All rights reserved. This work is protected under copyright laws and reproduction is strictly prohibited. Permission to reproduce the material in any manner or medium must be secured from the Publisher.

Meet the Author

Brian Hayes writes the "Computing Science" column for American Scientist magazine, where he is a former editor in chief. His previous book, Infrastructure: A Field Guide to the Industrial Landscape, was published in 2005.

Brian Hayes writes the “Computing Science” column for American Scientist magazine, where he is a former editor in chief. His books include Infrastructure: A Field Guide to the Industrial Landscape and Group Theory in the Bedroom.

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews

Group Theory in the Bedroom, and Other Mathematical Diversions 3.5 out of 5 based on 0 ratings. 2 reviews.
Anonymous More than 1 year ago
mscrep More than 1 year ago
A nice little book that makes the results of a handful of topics from applied mathematics and statistics accessible to the general public. The more advanced student of science or mathematics will find the text pretty much devoid of mathematical rigor, but that is what makes the book accessible to the generalist. You might not be able to apply the results of any of the items discussed in this book to your everyday life, but it will at least get you think. I can pretty much guarantee that you will learn something interesting from this book. And heaven forbid, you might even do a few hand calculations (no!) or a create a simple computer model (gasp!). I did all of the above, and that is more than most books ever do.