I'm currently reading Collin Moshman Math of poker. Since I'm not good with math, could anybody help me with this pot odds example he wrote?

It said an opponent bet $7 into a pot of $10, and you want to raise and offer him 2:1 odds. and 3:1 odds.

I don't really understand the calculation behind, if we were to call the pot will become $24. so to make 2:1 we need to make a pot size raised of $24 on top of the $7 call, thus we would raise to $31. What's the calculation behind this? I mean do we raise $24 or $31?