Fairy Tales and Pythagoras

Hans Christian Andersen is best known for his world-famous fairy tales, including The Princess and the Pea, The Ugly Duckling, The Little Mermaid, and The Emperor’s New Clothes. However, what most people don’t know about the Danish author is that he once wrote a poem about the Pythagorean Theorem. This poem seems like a praise of Euclidean geometry, but Andersen actually uses it to get back at his critics and their conservative views. It therefore tells us a lot about Andersen’s personal interests and his views on society.

An oil painting portrait of Hans Christian Andersen in a black tuxe and bowtie leaning over the back of a red wooden stool. He is facing to the right. He has short slightly curly hair.
1836 Portrait of Hans Christian Andersen.
Image credit: public domain via Odense City Museums.

Who was Hans Christian Andersen?

Andersen was born in 1805 in Odense (at that time the second-largest city in Denmark) and grew up in poverty. His mother was a washerwoman, and his father was a cobbler who introduced him to the world of literature. He died when Andersen was only eleven years old, and his mother remarried shortly after.

At the age of 14, Andersen left Odense for the country’s capital, Copenhagen. He spent three difficult years there trying to make a name for himself as a dancer, actor, and playwriter – but without much success. Eventually, Andersen received a scholarship to attend a Latin School in Slagelse. However, this time was overshadowed by his relationship to the school’s rector, Simon Meisling. He was a strict and intimidating character whom Andersen was even afraid of at times. When the headmaster transferred to another school, Andersen went with him, living with Meisling’s family for the remainder of his studies. He eventually got permission to sit his final exams in Copenhagen, which he passed in 1828, aged 23. After that, Andersen chose not to attend university and instead dedicated himself to his writing career. Discovering a passion for travel, he began to visit numerous countries in Europe whilst writing full time. He started to publish his first novels, poems, and stories. Andersen’s first set of fairy tales was released in 1835 and brought him his first unexpected successes. Due to the economic benefits of the genre, Andersen decided to write more such stories, eventually becoming the ‘fairy tale author’ he is known as today. He died in 1875 near Copenhagen, in a house called Rolighed (Quietude).

Besides his famous tales, he also wrote three whole autobiographies throughout his lifetime, the most famous one being The Fairy Tale of My Life. This title suggests that many of his writings were influenced by his own experiences such as his upbringing, travels, and personal interests. Another example that hugely influenced Andersen is his much lesser-known passion for science and technologies.

The Scientific Andersen 

Most people don’t know that Hans Christian Andersen had a keen interest in the sciences and technologies of his time. For example, he admired railway travel and photography (the most cutting-edge technologies of the 1820s). This passion was largely fueled by his close friend and mentor, Hans Christian Ørsted. The famous physicist had laid the foundations of electromagnetism in 1820 as a professor at the University of Copenhagen, which is where he met Andersen. The pair often discussed their mutual world views, including their enthusiasm for technology. This is reflected in some of Andersen’s more scientific fairy tales like A Thousand Years From Now. In this story, Andersen writes that Americans will fly across the Atlantic Ocean in airships to visit the old monuments in Europe, thereby predicting the existence of airplanes and commercial tourism many decades before it became reality. He also foresaw the building of a tunnel under the English Channel that would connect England to the mainland.

Andersen was thus not only a truly gifted writer, but also a pioneer thinker with a great enthusiasm for technological progress. He and Ørsted often debated the relationship between science and literature, and Andersen always maintained that a good author should be aware of the scientific advancements of his time. On this basis, one could speculate that the same scientific interest also influenced another of Andersen’s works: a poem on the infamous Pythagorean Theorem. There is however much more behind it than first meets the eye.

The Eternal Magic of The Shape 

In 1831, while traveling around Europe, Andersen wrote his often-overlooked poem The Eternal Magic of The Shape (or Formens Evige Magie in the orginal Danish version). A full version of the poem, together with its English translation, can be found here: 


It is a rather long poem, containing what is probably the only verse version of a proof of the famous Pythagorean Theorem. In the first part of the poem, Andersen seems to pay tribute to geometry and its “Magister Matheseos” – a Greek nickname for the theorem, which could be translated with ‘Fundamental Theorem of Geometry’. However, upon taking a closer look, one realizes that Andersen does not actually talk about the eternal magic of the geometric shapes, but rather about the form of poetry.  

Through his poem, he criticized his own critics, who often attacked Andersen’s early writings and their unconventional form. Andersen did not want to obey societal norms on what poetry should look like. For him, it was ‘content over form’, but for his critics, it was the other way around. By writing a poem about the Pythagorean Theorem, Andersen demonstrated that he could write about any topic – even the most formal of all: a mathematical proof. But for him, this was not true poetry. Form should be secondary to the poet’s intuition and his creative freedom. This attitude can also be seen in many of the expressions used in his poem. 

A profile black and white photograph of Hans Christian Orsted facing to the right. He is wearing a clergy outfit. He has some gray hairs within his dark hairs.
Hans Christian Ørsted
Image credit: public domain via Wikimedia Commons.

Making Soup on a Stick

At one point, Andersen says that he will “make soup on a stick”. This seems like a rather strange expression, and one will have to dig a bit deeper to understand its true meaning. The phrase goes back to an old folktale (most likely of Portuguese origin), in which a visitor comes into a village, telling people he could make soup by only placing a stone in a pot. The villagers are keen to see this, and they each offer some basic ingredients. When added together, the result is a good soup, made from ‘only a stone’. Later variations used similar expressions like ‘making soup on a stick’. In fact, Andersen wrote his own version of the story in his fairy tale Soup From a Sausage Skewer (1858).

The expression means ‘making something out of nothing’, which is exactly what Andersen is doing in his poem: he is making poetry out of something rather non-poetic: mathematics.

Plucking a Prose-Heather 

Similarly, Andersen announces that he will “pluck this prose-heather”. Heather (or lyng in Danish) is a stubborn plant that is difficult to harvest. It is a weed that yields nothing of use, just like the topic of Andersen’s poem (in his eyes). The Pythagorean Theorem is like a ‘prose-heather’ which he is trying to pluck apart by writing “so-called poetry” (Andersen’s words) about it.

Pythagorean Poetry

The second part of the poem consists of the actual proof of the Pythagorean Theorem. Andersen introduces the theorem to the readers, makes some preparations, gives the proof (in a rather cumbersome way), and finally ends with some remarks. 

Interestingly, the same structure can be found in Andersen’s likely old mathematics schoolbook: Hans Outzen Bjørn’s Geometrien. At one point, there appears to be a gap in both Andersen’s and Bjørn’s proofs. Bjørn explains this missing step in an earlier established result; Andersen however does not. Additionally, Andersen seems to have taken the expression “Magister Matheseos” from Bjørn’s book, together with his notation. Lastly, both proofs are accompanied by an illustration to make it easier for the reader that demonstrate a remarkable semblance to Euclid’s Elements, Book I, Proposition 47 that proves the Pythagorean theorem.

A right triangle ABC facing hypotenuse down with each edge having a square built off of it. At angle BAC there is a line AKL that splits it up. To the left of the line the squares are pink and to the right the square are blue.
Euclid’s Elements, Book 1, Proposition 47.
Image Credit: public domain via Wikimedia Commons.
A color photo of a book that contains German text of Bjon's proof.
Bjørn’s Proof of the Pythagorean Theorem
The book is from the private collection of Dr. Toke Knudsen, photograph taken by Michael Forster Rothbart, copyright permission obtained.

Upon comparing Bjørn’s and Andersen’s figures, it becomes obvious that they are almost identical. All these factors indicate that Andersen most likely used Bjørn’s textbook as a template to reconstruct ‘his’ proof of the Pythagorean Theorem, probably copying Bjørn’s line by line. 

From his autobiographies and diary entries we know that Andersen often struggled with mathematics at school. It is therefore highly likely that Andersen picked the topic for his poem not out of personal interest, but to demonstrate that he could write about anything, even mathematics. 

Hans Christian Andersen therefore was much more than just a fairy tale author. He was a versatile writer who did not let his critics discourage him from his unconventional style. This is demonstrated in his often-overlooked poem The Eternal Magic of The Shape, in which he hides his rebellion against societal norms behind a mathematical façade. For this, the poem certainly deserves more attention.

Isabel Kestler


Andersen, Hans Christian, The Fairy Tale of My Life: An Autobiography (New York: Paddington Press, 1975)

Bjørn, Hans Outzen, Lærebog i Geometrien indeholdende plan Geometrie, Stereometrie og plan Trigonometrie (Odense: S. Hempel, 1833: 3rd edition)

Bredsdorff, Elias, Hans Christian Andersen: the story of his life and work 1805-75 (London: Phaidon Press Limited, 1975)

De Mylius, Johan, “Our time is the time of the fairy tale”: Hans Christian Andersen between Traditional Craft and Literary Modernism’, Marvels & Tales, 20 (2006), 166-178

Grum-Schwensen, Ane, ‘Little Hans Christian and great Hans Christian: the poet and the scientist’, Interdisciplinary Science Reviews, 30 (2005), 349-355

Nash, Jane Møller, The Eternal Magic of The Shape, [n.d.], [accessed 08 August 2022]

Rasmussen, Michelle, ‘Hans Christian Andersen, ‘Poetry’s California’, and Scientific Optimism’, Science & Culture, 2 (2013), 38-42

Zipes, Jack, Hans Christian Andersen: The Misunderstood Storyteller (New York: Taylor & Francis Group, 2005)

What do you think of this article?

Scroll to Top