Companion planting in gardening and agriculture is the planting of a second crop within the primary crop for purposes of pest control or pollination.
The second crop can also provide a habitat for beneficial insects, maximize use of space, or in some other way help increase the primary crop's productivity.
The idea of companion planting, in some of our first recorded historical accounts, comes from China, where the mosquito fern was used to help increase rice yields. The fern plays host to a cyanobacteria that converts nitrogen to a plant-usable form that the plant can use. The fern also blocks sunlight from reaching the ground, preventing weed seeds from germinating.