Use the same alignment for all comparisons
At least two homologously aligned sequences sharing the same positive number L of callable sites. All unordered pairs receive equal weight; kij counts raw base differences. Missing data and gaps use a common mask. The bounded calculator uses exactly three sequences and checks whether their three distances are realizable in one four-base alignment.[1][2]
Two distinct averaging steps
Average over pairs first, then normalize by common site count.[1]
- Specify the common alignment mask and count retained sites L.
- For each of the n(n−1)/2 unordered sequence pairs, count differences kij.
- Sum all kij and divide by pair count to obtain mean differences per sequence pair.
- Divide additionally by L and report π as raw differences per site; state masking and sample.
Two complete alignment examples
Compare three explicit sequences
- Given
- Original sequences: ACGT, ACGA and ATGA; L=4, no missing characters.
- Find
- Count every pairwise difference and calculate π.
Sequences 1 and 2 differ at site 4; 1 and 3 at sites 2 and 4; 2 and 3 at site 2. Thus k12=1, k13=2, k23=1.
There are 3·2/2=3 pairs and 4 total pairwise differences, averaging 4/3 per pair.
Divide by 4 sites: π=(4/3)/4=1/3.
Result: π=1/3≈0.333 differences per site.
Check: Sites 2 and 4 each contribute 2/3; averaging over 4 sites gives 1/3.
Segregating sites are not π
- Given
- Original sequences: AAAAAA, CCAAAA, AACCAA.
- Find
- Distinguish four variable sites from pairwise diversity.
Pairwise differences are 2, 2 and 4, with total 8.
With 3 pairs and 6 sites, π=8/18=4/9≈0.444.
Four of six sites vary; the segregating-site fraction is 4/6=2/3, which differs from π.
Result: π=4/9; variable-site fraction=2/3.
Check: At each variable site, two of three pairs differ, giving 4·2=8.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Raw differences under a specified mask
The calculator handles exactly three sequences through their three pair distances and common length. It checks integer counts, triangle conditions and four-base-alphabet realizability. It does not process FASTA, pairwise deletion or hidden multiple substitutions.[2]
A larger π is not automatically better or worse biological quality. Sampling, selection, demography and analysis choices can influence variation. All numerical examples here are original teaching data.[1]
Five exercises with solutions
Calculate · Foundation
Three sequences, L=10, k12=2, k13=4, k23=2. Calculate π.
Show hint
There are three unordered pairs.
Learning goal: Normalize pairwise diversity
Show solution and calculation
π=(2+4+2)/(3·10)=4/15≈0.2667.
Rearrange · Application
n=3, L=20 and π=0.2. Find Σkij.
Show hint
Use Σkij=πL·n(n−1)/2.
Learning goal: Recover total pairwise differences
Show solution and calculation
Σkij=0.2·20·3=12.
The total alone does not determine individual pair distances.
Interpret · Application
Three identical aligned sequences give π=0. What does this not establish?
Show hint
The sample and callable sites limit the claim.
Learning goal: Interpret π=0 cautiously
Show solution and calculation
No pairwise differences were observed at these sites in this sample.
This does not exclude variation in other individuals, masked regions or earlier hidden substitutions.
Error analysis · Application
L=10, n=3 and Σkij=8. A calculation divides by 10·9. Correct it.
Show hint
Count unordered distinct pairs.
Learning goal: Use pair count rather than n2
Show solution and calculation
There are 3·2/2=3, not 9 pairs.
Correct: 8/(10·3)=4/15≈0.2667.
Exclude self-comparisons and duplicate directions.
Transfer · Challenge
Remove identical sites 1 and 3 from ACGT, ACGA, ATGA. How does π change?
Show hint
Distances stay 1,2,1, but L decreases.
Learning goal: Recognize masking effects
Show solution and calculation
L falls from 4 to 2. π increases from 4/(3·4)=1/3 to 4/(3·2)=2/3.
No new differences appeared; the reference sites changed.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Distinguish variation and model correction
Jukes–Cantor correction treats observed differences under additional substitution assumptions.
FST compares defined population levels rather than only averaging within-sample pairwise differences.
Sequence alignment specifies which positions are compared as homologous.
Linkage disequilibrium describes association between loci rather than only mean differences at individual sites.
Sources for this explanation
Quanta · Updated November 9, 2026
- Per Unneberg,NBIS2023:DNA variation and nucleotide diversity
- Emmanuel Paradis:pegas nuc.div.DNAbin implementation
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a full article with checked examples, learning tasks, explicit model limits and a native figure.
Cite this reference page
Quanta. Nucleotide diversity π. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/nukleotiddiversitaet-pi
When citing a specific scientific statement, also cite the specialist source linked to that statement.