There are several pounds of bacteria in the large intestine. Bacteria do not belong in the small intestine in any appreciable levels. If they are present in the small intestine, gas, bloating and other digestive symptoms may ensue. When certain anaerobic bacteria (bacteria that live in the absence of oxygen) are fed certain sugars, they produce hydrogen. If there are a lot of bacteria in the small intestine (where they do not belong), a lot of hydrogen is produced. If you give a fixed amount of a sugar, like lactulose, and measure the amount of hydrogen produced, you can get an idea of how much bacteria is present in the small intestine.
Generally the patient fasts for 12 hours before the test, which begins by breathing into a balloon. The patient then eats a measured dose of a specific sugar (which will cause bacteria to produce hydrogen). Breath samples are then taken every 15 minutes for three to five hours. The test is interpreted by how much hydrogen is produced in the breath and when it is produced. It is not a perfect test; some bacteria do not produce hydrogen. The test can also be misinterpreted, but in many instances it can show if there are bacteria present in the small intestine.