Final answer:
Johann Sebastian Bach dedicated 'The Musical Offering' to Frederick the Great in 1747, a collection of music based on a theme given to him by Frederick.
Step-by-step explanation:
The contrapuntal work dedicated to Frederick the Great was composed by Johann Sebastian Bach.
This work is known as 'The Musical Offering' (Musikalisches Opfer), BWV 1079, which is a collection of keyboard canons and fugues and other pieces of music all based on a single musical theme given to Bach by Frederick the Great, to whom the work was dedicated in 1747. Bach's son, Carl Philipp Emanuel Bach, who served for a time as a court musician in Berlin, likely facilitated this interaction.