Mathematicians have found more than 177,000 distinct ways to knot a neck tie.

A previous study by researchers from the University of Cambridge demonstrated a mathematical language describing tie knots which showed that only 85 different knots were possible.

Mathematician Mikael Vejdemo-Johansson of the KTH Royal Institute of Technology in Stockholm, Sweden, became interested in the subject after watching a YouTube tutorial which showed how to copy a knot worn by Matrix villain, The Merovingian.

Vejdemo-Johansson looked up the Cambridge paper by Thomas Fink and Yong Mao and noticed that fancier knots were not included in the study published in the journal Nature in 1999.

The pair had used an existing tool from logic — known as formal language theory — to express the basic rules of tying a neck tie as a series of symbols.

This included things like the placement of the tie, the direction of the fold and the need to end in a final tuck.

Fink and Mao had made two assumptions about tie knots that drastically reduced the number available.

They assumed that people would only make a tuck — folding one end of the tie under the rest to complete the knot — at the end of a given tying sequence, and that all knots would be covered by a flat stretch of fabric.

Those assumptions did not hold for the elaborate knots found in The Matrix, which can involve several tucks and many folds and edges.

Vejdemo-Johansson and colleagues set about rewriting their language so it would include the more elaborate ties.

The existing language described the process of tying a knot as a sequence of motions between the left, centre and right of the chest, moving the tie either away or towards the chest, ‘New Scientist’ reported.

Vejdemo-Johansson’s team realised they could just describe moves as windings either clockwise or anticlockwise around the passive end of the tie, plus a tuck move. This allowed them to include much more elaborate ties.

They also changed an important rule: the limit to how many winding moves you can make before your tie gets embarrassingly short.

Fink and Mao placed the limit at 8 for classical ties, but Vejdemo-Johansson’s team chose 11 instead.

Counting up all the possible windings and tucks before you hit this limit gave a total of 177,147 different tie knots, researchers said.