Effect of a nuclear weapon on the Moon In some science fiction novel, there is the scenario of using nuclear weapons to deflect an Earth-approaching asteroid. 
But the question is, is a nuclear weapon really as useful on the moon or an asteroid as on Earth? 
The point is that, on the Earth, there is the atmosphere. The energy released by the bomb is absorbed by the atmosphere completely and induces huge blast. 
But on the Moon, there is no air to trap the energy. Most energy released will simply escape into the universe. 
 A: Indeed, a nuclear bomb works a bit differently in a vacuum than in the atmosphere. If you want to generate momentum, an atmosphere or some material with a low boiling point (e.g. ice) is probably better than bare rocks in vacuum, because all the heat will be converted directly into gas with a high momentum, without "wasting" energy on heating and evaporating a solid. 
There is a video on Youtube on this topic: The Use of Nuclear Explosives To Disrupt or Divert Asteroids, by David Dearborn. Some calculation examples for an astroid with 1 km diameter start around 45 minutes into the video.
Some notable facts:


*

*You generally need a really big bomb (megatons) and for a big asteroid, you may only get a few cm/s of change in velocity, which is enough to prevent an Earth collision if you do it years in advance.

*Bombs that produce a lot of energy as neutrons may work better than the ones that release the same energy as x-rays, because neutrons penetrate deeper into the asteroid surface.

*What will happen depends on the structure of the asteroid. Under some circumstances, you may get some mass ejection from the opposite side of the asteroid, which will counteract the momentum generated at the impact side. For other scenarios, the asteroid may break up in small pieces, some of which are still likely to hit the Earth.
