It is scary to realize that some of our planet's great art is there for what at the time was an accidental circumstance.
In 1819 Moritz Schlesinger, a music publisher, met with Beethoven and bargained for 60 songs and 3 piano sonatas. These were his last three piano sonatas - the pinnacle of his Late period - and took longer because of illness and other work.
Because of these circumstances there was talk of dropping the sonatas from the contract. The Piano Sonata No. 31 was finished Christmas Day 1821.