In 1902, when Stravinsky composed the piece, he was studying law at St. Petersburg University. He met Nikolai Rimsky-Korsakov's son Vladimir there. At this time, Stravinsky's ambition was to become a composer, since his father, Fyodor Stravinsky, was also a successful bass opera singer, but studied law out of being pressured into it by his family. However, he started coming to Nikolai's house in order to learn composition and orchestration. Very few juvenalia works from this period still remain, but some of them, presumably the ones he kept in his portfolio, survived. This was the case for his Piano Sonata in F-sharp minor and, also, this scherzo. After composing just a handful of works in these years, Stravinsky would not produce anything significant, but continued to attend private classes with Rimsky-Korsakov until the latter's death in 1908.
Stravinsky never mentioned the Scherzo specifically in any of his autobiographical writings. However, he made references to his early piano works in his conversations with Robert Craft. In Expositions and Developments, he described them simply as "andantes, melodies, and so forth". In Dialogues, Stravinsky noted that Rimsky-Korsakov's biographer had mentioned a 1903 concert of his pieces, but he stated "I have no recollection of these bagatelles". With the fall of the Russian Empire most of these early works were presumed to be lost or kept hidden somewhere. Stravinsky himself went to Russia many years later, but nobody seemed to know that the manuscripts of most of his early works were in the safekeeping of several public libraries in the Soviet Union. The manuscript score for the Scherzo was held in the Leningrad State Library in the archives of the pianist
Nicholas Richter (1879–1944). Richter was an old acquaintance of Stravinsky and the dedicatee of the Scherzo. The first known publication of the score was a facsimile of the holograph which appeared in Valery Smirnov's 1970 book Tvorcheskoye formirovaniye I. F. Stravinskovo (The Formative years of I. F. Stravinsky). A facsimile version of the piece was also published by Faber Music in 1972, just a year after Stravinsky's death.
The Scherzo did not receive any formal premiere. According to musicologist Charles M. Joseph, there has been speculation that it may have been performed privately for Rimsky-Korsakov in the summer of 1902 when Stravinsky was hoping to be accepted as his pupil. There is no evidence that Richter ever publicly performed the work, although he is known to have premiered the Piano Sonata in F sharp minor, another of Stravinsky's pieces which were dedicated to him.