If you've gotten frustrated with a friend — or yourself, for that matter — for not leaving a relationship that was clearly not going well, you may now have an explanation for why this happens so often.Researchers from the University of Minho in Braga, Portugal, hypothesised that people stick around when relationships go downhill due to the "sunk cost fallacy." This is the same cognitive bias that leads us to sit through a movie we don't like because we've already paid for it, or finish a project that's going nowhere just because we've already put so much energy into it.The basic pattern is that, once we've become invested in something, it's harder to let go of it. And according to the study, published last week in Current Psychology , the same goes for relationships.To find out how various types of "sunk costs" can affect people's decision to stay with their partners or leave them, the authors conducted two experiments. For one, they had 902 people read about four different versions of a relationship; each new version had an altered amount of time, money, and effort invested in it."In the last few months, you have been feeling unhappy with your relationship," the description read. "For example, little things turn into big discussions and you feel that you can no longer communicate with your partner. You have not had sexual relations, for a few months now, and you stay at work after hours to delay the moment to return home. Due to this problem with your partner you feel lost and distressed and believe you would be happier if you were no longer in that relationship."Sure enough, people who had put a lot of effort into making their partner happy and keeping the spark alive, as well as those who had spent money on a house with their partner, were more likely to say they'd stick around, even when it got bad. Money was especially likely to affect men's decisions.For the second experiment, the authors presented 275 people with another hypothetical scenario about a relationship they'd spent either a year or 10 years in. People who were told they'd already been with their partners for a decade stuck around for 294 days longer on average.Operating according to sunk costs is generally considered irrational by psychologists, since you can't get back what you've invested by seeing something through to the end, and you'll likely just end up wasting more resources."Together, both experiments confirmed the initial hypothesis that investments in terms of time, effort, and money make individuals more prone to stay and invest in a relationship in which they are unhappy," the authors wrote. "This option was chosen when — and taking into consideration how unhappy the person was in that relationship — the logical decision would be to finish the relationship, independently of the prior investments."The moral of the story? If you no longer want to be with someone and don't see it getting better, you may want to trust that instinct. What you've put into that relationship in the past doesn't necessarily have to determine its future.