You can find various mathematical solutions to this problem, but here's one that's typical and also clearly written. (scientificamerican.com)
Hmmm... surrender looks a better mathematical solution in that case. (personalfinanceplan.in)
Author Garth Sundem offers mathematical solutions for everyday dilemmas like these in his wacky new book, Geek Logik: 50 Foolproof Equations for Everyday Life. (bookpage.com)