# Hanging Around with Mathematics

# BLOG: Heidelberg Laureate Forum

Imagine you are hanging a picture on the wall – like this photo of 2006 ACM A.M. Turing Award laureate Frances Allen. You have two nails already hammered into the wall so they are sticking out an inch. Your picture is in a frame, with a piece of string attached at the top two corners, and you can hang it on the wall by hooking the string over the two nails.

If either of the nails was pulled out of the wall, your picture would remain hanging – since the string passes over both nails, removing one nail would leave the string looped around the remaining nail, and the picture would still hang.

But what if we wanted something different to happen? What if we wanted to be able to hang the picture so that **as soon as any single nail is removed, it falls off the wall?**

It sounds impossible, but there is a way to arrange the string that achieves this. I will leave the solution until later in the post, to give you time to think about it. It is not as simple as just placing the string over the top of the two nails, but can be done by winding the string around the nails in a particular pattern (and assumes the string can be as long as you need to achieve this).

### Why Am I Hanging Pictures?

This might not feel like a particularly mathematical topic: hanging a picture on the wall seems like a simple enough problem that we do not need to involve mathematics. But of course, as always, there is some more advanced maths hiding in there. The idea of passing a string over a nail, or indeed wrapping it around the nail in a more complicated pattern, can be described mathematically.

Consider the clockwise and anticlockwise turns the string makes as you go along its length. For example, the standard put-the-string-across-the-top-of-both-nails approach means going clockwise over the first nail, then clockwise over the second.

We could denote the two nails \(A\) and \(B\), and denote a clockwise turn by writing the letter for that nail – so the standard hang would just be \(A\cdot B\). If we wrapped the string twice clockwise around one nail before going over the other, we could write this as \(A\cdot A\cdot B\).

We can think of an anticlockwise turn as being the inverse of a clockwise turn around the same nail: If we were to perform one after the other, they would cancel out:

It would be conventional to denote the anticlockwise move around nail \(A\) as \(A^{-1}\), and if we performed the hanging operation \(A\cdot A^{-1}\cdot B\), the first two moves would cancel out – in practice, the string would not actually be fastened to the first nail at all, and if a heavy picture was hanging on it, you would just be left with the string hanging over nail \(B\).

These hanging operations behave like algebraic objects in a group structure (for more on groups, see this post I wrote in 2019). In the article, I talk about the property of **commutativity**, using the example of addition and numbers. Elements which commute are ones which can be combined in any order – for example, we know that with numbers, 2 + 4 = 4 + 2.

But in some groups, the objects must be combined in the specific order given, and changing the order will give a different result – and this applies to our picture hanging setup. For example, the configurations \(A\cdot B\) and \(B\cdot A\) are obviously different:

If we have a configuration that involves using a hanging operation and its inverse, they will only cancel out if they are next to each other in order: \(A \cdot A^{-1} \cdot B\) will cancel out to leave \(B\) as we saw above, but \(A \cdot B \cdot A^{-1}\) will stay hanging in place.

### Nailing Down The Problem

In order to tackle our original puzzle, we can consider what happens when a nail is removed from the wall. In the hanging operation notation, this would correspond to any instances of that letter, or its inverse, being deleted from the expression – since the nail is no longer there to hold the string in place.

We can exploit this to find a solution to our problem – finding a combination where if you remove the As, the Bs will cancel out, and vice versa. In the notation given, one solution to this problem would be \(A\cdot B\cdot A^{-1}\cdot B^{-1}\) – going clockwise over both nails, then anticlockwise over the first, then looping round to go anticlockwise over the second.

Here, if one of the nails is removed, the picture will fall off the wall: If we take out \(A\), our expression just becomes \( B \cdot B^{-1}\), and similarly if we take out \(B\) it will just be \( A \cdot A^{-1}\), both of which will cancel out and disappear. This provides a solution to the original problem as stated, but anyone who wonders how this can be extended to more nails need only look to mathematics – of course there is a pattern here.

The object \( A \cdot B \cdot A^{-1} \cdot B^{-1}\), consisting of a pair of group elements, followed by their inverses, is known as a **commutator**. It is so-called because in a situation where the elements A and B **commute** (they can swap places without changing the value of the result) the commutator will cancel out to be zero – so it can be used as a measure of whether two things have this property.

Commutators can be denoted \([A,B] = A \cdot B \cdot A^{-1} \cdot B^{-1}\), and any object from a group can be given as an input to our commutator brackets \([\ ,\ ]\) – including sequences of hanging operations. In particular, I could put in another commutator: We write \([[A,B],C] = [A \cdot B \cdot A^{-1} \cdot B^{-1}, C]\) for the commutator of the commutator \([A,B]\) with a third nail \(C\), which would be written in full as:

\[ A \cdot B \cdot A^{-1} \cdot B^{-1} \cdot C \cdot B \cdot A \cdot B^{-1} \cdot A^{-1} \cdot C^{-1}\]

Here, we alternate between the commutator \([A,B]\) and nail \(C\), and the second two instances are inverses. The inverse of \(A \cdot B \cdot A^{-1} \cdot B^{-1} \)** **is \(B \cdot A \cdot B^{-1} \cdot A^{-1} \). Here, the order of the elements is reversed, then they are flipped from normal to inverse or vice versa – resulting in something which, were it to be written directly next to its inverse, would cancel out one term at a time.

The three-element commutator given above would be the solution to a three-nail problem – if any one of the nails is removed, we are left with elements next to their inverses that would cancel out and leave the picture on the floor.

The generalised picture hanging question is sometimes called the ‘1-out-of-n problem’, since it requires a hanging which will fail if any one of the n nails is removed, and general solutions can be found by creating longer and longer commutators, inverting the whole of the existing string of terms and alternating it with the new extra term.

While this is definitely guaranteed to give a solution, it will not be particularly efficient – the length of the expression will grow exponentially. Luckily, alternative solutions to this problem using shorter strings of terms (and correspondingly, shorter lengths of string to hang the picture) can be found by other methods, and a nice write-up is given in this research paper, which connects it to the theory of mathematical knots and links.

Meanwhile, commutators are an important and useful tool in studying groups, and have many serious mathematical applications in understanding pure mathematical group structures, and in other areas like quantum mechanics. But I believe that it is their usefulness in hanging pictures, in a very specific and unnecessary way, that means they should formally be categorised as applied mathematics.

Katie Steckles wrote (13. Mar 2024):

>

[…] You have two nails already hammered into the wall so they are sticking out an inch. Your picture is in a frame, with a piece of string attached at the top two corners>

[…] These hanging operations behave like algebraic objects in a group structure>

[…] a hanging operation and its inverse, they will only cancel out if they are next to each other in orderIf the operation and its inverse

“are next to each other”(either appearing as consecutive symbols in a formula, or appearing actually/physically as the corresponding consecutive “turns of the string”) then their order actually doesn’t matter;neither in the described physical situation of hanging the picture by its string on two nails,

nor in a corresponding formula.

(Otherwise it’d be necessary and appropriate to distinguish “left inverse” and “right inverse”.)

>

[…] cancel out to be zeroThe cancellation of an operation and its inverse actually leaves the Identity element of the group.

In terms of formulas, such a cancellation “leaves the (leading and trailing) remainders of the formula in place” (leading the formula to become that much simpler); unless these “remainders” are both “blank” and the identity element remains formally “as such”.

In terms of physical hanging operations, such a cancellation corresponds to “the string slipping free”, leading “the given tangled mess of string” to become that much “less tangled”; and if the remaining arrangement therefore fails to provide any “hanging support” anymore, then the picture would drop.

In short (and in hindsight):

Yes — the identity element operation of the group indeed corresponds to “providing zero additional hanging support to” the given string arrangement (on the given nails)

.

>

[…] to hang the picture so that as soon as any single nail is removed, it falls off the wall?>

[…] can be done by winding the string around the nails in a particular pattern (and assumes the string can be as long as you need to achieve this).>

[…] there is a way to arrange the string that achieves this. I will leave the solution until later in the post,This seemed to hint that there is only one solution to “the two nail problem” presented above; perhaps with only rather trivial variations (such as “mirroring”).

>[…] a solution to our problem […] [(1):] going clockwise over both nails, then anticlockwise over the first [left], then looping round to go anticlockwise over the second [right]. Here, if one of the nails is removed, the picture will fall off the wallThe corresponding picture from the SciLog article above …

[ link moved to the comment memo, for SciLog-comment-tactical purposes. — FW ]

… as well as the corresponding

»Fig. 1(b): Solution to the two-nail puzzle«…… are indeed noticably asymmetric and suggestive of a second mirror-related solution:

.

To either of these two solutions, the corresponding exact inverse (i.e. the clock-inverse hanging operations in inverse order) are solutions to the two-nail puzzle as well, namely:

and

.

However: There are other “visually even more symmetric” solutions known

… see the lower picture here (https://laurentlessard.com/bookproofs/wp-content/uploads/2018/02/pictureframe2.png) …

namely:

complemented by (the similarly symmetric solution, which is the exact inverse of solution

(5)):.

These six distinct solutions all consist of four separate “hanging operations”; in different suitable orders.

and these six distinct solutions are therefore surely

the shortest solutions to the two-nail puzzle(perhaps with some advantage to solutions(5)and(6)in terms of the actual lenght of string being minimally required).Also, by “carrying out” these six shortest solutions repeatedly successively (not completely regardless of order, but surely with several choices of order), infinitely

many longer solutionscan be found (disregarding “practicalities” such as the available length of string, or “the finite space around the nail heads”).In turn, these can be suggestive of additional solutions (which are not successions of the six shortest solutions at all), such as

etc.

สุขภาพที่ดีเป็นพื้นฐานที่สำคัญสำหรับการมีคุณภาพชีวิตที่ดีในสังคมปัจจุบัน การดูแลสุขภาพที่ดีไม่เพียงแต่เป็นเรื่องของการรักษาโรคและการออกกำลังกายเพื่อความแข็งแรงของร่างกายเท่านั้น แต่ยังเป็นการรักษาสุขภาพจิตการสร้างความสุขในชีวิต และการเสริมสร้างความสัมพันธ์ที่ดีกับผู้อื่น การมี สุขภาพที่ดี ในสังคมปัจจุบันไม่ได้หมายถึงการรักษาโรคและป้องกันการติดเชื้อเท่านั้น แต่ยังเกี่ยวข้องกับการรับรู้ถึงสุขภาพจิตและความสมดุลทางจิตใจการดูแลรักษาภาวะในด้านทั้งร่างกายและจิตใจจึงเป็นสิ่งสำคัญในการพัฒนาชีวิตที่มีคุณภาพและมีความสุขในสังคมปัจจุบัน การสร้างสังคมที่มีสุขภาพที่ดีนั้นต้องมีการสนับสนุนจากทุกภาคส่วนของสังคม ไม่ว่าจะเป็นการสร้างพื้นที่สำหรับการออกกำลังกาย การส่งเสริมการบริโภคอาหารที่มีประโยชน์ หรือการสนับสนุนให้มีการพัฒนาทักษะด้านสุขภาพจิตและการปรับตัวในชีวิตประจำวัน ทุกคนมีส่วนร่วมในการสร้างสังคมที่มีสุขภาพที่ดีและมีความสุขในกันและกัน