Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 37 ยท Getting Started

Habitats and Niches

Understand the difference between a habitat and an ecological niche, the competitive exclusion principle, and how species share resources.

A habitat is the place where an organism lives. A niche is its role: what it eats, when it is active, how it reproduces, and how it affects other species. A common saying is that the habitat is the organism's address, while the niche is its job.

Habitat

A habitat is described by its physical features and the species found there. A rock pool, a coral reef, a mature forest and a city roof are all habitats. A small habitat inside a larger one is a microhabitat, such as the underside of a stone in a stream.

Niche

The niche includes:

  • Food: what the organism eats.
  • Space: where in the habitat it lives (canopy, soil, deep water).
  • Time: when it is active (day, night, season).
  • Conditions: temperature, humidity, or pH it tolerates.
  • Interactions: the predators, prey, and partners it has.

Two species can share a habitat but have different niches. In a forest, a hawk hunts small animals by day, and an owl hunts similar prey at night. The time part of their niches differs.

Habitat Niche
Question answered Where does it live? What does it do and need?
Example (earthworm) Moist soil Eats dead plant matter, mixes and aerates soil
Example (nectar bat) Warm caves and forests Feeds at night on nectar and pollinates flowers

Fundamental and realized niche

The fundamental niche is the full range of conditions and resources a species could use if there were no competitors or predators. The realized niche is the narrower range it actually uses because of those interactions. A barnacle might be able to live over a wide band of the shore, but competition from another barnacle species can confine it to a smaller band.

Competitive exclusion

When two species need exactly the same limited resource, one will usually do slightly better and the other will decline locally. This idea is called the competitive exclusion principle. In nature, species often avoid it by niche partitioning: they divide resources by eating different foods, feeding at different heights, or being active at different times.

flowchart TB
  A["Two species share<br/>one limited resource"] --> B{"Is the overlap complete?"}
  B -->|Yes| C["One species wins;<br/>the other declines"]
  B -->|No| D["Both persist by<br/>partitioning the niche"]

Strong overlap leads to exclusion; differences allow coexistence.

Measuring niche overlap

Imagine two bird species that eat seeds of three sizes. The share of food from each seed size describes each niche. This code computes a simple overlap index (0 means none, 1 means identical). It is a teaching calculation with invented diet data.

Python Niche overlap index

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A and C eat nearly the same seeds, so competition between them would be strong. A and B overlap much less.

Habitat or niche? Sorting statements

Python Habitat or niche?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that statements about place describe a habitat and those about role, food, or timing describe a niche.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. The habitat of an organism is best described as:

    A habitat is the location with its physical features; the role is the niche.
  2. 2. A species could live in a wide range of conditions but is limited by a competitor. The narrower range it actually uses is its:

    The realized niche is what a species actually occupies after interactions with other species.
  3. 3. Two warbler species feed at different heights in the same tree. This is an example of:

    Dividing resources lets similar species coexist.
  4. 4. According to the competitive exclusion principle, two species with identical niches in a stable environment will:

    If the overlap is complete and the resource is limited, one species usually outcompetes the other.

Summary

  • A habitat is where an organism lives; a niche is its role, resources, and conditions.
  • The fundamental niche is the potential range; the realized niche is the actual range after competition and predation.
  • Complete niche overlap usually leads to competitive exclusion.
  • Niche partitioning allows similar species to coexist.

Next: Food Chains and Food Webs