Bach's biography: Prince Leopold's court in Cöthen (1717 - 1723)
A friendship with Prince Leopold, the tragic passing of his first wife Maria Barbara, a marriage to his second wife Anna Magdalena - Bach's years in Cöthen were both eventful and challenging.
After initially being prevented from taking up the post of Kapellmeister to Prince Leopold by Duke Wilhelm Ernst, Bach left Weimar on 2 December to claim the position. He soon became friendly with the talented Prince, who was proficient on the harpsichord, violin and viola da gamba, even playing informally with the court musicians - contrary to court etiquette.
Whenever Prince Leopold travelled, Bach and selected members of his orchestra would accompany him on his lengthy trips. They visited Carlsbad twice, once in 1718 and again in the summer of 1720 - but it was on returning from the second trip that Bach received the terrible news that his wife, Maria Barbara, had died four months earlier.
Despite expressing an interest in an organist's post in Hamburg, Bach continued to work in Cöthen, composing and performing sacred and secular cantatas for the Prince. Performing these works involved hiring in performers from nearby courts. One such performer, singer Anna Magdalena Wilcke, impressed Bach with her soprano voice, and they married in December 1721.
Bach's ever-growing family continued to be a driving force in his musical career, and he began to consider working in a larger city. His old friend Prince Leopold also married a young woman who didn't like him taking part in music, so it seemed like a natural time for Bach to move on to pastures new. He had received an invitation from the Margrave of Brandenburg, and it's perhaps no coincidence that he chose to revive the invitation to compose a great work, the Brandenburg Concertos, dedicated to the Margrave.
When the position of Cantor in Leipzig was opened after Johann Kuhnau died in 1722, Bach applied for the post: the city had the right education facilities for his sons, and the position had been favourably described to him. The Council of Leipsig were trying to employ fellow composer Christoph Graupner, but eventually settled on Bach as an alternative.