The so-called method of invariants is a technique in the field of mole
cular evolution for inferring phylogenetic relations among a number of
species on the basis of nucleotide sequence data. An invariant is a p
olynomial function of the probability distribution defined by a stocha
stic model for the observed nucleotide sequence. This function has the
special property that it is identically zero for one possible phyloge
ny and typically nonzero for another possible phylogeny. Thus it is po
ssible to discriminate statistically between two competing phylogenies
using an estimate of the invariant. The advantage of this technique i
s that it enables such inferences to be made without the need for esti
mating nuisance parameters that are related to the specific mechanisms
by which the molecular evolution occurs. For a wide class of models f
ound in the literature, we present a simple algebraic formalism for re
cognising whether or not a function is an invariant and for generating
all possible invariants. Our work is based on recognising an underlyi
ng group structure and using discrete Fourier analysis.