This is a question for XKCD, but I'll try my best anyway.enginieri said:Detecting a threat is somewhat easy.
The almost impossible part is building a superweapon capable of dealing with any significant incoming object for monetary and political (international) reasons.
Take a 2 km iron asteroid with a mass of 20.000.000.000 tons coming to us at 30 or more (can be much much more) km/s, how do you deflect THAT in time?
First up is how much you need to deflect it. The Earth's radius is 6371 km (but let's say 7000 for safety). An asteroid aimed directly at the center of the Earth would need to be deflected this amount to prevent it from hitting. An asteroid not aimed dead-center would need to be deflected less.
The change in velocity needed depends on the amount of time until the object hits with a greater change needed for a shorter period of time. You take your 7000 km and divide it by the number of seconds until impact to determine the number of km/s of deflection needed. For instance, if you have a full year that's some thirty-one and a half million seconds which means a difference of 0.00022 km/s (22 cm/s).
Kinetic energy is derived from equation KE = 1/2 * m * v^2. Changing the velocity of a twenty trillion kilogram ton rock by .22 m/s would require 484 billion joules or 116 tons of TNT. Assuming you still have your year left when you plant the bomb.
The full equation for the joules needed to save Earth is:
E = 1/2 * m * ( r / t ) ^ 2 where
E = Energy needed in Joules
m = Mass of the Asteroid in kilograms
r = Radius of the Earth in meters (7 million for safety!)
t = Seconds until impact
You can see that halving the time means quadrupling the energy, so it's best to deal with these things in a hurry lest preserving Earth go over budget!