SAN DIEGO — At first sight, it seemed like just another math lecture.

The professor came equipped with stacks of transparencies covered with equations; the hall was packed with young computer jocks; the speaker was introduced as someone who "needs no introduction"--well-known as a member of the National Academy of Sciences, former chief scientist at AT&T Research, professor of mathematics at UC San Diego. What gave the game away was the speaker's red Jansport backpack. Instead of holding papers, it overflowed with white and yellow balls, spilling out like Easter eggs from a basket.

This could only be Ronald Graham--not just the former president of the American Mathematical Society, but also the former president of the International Jugglers Assn. Not only world-class mathematician, but also sometime performer with Cirque du Soleil.

Graham had come to Qualcomm Communications to talk to employees--mostly programmers--about the common ground between juggling and mathematics, juggling and programming, juggling and life.

For Graham, juggling is a metaphor for just about everything. Juggling, he says, is a matter of finding efficient ways to put patterns together. And juggling balls so that they don't collide in the air--or so that two balls don't land in one hand at the same time--is not that different from juggling personal schedules, telephone signals, slots for TV shows, the paths of incoming missiles, or calculations performed by computers.

"Jugglers look for patterns," explains the tall, 63-year-old Graham, which is basically what mathematicians do. Like programmers, jugglers start with some basic commands (add this, subtract that; throw ball, catch ball). "You try to find ways to put them together in better ways than anyone else has," Graham says. Both programmers and jugglers strive for control. The jugglers need the balls to go exactly where their hands send them; the programmers need computers to do exactly as they are told.

The problem is, errors are inevitable.

"The trouble with juggling is, the balls go where you throw them," Graham says. When the fingers make a minuscule mistake, the ball follows, multiplying the error.

It's the same for programmers. "The program does exactly what you tell it to do," he said. "There's no program that understands: 'You know what I mean.' "

This common ground between math and juggling has led to several PhD theses in the math of juggling over the last several years, said Graham. Many jugglers are mathematicians--and vice versa. One critical problem for both concerns this question: Given inevitable unknowables and inconsistencies, just how good can you get? What are the theoretical limits to efficiency? If you can't precisely calculate the best routing for millions of telephone calls, for example (and you can't), can you estimate how close you are to some theoretical optimum? It turns out you can, and Graham's work has been seminal to the understanding of such problems.

At Qualcomm's headquarters, Graham showed systems analysts how jugglers can use math to figure out the limits to the patterns they create. Which sequences of balls can go up and down without colliding in midair or both landing in one hand at the same time? Given two hands, how many sequences can you invent? To get a visual grasp on the problem, Graham draws a line of numbered dots. Each dot represents one tick of a hypothetical clock. Every time the clock ticks, a ball can go up or down.

Then he connects the dots to create various patterns. For example, the pattern 441 means that on the first throw, a ball goes up and comes down four ticks later; on the second throw, another ball goes up and comes down four ticks later; on the third throw, a ball goes up and comes down one tick later.

When you connect the dots with lines representing the motions of the balls, it's clear that no two balls land at the same place at the same time. This pattern can be juggled. Graham picks up his balls and shows how.

But three balls is easy. As the ticks and throws turn into a complicated pattern of overlapping waves, it becomes harder to tell what can be juggled, and what cannot.

Are there mathematical tools for simplifying the patterns of balls? Yes, there are.

For example, say you want to know how many balls you need to juggle any sequence of throws and ticks. You don't need to draw every pattern and keep track of the waves. You simply add the number of ticks in the sequence (say, 4,4,1) and take the average--in this case three. That tells you three balls are needed to juggle the 4,4,1 sequence. What about 5,5,5,1? That takes four balls. And it's much harder.