Bathroom and kitchen waste traps or u bends remain a mystery to some people but the principle of the trap, be it a P trap, U bend, Gully trap, S trap, bottle trap, pedestal trap, shower or bath trap is exactly the same.

P Trap containing water and indicating incoming and outgoing water
All waste gives off gas and when you flush the toilet or drain the sink or bath, the water disappears out of your house to connect somewhere outside with the main drainage. The drainage which deals with everything except rain water is called foul drainage, and every foul drain pipe ends up in a foul water man hole or inspection chamber.
As you might imagine a great deal of toilet and bathroom waste leads to a great build up of foul gas and the gas tries to escape back up the pipes or through any other aperture it can get through.
If it manages to get back up a pipe it could, were it not prevented, get back into the room from where it came. Enter the trap! A trap, of any kind is utterly useless on its own, its not until it has water in it that it becomes useful. The water sits in the U bend where it forms a blockage for gas trying to get back into the room.
The water will sit just below the level of the outlet bend (seen in the image left where it says, waste out) until more water is introduced from the incoming pipe. The incoming water will replace the water in the trap and push it out of the outlet. This principle works on all traps.

Bottle or pedestal waste trap

S bend waste trap

Shower waste trap

Gulley waste trap

Toilet U bend indicating water level

Shallow bath or shower waste trap
With bottle, pedestal and shower traps, the trap element in the equation is not obvious, but inside the work is done in the same way. Water coming in replaces the water which is forced out. This can be seen in the diagram below.

Inside of a bottle waste trap
Different traps are produced for different situations. A bottle trap is long and thin and will not take up so much room in a kitchen unit or under a basin.
Bottle waste traps are usually made of plastic but chrome plated versions are available for most applications. This type of trap can be hidden behind a pedestal although proprietary pedestal traps are a little longer.
Shallow traps are made to fit under the confined spaces found with baths and showers and a shower trap does much the same job but usually includes a removable top section to enable hairs etc to be cleaned out.
Sometimes, when removing a plug from the basin or bath, a gurgling sound can be heard coming from other pipework close by. This phenomenon is explained in our gurgling pipes project and the problem is easily overcome.
The noise is made because the speed with which the waste water is escaping forms a partial vacuum behind it which sucks water out from other traps. Now there are anti vacuum traps available to make it even easier to resolve this problem.