The Ideal Gas Law states:
PV = nRT
P = Pressure, V = Volume, n = number of moles of our substance, R = 0.08206 L atm/mol K, T = Temperature
In this case, we're solving for the number of moles -- we want to know how much dry ice to put into the keg before covering it and not kill ourselves. Just FYI, dry ice inside a cornelius keg makes a very effective bomb. Do not be fooled into thinking that this is by any means a safe procedure. You must be accurate with your calculations and pay attention to what the fuck is going on. Having a pressure regulator for your keg is a WONDERFUL idea. If you don't know what that means, and neither do any of your friends, I recommend against even attempting this. Hell, we're not even sure if we're going to attempt it.
In our case, we'll be carbonating at room temperature. About 60 degrees F. Note also that you will have to redo this calculation every time you want to carbonate a keg: The headspace and temperature will change from trial to trial.
So T = 273 + 15.5 = 288.5 degrees Kelvin.
We'll assume for safety's sake that the entire volume of the dry ice that we put into the liquid will immediate sublimate and that none of it will be absorbed into the beer. In this case, volume is simply the headspace left over. If we have, say, 4.5 gallons of beer that we're kegging, that leaves .5 gallons or 1.89 liters.
So V = 1.89 liters.
A typical cornelius keg is rated to 125 PSI. We don't want to get anywhere near that, so we're shooting for the highest PSI that we've put a keg through with our normal CO2 kegging system: 55 PSI, which is 3.74 atmospheres.
So P = 3.74.
The final equation is:
(1.89 L * 3.74 atm) / (0.08206 * 288.5 K) = 0.2986 moles.
CO2 is 44 grams/mole, so this would indicate that we need about 13 grams of CO2 to avoid blowing the top off of the corny keg and getting beer all over the basement. Question is: Is 13 grams of CO2 enough?
Conventional wisdom is that you need about two volumes of CO2 to be dissolved into your beer. At standard temperature and pressure, one mole of gas will occupy 22.4 liters of space, which is 5.9 gallons. Our piddly little .2986 moles will fail this task miserably, taking up only around half of that volume (one quarter of the total necessary volume) at 60 degrees. Not to mention the difficulties associated with measuring out just 13 grams of dry ice accurately.
More on this later, including possible workarounds.