A meeting between Bach and Frederick II of Prussia ("Frederick the Great") on May 7, 1747, taking place at the King's residence in Potsdam, came about because Bach's son Carl Philipp Emanuel was employed there as court musician. Frederick wanted to show the elder Bach a novelty, the fortepiano (what we call the piano, which had been invented some years earlier. During his visit , Bach, who was well known for his skill at improvising, received from Frederick a very long and very complex musical theme on which to improvise a three-voice fugue. He did so, but Frederick then challenged him to improvise a six-voice fugue on the same theme. Bach answered that he would need to work the score and send it to the King afterwards. He then returned to Leipzig
Two months after the meeting, Bach published a set of pieces based on this theme which we now know as "The Musical Offering" (his last major work). Bach inscribed the piece "
Regis Iussu Cantio Et Reliqua Canonica Arte Resoluta" ("the theme given by the king, with additions, resolved in the canonic style"), the first letters of which spell out the word ricercar, a well-known genre of the time.
The Ricercar a 6, a six-voice fugue (called by Bach "The Prussian Fugue") which is regarded as the high point of the entire work, was put forward by the musicologist Charles Rosen as the most significant piano composition in history.
Here is a delightful scene of the aged Bach (he was dead within 3 years) devout Lutheran, never more than mildly successful in life, meeting the 35 year old Frederick, atheist, highly educated, a friend of some of the outstanding philosophers of the time from a tv series in 4 parts from 1985 named "Johann Sebastian Bach" (an East German/Hungarian collaboration). The initial music at 0:00 - 0:48 is one of the King's own pieces: Flute Concerto No. 3 in C Major (1st movement, Allegro).
Bach's rising to the challenge of the arrogant young King is uplifting.
Don't miss the other musicians' reaction at the end.
BTW: Frederick did play the flute well and he wrote the Flute Concerto.