What is a composer? Is it someone who invents music from nothing, or someone who seeks inspiration in mathematical procedures, folk music, or birdsong? Is it someone who imagines a situation in which noise could be interpreted as music, and makes that situation happen? Or someone who takes other musics and mashes them up through loudspeakers? Is a composer a person who stands colossus-like outside the times, tuned in to the eternal spheres, or someone messily implicated in history as it happens? Does public acclaim mean the composer is a successful communicator, or a sellout? Is a composer an artist, a celebrity, a monk or a prankster?

In a sense, the history of 20th-century "classical music" (and we will be coming back to those scare quotes), as told in Alex Ross's magnificent book, is also a history of answers to those questions, of composers wearing all the above hats and more, of a grand search, unconcluded, for answers to the riddle of what composition really is. Schoenberg and Stravinsky contest over decades a heavyweight championship of masterpieces and styles; Gershwin and Weill raid the sleaze-kitty; Messiaen and Stockhausen rocket off into new worlds; Reich and Glass rip it up and start again. Bernstein tries to do too much, and Cage does the absolute minimum. Ives sells insurance; Boulez sells himself. Sibelius stands outside time, staring at the Nordic landscape; while Richard Strauss and Dmitri Shostakovich survive totalitarianism in very different ways.

In the case of the Soviet composers, including Shostakovich, battered by the whims of Stalin's culture police, Ross admirably rejects the easy retrospective moralising characteristic of hack polemicists: "These composers were neither saints nor devils; they were flawed actors on a tilted stage." He rejects, too, the simplistic claim that Shostakovich was always being "ironic" when he appeared to toe the official musical line. "To talk about musical irony, we first have to agree on what the music appears to be saying, and then we have to agree on what the music is really saying. This is invariably difficult to do." A wise warning, which Ross himself mostly heeds.

Even the case of Richard Strauss, who served as Hitler's music tsar, is one that attracts Ross's baffled sympathy. Strauss "warmed to Hitler", Ross argues, "chiefly because he thought that under the aegis of this music-loving chancellor he would be able to enact a series of long-dreamed-of reforms" in the fields of composers' royalties, copyrights and so on. Strauss's behaviour is certainly "dismaying", Ross says; and yet his art actually flourished, uncompromised by politics. This, Ross argues, is finally just inexplicable. "That [Strauss's] return to form should have happened against a backdrop of genocidal insanity is the kind of paradox that Thomas Mann addressed in Doctor Faustus."

In the rubble of Berlin, the Germanic tradition came to be regarded as irredeemably tainted. In a way, Ross suggests brilliantly, the whole subsequent course of modern music was set during the late 1940s by the Psychological Warfare division of Allied Supreme Command, which decided that the Germans needed "reorientation". One of this mission's cultural effects was to encourage a new musical aesthetic of anti-populist intellectualism among the young composers invited to the summer schools in Darmstadt, while the "denazified" stars of the old regime such as Furtwängler and Von Karajan carried on as before. A little later, when Olivier Messiaen comes to liquidate traditional rhythms in his music, Ross glosses the decision devastatingly: "There had been enough of the old one-two-three-four during the war."

The book achieves a remarkable interdisciplinary synthesis, in which music illuminates history as well as vice versa. Throughout, Ross fluently switches tempo and focus, between super-elegant New Yorker-style profiles of representative artists, and widescreen pans across whole movements and cultural periods, zooming in unerringly on fascinating detail. But what really sets his writing apart is the language he has forged to evoke sound. On The Rite of Spring: "Having assembled his folk melodies, Stravinsky proceeded to pulverize them into motivic bits, pile them up in layers, and reassemble them in cubistic collages and montages." On Messiaen's From the Canyons to the Stars: "There is a supernova of A major, billowing into the lowest and highest reaches of the orchestra and whiting out in fortissimo strings." ("Whiting out" is perfect.)

Ross writes that Philip Glass's music "gives off a kind of Times Square neon glow", and reaches a peak of sensuous glee in talking about the "stupefying sound" of Iannis Xenakis's "meticulously planned bedlam". Readers will need iron discipline, or forbidding overdrafts, to make it to the end without having ordered a stack of CDs.

Ross also periodically drops little bombs of aphoristic analysis. On the 1923 invention of 12-tone music, he writes: "In the mad year of hyperinflation, Schoenberg offered a kind of stabilization - the conversion of a chaotic musical marketplace to a planned economy." Analysing the obsessive leaning on a single note in Kurt Weill's "Mack the Knife", Ross concludes: "It's a pop tune with no exit." (The allusion to Sartre is as provocatively interesting as it is casual.) Of the postwar American composers led by Aaron Copland, he writes: "Climaxes transpired in high Shostakovich style, all pealing trumpets and precisely pounding timpani, the better to punch through the fuzz of radio static" - one of several points in the book where, almost offhandedly, he makes a crucial point about technology's influence on artistic style.

It is probably inevitable that the book should fizzle out somewhat as it draws towards the present day, with references to Thomas Adès, Radiohead and Björk, a rapid tour of Chinese music, and gestures towards the increasing interpollination of conservatoire music with electronica and heavy metal. But our first question still haunts the book at its finish: what is a composer? Ross generally reserves the term to mean someone who writes "classical music"; but he has not explicitly defined what he means by "classical" either. In a sense the term was already anachronistic at the beginning of the 20th century.

Jazz is the elephant in the room. Duke Ellington is treated respectfully, but no other jazz musician is called a "composer" - even granting their supernatural habit of improvisation, a lot of them still drew dots on manuscript paper like everyone else. Charlie Parker pops his head around these pages mainly to pay his respects to Stravinsky; John Coltrane and Miles Davis have walk-on parts chiefly so as to inspire Steve Reich. At the same time, some of the "classical music" discussed is of vanishingly small importance, as a few composers abandon more and more control over musical outcomes (a process encouraged by John Cage in mid-century, but as Ross rightly notes, already begun with Schoenberg's 12-tone technique), stressing the idea of "composition" to snapping point.

One cited "score" by the American La Monte Young runs, in its entirety: "Piano Piece for David Tudor #3: Most of them were very old grasshoppers." It's a cute joke, and any particular performance of it, under the hands of a skilled pianist, would be interesting. But, except that it represents one absurdist horizon of "classical music", the question of why it should be accorded more attention than the work of, say, Cole Porter is not addressed. Reich is quoted as saying that he was influenced by jazz and rock (Bob Dylan), but Ross leans more heavily on Reich's own subsequent influence on popular music. It is almost as though non-"classical" musicians throughout this story are presumed to be idiots savants, their innovations only considered real once they have been appropriated by "classical composers" presenting them to a concert-going public.

Even so, within his somewhat arbitrary parameters of "composition", Ross has delivered a sound-drenched masterpiece. At the end, one is left to reflect on the superbly ambiguous title. One possible reading - everything I don't write about is not music - can be dismissed. But a rest is also the structured absence of a musical note; the title plays on the practices of Cage, Stockhausen, et al; and it poses a challenging question about ends, and whether they may be followed by new beginnings. The exhaustion implied by the allusion to Hamlet is tempered with exhilaration at what the book has made raucously new.