Having successfully completed his First Symphony after a fifteen-year struggle, Brahms began composing his Second almost immediately, working on it in the summer of 1877 at Portschach-am-Worthersee and finishing the score that October at Baden-Lichtenthal. Brahms's friend, the scholar Philipp Spitta noted that 'the first two symphonies form a contrasted imaginative pair entirely characteristic of the composer, and they must be regarded as stemming from a single deeplyhidden root'. The Second Symphony opens with a fournote figure in the cellos and basses which, in various guises, acts as starting-point for other themes in the work, and this 'pre-thematic' motto has its immediate origins in the main theme of the finale of the First Symphony. Furthermore, the lyricism and joy of the Second (Brahms called it 'the happy Symphony') surely complements the dramatic journey from darkness to light of its predecessor.
Brahms invoked a sense of place for the work, writing to his friend the critic Eduard Hanslick: 'you will say: this is not a serious work of art, Brahms has been sly, the W�rthersee is virgin territory, with melodies flying around all over, such that one has to be careful not to tread on any.' Later Brahms teased friends who had not yet heard the symphony by characterizing it as particularly mournful, writing, for instance, to his publisher Fritz Simrock: 'The new Symphony is so melancholic that you will not be able to bear it. I have not yet written anything quite so sad, so 'minor': the score must appear with black borders and in mourning.'
Brahms was clearly delighted with his new work, yet, as he revealed in a letter to his friend Vincenz Lachner, he regarded it as having a dark side also: 'I had very much wanted and attempted to get through the first movement without trombones. [�] But their first entry, that belongs to me and thus I cannot do without it and also the trombones. If you wanted me to defend that passage I would have to go further. Then I would have to acknowledge that I am in addition a deeply melancholic person, that the black wings flutter continually over us, that � perhaps not completely accidentally in my oeuvre this Symphony is followed by a small discourse on the great question 'Why' [the Motet: Warum ist das Licht gegeben dem Muhseligen?, Op. 74, No. 1]. If you do not know it (the motet) I will send it you. It throws the necessary deep shadow onto the happy Symphony and perhaps explains those kettledrums and trombones.'
Brahms's characteristic integration of variation procedures into sonata form takes on new fluidity in this work, creating expressively rich diversifications of the prevailing idyllic mood. Thus in the first movement the gentle pastoral opening leads to the melancholy low brass chords, followed by a sinuous legato violin melody, an emphatic, almost violent arpeggio variant, and a brief scherzo interlude, before the second subject emerges - as a minor version of Brahms's famous cradle-song (a resonance noted by the composer himself). The development grows in energy, including strict fugato, grinding trombone and tuba entries, and a passage of climactically wide-ranging fortissimo arpeggios. The coda maintains this impetus to variation with a yearning horn solo, a waltz-like version of the opening, and more scherzo music, now combined with a brief quotation from his song 'Es liebt sich so lieblich im Lenze!'
Brahms uses his four low brass instruments in the slow movement to enrich the sumptuous opening melody on cello and so point up the contrast with the lighter dance-like middle section on woodwind; but he also characteristically infused his contrast-based forms with sonata-style developments and, during a violent working-out here, the low brass give the pre-thematic motto a sinister twist. For the third movement Brahms inverts and extends this motto into a graceful minuet melody, which he transforms in the contrasted faster sections, bringing new dance-types into play - a galopp including march-like material, and a fast waltz. In the finale each of the sonata-form sections opens quietly with a thematic elaboration of the motto; in exposition this leads to a jovial energetic variant, a sweeping largamente second subject, and a lively scotch-snap conclusion. The development introduces a more serious feel, splitting up motives, altering the key to minor, and using inversions, diminutions and augmentations. As further contrast Brahms includes a tranquillo lyrical episode here, which recurs in the coda just before the final blaze of glory, in which trombone scales and trumpet fanfares ultimately resolve the earlier, more troubled world of the low brass. The first performance was given by the Orchestra of the Philharmonic Concerts (today known as the Vienna Philharmonic) conducted by Hans Richter on 30th December 1877; the third movement was encored.
Brahms first learnt of Hungarian gypsy music from his violinist friend Eduard Remenyi in the early 1850s, and he loved it throughout his life, playing it privately and in concerts, writing variations on it, composing such melodies himself - for instance in the finale of his First Piano Quartet. He assembled his first two sets of Hungarian Dances for piano duet (Nos.1-10) in autumn 1868, noting to his publisher Fritz Simrock: 'They are incidently genuine children of the Puszta and Gypsies - not, therefore, created by me, rather just reared on bread and milk.' The dances were published in 1869 and became immediately and enduringly popular. Brahms himself orchestrated Nos.1, 3 and 10, which he performed as a group in Leipzig on 5th February 1874 and published later that year; he composed a new introduction for No.3, added extra expression and rubato marks, and enriched the orchestra with triangle, cymbals and bass drum. In sending his subsequent two sets of Hungarian Dances (Nos. 11-21) to Simrock in 1880, he noted 'Here there are a number totally of my own invention' - it is a mark of how much he had interiorised the style that we still do not know precisely how many are original Brahms. It is a further mark of this interiorisation that his concerto finales and several late chamber works use assimilated gypsy style. For his only phonograph recording in 1889, Brahms featured his first Hungarian Dance.
Brahms gave Dvorak early encouragement and the two became firm friends. Dvorak had modelled his Slavonic Dances on Brahms's Hungarian Dances and shortly after its appearance, Dvorak orchestrated Brahms's final set (Nos.17-21) himself, with an imaginative exuberance entirely worthy of his friend's example.