A university lecturer unveiled a new formula yesterday to predict the likelihood of Sod's Law - but, thankfully, also revealed the key to avoiding its pitfalls.

Factors such as inconvenience and background stress would influence events like toast falling butter-side down or spilling something on your clothes before a date, the study found.

But the new rule - using six variables based on state of mind and the impact of the task going awry - found preparation was crucial in avoiding such an unhappy outcome.

The formula, designed for Liverpool Victoria, challenges the long-held definition of Sod's Law that "anything that can go wrong, will go wrong", and uses Task Importance (Ti); Inconvenience, and financial and emotional cost of task not going to plan (I); Optimism - the tendency to think everything will work out fine (O); Background Personal Stress Levels (Sb); Extent of Planning (P); and Memory - especially for things that worked out well.

Using a scale of 1-5 for each factor, the minimum chance of Sod's Law striking is a score of 0.3 and the maximum is a score of 17.5.

Mathematically, it is expressed as: 1[2044]8Ti x I3[2044]8 + O + Sb P + M

Lecturer Cliff Arnall, who designed the formula, said: "There are a number of mistakes we make, all of which contribute towards the likelihood of something going wrong.

"Sod's Law tends to strike in direct proportion to the importance of the task; other factors such as planning ahead and the inconvenience of said task not going to plan are also crucial.

"The formula uses both emotional and organisational factors, because mental impact and the ability to foresee possible problems - and make provisions for these - are the enemies of Sod's Law."