Q: I need to come up with $5,000 quickly and only have two ways to get it: by putting it on a credit card and paying 24% interest or pulling the money out of my traditional IRA and getting hit with an early withdrawal penalty. Which is my best option?

As a financial advisor, I often tell people that decisions like this come down to whichever choice is mathematically favorable. However, in cases like this it can be surprisingly complicated.

Perhaps the biggest variable in your situation is how long it will take you to pay off the credit card. For example, if you can pay the credit card balance off in five months, you'll only end up paying about $300 in interest, which is just 6% of the $5,000 you need. Meanwhile, the IRA early withdrawal penalty is 10%.

On the other hand, if you can only afford to pay say, $200 per month, it will take three years to pay off the balance and you'll pay about $2,000 in interest, or 40% of the amount you're borrowing.

Mathematically speaking, in the first scenario, you're better off using a credit card. In the second, it's probably a better idea to just pay the early withdrawal penalty.

As a final thought, another variable to consider is that by taking money out of your IRA, you're effectively robbing your future self. You can't put the money back into your IRA at a later date, and an early withdrawal could have a huge effect on your future retirement wealth.

The Motley Fool has a disclosure policy.