Before setting out to make my way in the music business, I was in training to become a ''pure'' mathematician. Such esoteric subjects as ''Algebraic Topology,'' ''Measure Theory'' and ''Non-standard Analysis'' were my preoccupations. I would stay up nights trying to solve knotty mathematical problems, playing with abstract phrases and structures. But at the same time, I would be lured away from these constructions by another activity. With an enthusiasm that could come only when critical faculties are in happy slumber, I would listen to or play a musical composition again and again, imprinting my ear and mind and hands with its logic and sense. Music and math together satisfied a sort of abstract ''appetite,'' a desire that was partly intellectual, partly esthetic, partly emotional, partly, even, physical.

I offer these autobiographical facts only because they are not extraordinary among those who have been involved with these fields. Not only did I know other people tempted by both worlds, but, in various ways, music and mathematics have been associated throughout history.

Mathematicians and physicists of all epochs have felt such affinities. Galileo speculated on numerical reasons ''why some combinations of tones are more pleasing than others.'' Euclid wondered about those combinations some 2,000 years earlier. The 18thcentury mathematician Leonhard Euler wrote a discourse on the relationship of consonance to whole numbers. Johannes Kepler believed the planets' revolutions literally created a ''music of the spheres'' - a sonic counterpart to his mathematical laws of planetary motion.

Musicians, on the other hand, have invoked mathematics to describe the orderliness of their art. Chopin said, ''The fugue is like pure logic in music.'' Bach, the fugue's most eminent explorer, also had a predilection for its precise relative, the canon, which he often treated as a puzzle.

In this century, mathematical language has pervaded much musical thinking. Schoenberg's ''serial'' system for manipulating the scale's 12 tones has exercised enormous influence. Other composers have tried to systematize ''duration,'' ''timbre'' and ''volume.'' Following suit, contemporary musicologists invoke ''set theory,'' ''Markov chains'' and other mathematical concepts. Journal articles detail attempts to decompose, perform and compose music using computer programs. Iannis Xenakis applies sophisticated mathematical theories in his compositions. Even John Cage, in his search for lack of order, uses computer generated random numbers for composing.

This contemporary use of mathematical concepts in music makes it all the more important that their connections be understood. Why, after all, should math and music be connected? Music is an art, mathematics a science. Music poses no problems, mathematics thrives on them. Music has no practical use, mathematics often does. Music is sensuous, mathematics abstract. Analogies may just be vague metaphor or trivial coincidence.

But fundamental musical elements can be analyzed numerically - as the ancient Greeks knew. Pythagoras, to whom fundamental mathematical discoveries are attributed, believed music to be the expression of number in sound. Aristotle said of the Pythagoreans, ''They supposed the whole heaven to be a harmonia and a number.''

The musical harmony of the Pythagoreans was constructed with the first four integers. Dividing a vibrating string in ratios formed by these numbers, they discovered, generated ''pleasing'' musical intervals. The ratio 1:2 yields an octave, 3:2 yields the fifth, and 4:3 the fourth.

In later Western music the interval of the fourth fell out of favor and the sixth was added, but the idea remained the same. The rules of counterpoint, which governed combinations of musical lines, restricted intervals to those formed by such simple ratios. The tonal harmonic system, so familiar to us from the music of the 18th- and 19th-centuries, is also founded on these ratios, and upon ''harmonics'' - higher pitched tones created when any note is sounded. Musics of all cultures involve systematic organization of such ratios.

The numerical properties of sound have also been subject to more sophisticated analysis, using techniques developed by an 18thcentury mathematician, Jean Baptiste Fourier, and, in our century, computer technology. ''Digital'' recordings, for example, involve exact translations of sound into number. Such precision has also permitted the synthesis and complex organizations of sound found in contemporary electronic music.

But such numerical properties of sound and the musical systems based on them do not say much about the experience of music. Few listeners care about integral ratios of string vibrations. Few listeners hear a 12-tone series played backwards. Few listen to tonal music for the way harmonic ''rules'' are followed. Music is involved in more than mere combinatorial analysis. And mathematics is more than just a mechanical manipulation of abstract signs. The links between math and music are deeper and more profound.

In fact, if music displays a certain systematic ''mathematical'' character, there are corresponding ''musical'' qualities to mathematics, esthetic qualities that have been often described by its practitioners.

The mathematician G.H. Hardy wrote of the ''harmonious'' character of mathematics: ''Beauty is the first test: there is no permanent place in the world for ugly mathematics.'' The mathematician Henri Poincare also wrote about ''the feeling of mathematical beauty, of the harmony of numbers, of forms, of geometric elegance.''

This ''harmony'' is difficult to explain. But one ancient example of beauty that offers some clues to the esthetics of mathematics is the ''golden ratio,'' considered by the Pythagoreans to be the most beautiful of proportions. The ''golden rectangle,'' with sides in that ratio, has been linked with the proportions of the Parthenon in Athens and exercised fascination on Renaissance artists. In 1509, a book by Luca Pacioli called ''De Divina Proportione'' was illustrated by Leonardo da Vinci; the painter also used the ratio in his painting. Kepler invoked this ''divine proportion'' as well. Recently, ''The Divine Proportion; A Study in Mathematical Beauty'' by H.E. Huntley has attempted a mathematical and esthetic survey of the ratio.

The definition of this ratio is rather simple. A line is divided into a ''golden section'' when the ratio of its two parts is the same as the ratio between one part and the whole. The ratio, that is, reproduces itself within itself. The diagonals of a pentagon divide each other in this ratio; it appears in other geometrical configurations as well.

As a number, the ratio might seem unattractive (it is equal to (-5 -1) / 2). But it can be rewritten in a quite remarkable way, as a fraction composed entirely of 1's layered in an infinite series. Seen in that way, the number becomes a sort of arithmetic ''image'' of the geometric property of the ratio - it is represented endlessly within itself. As the illustration on the front page shows, for example, if a square formed by one side of a golden rectangle is cut off, a golden rectangle remains. If squares are continually removed, there is an infinite spiral of golden rectangles contained within each other.

But dramatically enough, if a curve is drawn based upon the golden rectangle, it is precisely the shape of a chambered nautilus shell. It is a ''logarithmic'' curve of ''continuous growth.'' Any two segments of the curve are the same shape; they are just different sizes. As a snail grows, it produces shell material in the same formation, only in larger quantities. Similar curves lie in the center of a sunflower, in the shape of a fir cone and in other natural forms that contain the golden ratio.

The golden ratio provides some insight into the ways in which mathematics works in general. Nature might provide the original model for speculation about the ratio. From observation of a pine cone, a snail's shell, a sunflower, certain similarities are noted and an abstraction is made. This abstraction - a proportion, in this case - is itself studied, revealing other properties. Underlying principles are then recognized in different realms - the golden rectangle, the properties of number, the arts; related structures are found at the foundation of seemingly disparate systems. Mathematical thought processes, of course, are vastly more complex, but they are quite similar in essence.

Music also involves this type of analytical thinking. It too begins in the natural world - with physical laws and bodily rhythms. Music, like mathematics, then creates abstract systems, like tonality, for its activities. Within such a system, a musical ''element,'' a theme, may be explored, transformed, revealed in different musical contexts. Its rhythm may be isolated. Its intervallic structure may be considered, its harmonic implications examined. When, for example, at the end of a Bach fugue, the theme enters in a cadence, it carries meanings it did not have when first heard. Like a mathematical object, that theme has been explored in various combinations; it has been inverted, expanded, viewed in differing contexts, dissected. A sort of musical knowledge has been achieved. There is a similar sense in Beethoven's piano sonatas that a concentrated exploration of musical elements is taking place before one's ears; when a theme returns in a recapitulation, it is no longer heard as it was in the beginning. In this manipulation of abstract material, which reveals new relations and structures, math and music may have their common formal ground.

But these processes in math and music also suggest an esthetic that has been central in the West and implicit in the golden ratio. This concept of beauty involves proportion between various elements and a relation between parts and whole - a reproduction of macrocosm in microcosm.

In music, to give an unusual example, Bartok's interest in such ideas was so strong that he literally reproduced the golden ratio in his compositions. In ''Bela Bartok; An Analysis of his Music,'' the Hungarian musicologist Erno Lendvai demonstrates that in Bartok's music, crucial musical events mark divisions and subdivisions of the work into golden sections. Bartok's unusual harmonic system, Mr. Lendvai argues, is also related to the golden ratio.

But even when parallels are less precise, music often involves a similar esthetic. The classical sonata had an organic character, with musical elements exfoliating into a drama. Heinrich Schenker, this century's most original musicologist, wrote about the ''biological nature of form'' in tonal music and demonstrated how properties of a single phrase are repeated throughout a work and shape its structure. Many composers of ''advanced'' serial music have had similar esthetic ambitions, working outside the tonal system.

The ideals of mathematics also, of course, include such coherence and proportion. But there is even an esthetic aspect to the process of mathematical activity. It is not simply a search for the ''right'' answers. There are ''styles'' of doing mathematics. A proof can have its own form, its own ''tempo'' in the way it introduces concepts or transforms interpretations or rhythmically follows set rules. Different methods can reveal different -and sometimes surprising - aspects of a problem, pointing out new relations and orders.

That sort of unexpected insight, to give a simple example, was demonstrated by the mathematician Gauss when he was seven years old. He was asked to give the sum of the numbers from 1 to 100. Instead of laboriously adding them he noticed that in grouping 1 and 100, 2 and 99, 3 and 98, 4 and 97, etc., each pair added to 101. The series from 1 to 100 could be ordered to create 50 such combinations. Thus, the sum of the numbers was 50 x 101. This reordering of the sum is a ''beautiful'' method - surprising, witty, powerful; it provides a glimpse into the universal properties of a series.

In great mathematics, Hardy wrote, ''there is a very high degree of unexpectedness, combined with inevitability and economy.'' Those are, of course, also the properties of great music. A more profound counterpart to Gauss's solution, for example, is in Beethoven's Diabelli Variations. Instead of customarily varying the banal waltz, the composer considers it in radically different lights. By focusing on an accent, perhaps, instead of on the melodic line, he reorders the music's priorities, revealing a new way of hearing familiar patterns. He transforms the waltz with surprise, wit and power while revealing general properties of musical structure.

What is unexpected about such music, and about similarly deep mathematical work, is its revelation - a new vision of the order of things. What is inevitable, is that, somehow, things could not have been any different; such work seems to make an irrefutable statement about the world.

But the unexpectedness and inevitability of such math and music are powerful because they are not merely formal; they ultimately reflect back to the real world. Music has a concrete emotional meaning, with the capacity to change a listener's feelings. Math also has a concrete meaning; the most abstract brain-spun explorations in mathematics have what one physicist called ''unreasonable effectiveness'' in describing the world. In such a reordered understanding of reality, which seems both surprising and necessary, may lie some qualities of beauty itself.

Stravinsky said that the musician should find in mathematics a study ''as useful to him as the learning of another language is to a poet.'' Such knowledge carries the danger - as in much of the musical theory of the 1950's and 60's - of a false ''scientism.'' But right now there seems to be a return to more fundamental questions in musico-mathematical discussion. Some computer researchers are systematically investigating how music is comprehended. In some strains of today's ''avant-garde,'' mathematics is used in service of a sort of Pythagorean mysticism and applied to very basic properties of music. There have been experiments in vocal overtones, in tuning the piano to create perfect consonances, in extracting elemental characteristics from ''natural'' folk musics.

Whatever the particular styles or esthetics are, though, music and math are unmistakably linked. When I worked at learning at a Beethoven Sonata while also trying to understand the Godel Incompleteness Theorem, the affinity between these activities was evident. Both mathematics and music create languages that have compelling force in shaping understanding and feeling. Both are attempts to make sense of things, to shape esthetic universes that bear directly upon our own. John William Navin Sullivan - author of both a biography of Newton and a monograph on Beethoven - put it this way: ''Mathematics, as much as music or any other art, is one of the means by which we rise to a complete self-consciousness.''

Stravinsky, in discussing ''the art of combination which is composition'' quoted the mathematician Marston Morse: ''Mathematics are the result of mysterious powers which no one understands, and in which the unconscious recognition of beauty must play an important part. Out of an infinity of designs a mathematician chooses one pattern for beauty's sake and pulls it down to earth.'' Morse, Stravinsky says, could as well have been talking about music. It is not only in the clarity of things, but in their beauty and mystery that the two arts join.