Locusts are grasshoppers that can exist in two distinct phases - solitary and gregarious. In the solitary phase, locusts are solitary and avoid other locusts. In the gregarious phase, locusts are attracted to each other and form destructive swarms. The phase is determined by environmental factors like temperature, food availability, and population density that influence the production of hormones. High population densities and contact between locusts causes a switch to the gregarious phase.