Ecological Niches and Competition
An ecological niche is not a place — it is the complete set of conditions and resources a species needs to survive and reproduce. When two species draw on overlapping niches, competition follows, and the outcome — coexistence, exclusion, or resource partitioning — is one of the oldest and most productive questions in population biology. This article builds the theory from Hutchinson's n-dimensional hypervolume to the Lotka–Volterra competition equations, and ends with a working JavaScript simulation.
1. What is an ecological niche?
The word "niche" has been defined three distinct — and historically important — ways in ecology:
Joseph Grinnell (1917): the niche as habitat — the physical address a species occupies, defined by broad environmental variables like climate and vegetation type.
Charles Elton (1927): the niche as profession — a species' functional role in the community, defined by what it eats and what eats it.
G. Evelyn Hutchinson (1957): the niche as an n-dimensional hypervolume — every environmental axis (temperature, pH, food size, nesting height...) a species needs, plotted as one axis in n-dimensional space.
Hutchinson's formalisation is the one used in almost all modern quantitative ecology. Formally, the fundamental niche is the region of an n-dimensional resource/condition space within which a population can maintain a positive growth rate in the absence of competitors or predators:
The realized niche is always a subset of the fundamental niche — the portion actually occupied once competitors, predators, and dispersal limits are taken into account. The gap between fundamental and realized niche is exactly what interspecific competition carves away, and it is the central subject of this article.
2. Gause's competitive exclusion principle
In 1934, Georgy Gause grew two species of Paramecium
(P. aurelia and P. caudatum) separately
and together in identical test-tube cultures feeding on the same
bacterial food source. Grown alone, both species reached stable
logistic population sizes. Grown together, P. aurelia
consistently drove P. caudatum to local extinction
within about three weeks.
This experiment crystallised into the competitive exclusion principle (also called Gause's law):
The principle is often stated more usefully in its contrapositive form: if two competing species are observed to coexist stably, then by necessity their niches must differ along at least one axis. This corollary reframes exclusion from a doom-and-gloom rule into a powerful diagnostic tool — persistent coexistence is itself evidence for niche differentiation, even when the differentiating axis is not obvious to an observer.
- Limiting similarity: coexisting competitors must differ by some minimum amount along shared niche axes, or one will always win.
- Resource partitioning: closely related species often subdivide a shared resource by microhabitat, timing, or prey size, reducing effective overlap.
- Storage effect: temporally fluctuating environments can permit coexistence of species that would exclude each other under constant conditions.
3. Lotka–Volterra competition equations — derivation
To put the exclusion principle on quantitative footing, extend the logistic growth equation to two species sharing resources. Let N₁(t) and N₂(t) be the population sizes of species 1 and 2:
r₁, r₂ — intrinsic growth rates
Per-capita growth rate of each species when rare and alone. Sets how fast a population recovers from low density.
K₁, K₂ — carrying capacities
Maximum population each species could sustain alone on the shared resource base, in the absence of the other species.
α₁₂ — competition coefficient
Per-capita effect of species 2 on species 1's growth, in units of "equivalent species-1 individuals." α₁₂ > 1 means each individual of species 2 suppresses species 1 more than a species-1 individual would.
α₂₁ — competition coefficient
The reverse: per-capita effect of species 1 on species 2's growth, measured in equivalent species-2 individuals.
The governing equations are:
dN₂/dt = r₂·N₂·(1 − (N₂ + α₂₁·N₁)/K₂) ← species 2: logistic, penalised by species 1 via α₂₁
Term breakdown:
N₁/K₁ — self-limitation (intraspecific competition, same as plain logistic growth)
α₁₂·N₂/K₁ — interspecific penalty: each species-2 individual eats/occupies α₁₂ "shares" of species 1's resource
Setting α₁₂ = α₂₁ = 0 decouples the equations into two
independent logistic curves — no interaction, no exclusion.
Setting α₁₂ = α₂₁ = 1 makes both species functionally
identical competitors for a single pooled resource, the strongest
possible form of competition and the scenario closest to Gause's
Paramecium experiment.
4. Isoclines, equilibria, and the four possible outcomes
Set dN₁/dt = 0 and dN₂/dt = 0
separately to get two straight-line
zero-growth isoclines in the (N₁, N₂) phase
plane:
Species 2 isocline: N₂ = K₂ − α₂₁·N₁ ← intercepts: (K₂/α₂₁, 0) and (0, K₂)
The relative position of these two lines — specifically, whether each isocline's intercepts lie inside or outside the other's — determines which of exactly four qualitative outcomes the system produces:
- Outcome A — species 1 always wins: K₁ > K₂/α₂₁ and K₂ < K₁·α₁₂. Species 1's isocline lies entirely outside species 2's. Species 2 is driven extinct regardless of starting densities.
- Outcome B — species 2 always wins: the mirror image of A. Species 1 is always excluded.
- Outcome C — unstable coexistence (priority effect): K₁ > K₂/α₂₁ and K₁·α₁₂ > K₂. The isoclines cross, but the interior equilibrium is a saddle point — whichever species starts with the numerical advantage wins; the loser is competitively excluded. This is founder control.
- Outcome D — stable coexistence: K₁ < K₂/α₂₁ and K₂ < K₁·α₁₂ — equivalently, α₁₂·α₂₁ < 1. Intraspecific competition is stronger than interspecific competition for both species, so each species limits itself more than it limits its rival. The interior equilibrium is a stable node that both populations converge to from any starting point.
N₁* = (K₁ − α₁₂·K₂) / (1 − α₁₂·α₂₁)
N₂* = (K₂ − α₂₁·K₁) / (1 − α₁₂·α₂₁)
Stability condition for coexistence: α₁₂·α₂₁ < 1
i.e. intraspecific limitation > interspecific limitation, for both species
Outcome D is the mathematical heart of coexistence theory: a pair of species can share a habitat forever only if each is harder on its own kind than it is on its competitor — precisely the condition that niche differentiation (Section 5) tends to produce.
5. Niche overlap and resource utilization
MacArthur and Levins modelled each species' resource use along a
continuous niche axis (e.g. seed size, prey length) as a
utilization function uᵢ(x), typically a Gaussian
centred on the species' preferred resource value with standard
deviation w (niche breadth):
The competition coefficient between two species whose niche
centres are separated by distance d = |μ₁ − μ₂| is
the normalized overlap of their utilization curves:
This single equation links the phenomenological α's of Section 3 to a directly measurable ecological quantity: how far apart, in units of niche breadth (d/w), two species' resource preferences sit. When d = 0 the species are identical resource users and α = 1 — Gause's scenario. As d/w grows, α falls exponentially toward zero and coexistence (Outcome D, Section 4) becomes possible even with high total resource demand.
d/w ≈ 1–2. Closer packing than this is
possible in principle but becomes increasingly fragile to
environmental noise — a rule of thumb ecologists still use when
interpreting body-size ratios in guilds of similar species.
6. Character displacement and niche partitioning
When two similar species come into contact and compete, natural selection can push their traits apart along the shared niche axis — a process called character displacement. Traits diverge more where the species co-occur (sympatry) than where either lives alone (allopatry).
- Darwin's finches (Galápagos): Peter and Rosemary Grant's decades-long field study on Geospiza fortis showed measurable shifts in beak depth following drought years, tracking changes in seed availability and competition with G. magnirostris.
- Anolis lizards (Caribbean): Congeneric anole species on the same island typically partition the niche by perch height and diameter — one species foraging in the canopy, another on tree trunks, another in leaf litter — rather than by diet type.
- Temporal partitioning: desert rodent communities frequently separate activity by time of night or season rather than by food type, reducing effective α without any morphological change at all.
Character displacement and resource partitioning are the empirical fingerprints of Outcome D from Section 4: populations shift their realized niches until interspecific competition drops below intraspecific competition, at which point coexistence becomes locally stable rather than a knife-edge priority effect.
7. JavaScript implementation with RK4
The competition equations are a nonlinear coupled ODE system — RK4 gives fourth-order accuracy for a modest cost per step, exactly as for Lotka–Volterra predator–prey:
// Lotka–Volterra competition right-hand side
function competition(N1, N2, r1, r2, K1, K2, a12, a21) {
return {
dN1dt: r1 * N1 * (1 - (N1 + a12 * N2) / K1),
dN2dt: r2 * N2 * (1 - (N2 + a21 * N1) / K2),
};
}
// RK4 single step
function rk4Step(N1, N2, h, params) {
const { r1, r2, K1, K2, a12, a21 } = params;
const f = (n1, n2) => competition(n1, n2, r1, r2, K1, K2, a12, a21);
const k1 = f(N1, N2);
const k2 = f(N1 + h/2*k1.dN1dt, N2 + h/2*k1.dN2dt);
const k3 = f(N1 + h/2*k2.dN1dt, N2 + h/2*k2.dN2dt);
const k4 = f(N1 + h*k3.dN1dt, N2 + h*k3.dN2dt);
return {
N1: N1 + (h/6) * (k1.dN1dt + 2*k2.dN1dt + 2*k3.dN1dt + k4.dN1dt),
N2: N2 + (h/6) * (k1.dN2dt + 2*k2.dN2dt + 2*k3.dN2dt + k4.dN2dt),
};
}
// Simulate for T time units with step h, guarding against negative populations
function simulate(N1_0, N2_0, params, T, h = 0.05) {
const history = [{ t: 0, N1: N1_0, N2: N2_0 }];
let N1 = N1_0, N2 = N2_0;
for (let t = h; t <= T; t += h) {
({ N1, N2 } = rk4Step(N1, N2, h, params));
if (N1 < 0) N1 = 0;
if (N2 < 0) N2 = 0;
history.push({ t, N1, N2 });
}
return history;
}
// Outcome D: stable coexistence — intraspecific > interspecific for both
const coexist = { r1: 0.8, r2: 0.6, K1: 100, K2: 80, a12: 0.5, a21: 0.4 };
// a12 * a21 = 0.20 < 1 → stable coexistence
// Outcome A: species 1 always wins (Gause-like exclusion)
const exclude = { r1: 0.8, r2: 0.6, K1: 100, K2: 80, a12: 0.3, a21: 1.6 };
// a12 * a21 = 0.48, but K1 > K2/a21 and K2 < K1*a12 fails → check isocline crossing directly
const data = simulate(10, 10, coexist, 60);
// data[i].N1, data[i].N2 → population sizes at time data[i].t
Classifying the outcome from parameters
// Return one of 'A' (species 1 wins), 'B' (species 2 wins),
// 'C' (unstable coexistence / priority effect), 'D' (stable coexistence)
function classifyOutcome(K1, K2, a12, a21) {
const sp1Beats2 = K1 > K2 / a21; // species 1's isocline intercept exceeds species 2's
const sp2Beats1 = K2 > K1 * a12; // species 2's isocline intercept exceeds species 1's
if (sp1Beats2 && !sp2Beats1) return 'A'; // species 1 always wins
if (!sp1Beats2 && sp2Beats1) return 'B'; // species 2 always wins
if (sp1Beats2 && sp2Beats1) return 'C'; // priority effect: founder wins
return 'D'; // stable coexistence
}
8. Extensions: n-species competition and real-world tests
n-species Lotka–Volterra competition
The two-species model generalises directly to n species using an
interaction matrix A where entry αᵢⱼ is the effect of
species j on species i (αᵢᵢ = 1 by convention):
For n > 2, feasible (all-positive) equilibria and their stability depend on the eigenvalues of the community matrix — the same tools used to analyse stability in Section 4, generalised to higher dimensions. Robert May's 1972 result that "large complex systems tend to be less stable" originates from exactly this n-species Lotka–Volterra framework.
Apparent competition
Two species that never directly interact can still suppress each other indirectly if they share a common predator or parasite — a rise in one prey species' density boosts predator numbers, which then depresses the other prey species. The mathematics is formally analogous to direct competition even though no resource is shared, which is why "apparent competition" is easy to mistake for classic niche overlap in field data.
Coexistence via storage effect and fluctuating resources
Peter Chesson's modern coexistence theory shows that species can persist together even when α₁₂·α₂₁ > 1 at any single instant, provided environmental conditions fluctuate and each species responds differently to the fluctuations — buffering losses during bad years with reserves built during good years (the storage effect). This relaxes Gause's principle from an absolute law into a statement about time-averaged, not instantaneous, competitive balance.