The choices available to the flagellated bacterium, E. coli, are quite limited. It can either 1) propel itself in (approximately) a straight line; or 2) tumble end over end. The bacterium effects these behaviors by rotating the whip-like flagella which cover its body. Clockwise rotation of individual flagella results in a coherent rotation of the ensemble and propels E. coli through the water in approximately a straight line (in a constant heading). Counter-clockwise rotation of individual flagella produces an incoherent rotation of the ensemble which causes E. coli to tumble end over end (randomizing its heading).
Despite its limited behavioral repertoire, E. coli manages to find food. It achieves this by increasing or decreasing its tumbling rate depending upon the sign of the time derivative of the concentration of chemical attractants produced by decaying organic matter. That is, if the concentration of attractants is increasing, E. coli tumbles less frequently (because it is moving in the right direction). Conversely, if the concentration of attractants is decreasing, E. coli tumbles more frequently (because it is moving in the wrong direction). To the chagrin of humans everywhere, this simple strategy unfailingly guides the bacterium to the source of the chemical attractant.