
Ergodicity

In mathematics, ergodicity expresses the idea that a point of a moving system, either a dynamical system or a stochastic process, will eventually visit all parts of the space that the system moves in, in a uniform and random sense. This implies that the average behavior of the system can be deduced from the trajectory of a "typical" point. Equivalently, a sufficiently large collection of random samples from a process can represent the average statistical properties of the entire process. Ergodicity is a property of the system; it is a statement that the system cannot be reduced or factored into smaller components. Ergodic theory is the study of systems possessing ergodicity. 
Ergodic systems occur in a broad range of systems in physics and in geometry. This can be roughly understood to be due to a common phenomenon: the motion of particles, that is, geodesics on a hyperbolic manifold are divergent; when that manifold is compact, that is, of finite size, those orbits return to the same general area, eventually filling the entire space.
Ergodic systems capture the common-sense, every-day notions of randomness, such that smoke might come to fill all of a smoke-filled room, or that a block of metal might eventually come to have the same temperature throughout, or that flips of a fair coin may come up heads and tails half the time. A stronger concept than ergodicity is that of mixing, which aims to mathematically describe the common-sense notions of mixing, such as mixing drinks or mixing cooking ingredients.
The proper mathematical formulation of ergodicity is founded on the formal definitions of measure theory and dynamical systems, and rather specifically on the notion of a measure-preserving dynamical system. The origins of ergodicity lie in statistical physics, where Ludwig Boltzmann formulated the ergodic hypothesis.
Informal explanation.
Ergodicity occurs in broad settings in physics and mathematics. All of these settings are unified by a common mathematical description, that of the measure-preserving dynamical system. An informal description of this, and a definition of ergodicity with respect to it, is given immediately below. This is followed by a description of ergodicity in stochastic processes. They are one and the same, despite using dramatically different notation and language. A review of ergodicity in physics, and in geometry follows. In all cases, the notion of ergodicity is "exactly" the same as that for dynamical systems; "there is no difference", except for outlook, notation, style of thinking and the journals where results are published.
Measure-preserving dynamical systems.
The mathematical definition of ergodicity aims to capture ordinary every-day ideas about randomness. This includes ideas about systems that move in such a way as to (eventually) fill up all of space, such as diffusion and Brownian motion, as well as common-sense notions of mixing, such as mixing paints, drinks, cooking ingredients, industrial process mixing, smoke in a smoke-filled room, the dust in Saturn's rings and so on. To provide a solid mathematical footing, descriptions of ergodic systems begin with the definition of a measure-preserving dynamical system. This is written as formula_1
The set formula_2 is understood to be the total space to be filled: the mixing bowl, the smoke-filled room, "etc." The measure formula_3 is understood to define the natural volume of the space formula_2 and of its subspaces. The collection of subspaces is denoted by formula_5, and the size of any given subset formula_6 is formula_7; the size is its volume. Naively, one could imagine formula_5 to be the power set of formula_2; this doesn't quite work, as not all subsets of a space have a volume (famously, the Banach-Tarski paradox). Thus, conventionally, formula_5 consists of the measurable subsets—the subsets that do have a volume. It is always taken to be a Borel set—the collection of subsets that can be constructed by taking intersections, unions and set complements; these can always be taken to be measurable. 
The time evolution of the system is described by a map formula_11. Given some subset formula_6, its map formula_13 will in general be a deformed version of formula_14 – it is squashed or stretched, folded or cut into pieces. Mathematical examples include the baker's map and the horseshoe map, both inspired by bread-making. The set formula_13 must have the same volume as formula_14; the squashing/stretching does not alter the volume of the space, only its distribution. Such a system is "measure-preserving" (area-preserving, volume-preserving).
A formal difficulty arises when one tries to reconcile the volume of sets with the need to preserve their size under a map. The problem arises because, in general, several different points in the domain of a function can map to the same point in its range; that is, there may be formula_17 with formula_18. Worse, a single point formula_19 has no size. These difficulties can be avoided by working with the inverse map formula_20; it will map any given subset formula_6 to the parts that were assembled to make it: these parts are formula_22. It has the important property of not losing track of where things came from. More strongly, it has the important property that "any" (measure-preserving) map formula_23 is the inverse of some map formula_24. The proper definition of a volume-preserving map is one for which formula_25 because formula_26 describes all the pieces-parts that formula_14 came from.
One is now interested in studying the time evolution of the system. If a set formula_28 eventually comes to fill all of formula_2 over a long period of time (that is, if formula_30 approaches all of formula_2 for large formula_32), the system is said to be ergodic. If every set formula_14 behaves in this way, the system is a conservative system, placed in contrast to a dissipative system, where some subsets formula_14 wander away, never to be returned to. An example would be water running downhill -- once it's run down, it will never come back up again. The lake that forms at the bottom of this river can, however, become well-mixed. The ergodic decomposition theorem states that every ergodic system can be split into two parts: the conservative part, and the dissipative part.
Mixing is a stronger statement than ergodicity. Mixing asks for this ergodic property to hold between any two sets formula_35, and not just between some set formula_14 and formula_2. That is, given any two sets formula_38, a system is said to be (topologically) mixing if there is an integer formula_39 such that, for all formula_40 and formula_41, one has that formula_42. Here, formula_43 denotes set intersection and formula_44 is the empty set. Other notions of mixing include strong and weak mixing, which describe the notion that the mixed substances intermingle everywhere, in equal proportion. This can be non-trivial, as practical experience of trying to mix sticky, gooey substances shows.
Ergodic processes.
The above discussion appeals to a physical sense of a volume. The volume does not have to literally be some portion of 3D space; it can be some abstract volume. This is generally the case in statistical systems, where the volume (the measure) is given by the probability. The total volume corresponds to probability one. This correspondence works because the axioms of probability theory are identical to those of measure theory; these are the Kolmogorov axioms.
The idea of a volume can be very abstract. Consider, for example, the set of all possible coin-flips: the set of infinite sequences of heads and tails. Assigning the volume of 1 to this space, it is clear that half of all such sequences start with heads, and half start with tails. One can slice up this volume in other ways: one can say "I don't care about the first formula_45 coin-flips; but I want the formula_32'th of them to be heads, and then I don't care about what comes after that". This can be written as the set formula_47 where formula_48 is "don't care" and formula_49 is "heads". The volume of this space is again (obviously!) one-half. 
The above is enough to build up a measure-preserving dynamical system, in its entirety. The sets of formula_49 or formula_51 occurring in the formula_32'th place are called cylinder sets. The set of all possible intersections, unions and complements of the cylinder sets then form the Borel set formula_5 defined above. In formal terms, the cylinder sets form the base for a topology on the space formula_2 of all possible infinite-length coin-flips. The measure formula_3 has all of the common-sense properties one might hope for: the measure of a cylinder set with formula_49 in the formula_57'th position, and formula_51 in the formula_59'th position is obviously 1/4, and so on. These common-sense properties persist for set-complement and set-union: everything except for formula_49 and formula_51 in locations formula_57 and formula_59 obviously has the volume of 3/4. All together, these form the axioms of a sigma-additive measure; measure-preserving dynamical systems always use sigma-additive measures. For coin flips, this measure is called the Bernoulli measure.
For the coin-flip process, the time-evolution operator formula_64 is the shift operator that says "throw away the first coin-flip, and keep the rest". Formally, if formula_65 is a sequence of coin-flips, then formula_66. The measure is obviously shift-invariant: as long as we are talking about some set formula_28 where the first coin-flip formula_68 is the "don't care" value, then the volume formula_7 does not change: formula_70. In order to avoid talking about the first coin-flip, it is easier to define formula_71 as inserting a "don't care" value into the first position: formula_72. With this definition, one obviously has that formula_73 with no constraints on formula_14. This is again an example of why formula_71 is used in the formal definitions.
The above development takes a random process, the Bernoulli process, and converts it to a measure-preserving dynamical system formula_76 The same conversion (equivalence, isomorphism) can be applied to any stochastic process. Thus, an informal definition of ergodicity is that a sequence is ergodic if it visits all of formula_2; such sequences are "typical" for the process. Another is that its statistical properties can be deduced from a single, sufficiently long, random sample of the process (thus uniformly sampling all of formula_2), or that any collection of random samples from a process must represent the average statistical properties of the entire process (that is, samples drawn uniformly from formula_2 are representative of formula_2 as a whole.) In the present example, a sequence of coin flips, where half are heads, and half are tails, is a "typical" sequence.
There are several important points to be made about the Bernoulli process. If one writes 0 for tails and 1 for heads, one gets the set of all infinite strings of binary digits. These correspond to the base-two expansion of real numbers. Explicitly, given a sequence formula_65, the corresponding real number is
The statement that the Bernoulli process is ergodic is equivalent to the statement that the real numbers are uniformly distributed. The set of all such strings can be written in a variety of ways: formula_83 This set is the Cantor set, sometimes called the Cantor space to avoid confusion with the Cantor function 
In the end, these are all "the same thing". 
The Cantor set plays key roles in many branches of mathematics. In recreational mathematics, it underpins the period-doubling fractals; in analysis, it appears in a vast variety of theorems. A key one for stochastic processes is the Wold decomposition, which states that any stationary process can be decomposed into a pair of uncorrelated processes, one deterministic, and the other being a moving average process.
The Ornstein isomorphism theorem states that every stationary stochastic process is equivalent to a Bernoulli scheme (a Bernoulli process with an "N"-sided (and possibly unfair) gaming die). Other results include that every non-dissipative ergodic system is equivalent to the Markov odometer, sometimes called an "adding machine" because it looks like elementary-school addition, that is, taking a base-"N" digit sequence, adding one, and propagating the carry bits. The proof of equivalence is very abstract; understanding the result is not: by adding one at each time step, every possible state of the odometer is visited, until it rolls over, and starts again. Likewise, ergodic systems visit each state, uniformly, moving on to the next, until they have all been visited.
Systems that generate (infinite) sequences of "N" letters are studied by means of symbolic dynamics. Important special cases include subshifts of finite type and sofic systems.
Ergodicity in physics.
Physical systems can be split into three categories: classical mechanics, which describes machines with a finite number of moving parts, quantum mechanics, which describes the structure of atoms, and statistical mechanics, which describes gases, liquids, solids; this includes condensed matter physics. The case of classical mechanics is discussed in the next section, on ergodicity in geometry. As to quantum mechanics, although there is a conception of quantum chaos, there is no clear definition of ergodocity; what this might be is hotly debated. This section reviews ergodicity in statistical mechanics.
The above abstract definition of a volume is required as the appropriate setting for definitions of ergodicity in physics. Consider a container of liquid, or gas, or plasma, or other collection of atoms or particles. Each and every particle formula_85 has a 3D position, and a 3D velocity, and is thus described by six numbers: a point in six-dimensional space formula_86 If there are formula_39 of these particles in the system, a complete description requires formula_88 numbers. Any one system is just a single point in formula_89 The physical system is not all of formula_90, of course; if it's a box of width, height and length formula_91 then a point is in formula_92 Nor can velocities be infinite: they are scaled by some probability measure, for example the Boltzmann–Gibbs measure for a gas. None-the-less, for formula_39 close to Avogadro's number, this is obviously a very large space. This space is called the canonical ensemble. 
A physical system is said to be ergodic if any representative point of the system eventually comes to visit the entire volume of the system. For the above example, this implies that any given atom not only visits every part of the box formula_91 with uniform probability, but it does so with every possible velocity, with probability given by the Boltzmann distribution for that velocity (so, uniform with respect to that measure). The ergodic hypothesis states that physical systems actually are ergodic. Multiple time scales are at work: gasses and liquids appear to be ergodic over short time scales. Ergodicity in a solid can be viewed in terms of the vibrational modes or phonons, as obviously the atoms in a solid do not exchange locations. Glasses present a challenge to the ergodic hypothesis; time scales are assumed to be in the millions of years, but results are contentious. Spin glasses present particular difficulties.
Formal mathematical proofs of ergodicity in statistical physics are hard to come by; most high-dimensional many-body systems are assumed to be ergodic, without mathematical proof. Exceptions include the dynamical billiards, which model billiard ball-type collisions of atoms in an ideal gas or plasma. The first hard-sphere ergodicity theorem was for Sinai's billiards, which considers two balls, one of them taken as being stationary, at the origin. As the second ball collides, it moves away; applying periodic boundary conditions, it then returns to collide again. By appeal to homogeneity, this return of the "second" ball can instead be taken to be "just some other atom" that has come into range, and is moving to collide with the atom at the origin (which can be taken to be just "any other atom".) This is one of the few formal proofs that exist; there are no equivalent statements "e.g." for atoms in a liquid, interacting via van der Waals forces, even if it would be common sense to believe that such systems are ergodic (and mixing). More precise physical arguments can be made, though.
Ergodicity in geometry.
Ergodicity is a wide-spread phenomenon in the study of Riemannian manifolds. A quick sequence of examples, from simple to complicated, illustrates this point. All of the systems mentioned below have been proved to be ergodic via rigorous formal proofs. The irrational rotation of a circle is ergodic: the orbit of a point is such that eventually, every other point in the circle is visited. Such rotations are a special case of the interval exchange map. The beta expansions of a number are ergodic: beta expansions of a real number are done not in base-"N", but in base-formula_95 for some formula_96 The reflected version of the beta expansion is tent map; there are a variety of other ergodic maps of the unit interval. Moving to two dimensions, the arithmetic billiards with irrational angles are ergodic. One can also take a flat rectangle, squash it, cut it and reassemble it; this is the previously-mentioned baker's map. Its points can be described by the set of bi-infinite strings in two letters, that is, extending to both the left and right; as such, it looks like two copies of the Bernoulli process. If one deforms sideways during the squashing, one obtains Arnold's cat map. In most ways, the cat map is prototypical of any other similar transformation.
For non-flat surfaces, one has that the geodesic flow of any negatively curved compact Riemann surface is ergodic. A surface is "compact" in the sense that it has finite surface area. The geodesic flow is a generalization of the idea of moving in a "straight line" on a curved surface: such straight lines are geodesics. One of the earliest cases studied is Hadamard's billiards, which describes geodesics on the Bolza surface, topologically equivalent to a donut with two holes. Ergodicity can be demonstrated informally, if one has a sharpie and some reasonable example of a two-holed donut: starting anywhere, in any direction, one attempts to draw a straight line; rulers are useful for this. It doesn't take all that long to discover that one is not coming back to the starting point. (Of course, crooked drawing can also account for this; that's why we have proofs.)
These results extend to higher dimensions. The geodesic flow for negatively curved compact Riemannian manifolds is ergodic. A classic example for this is the Anosov flow, which is the horocycle flow on a hyperbolic manifold. This can be seen to be a kind of Hopf fibration. Such flows commonly occur in classical mechanics, which is the study in physics of finite-dimensional moving machinery, e.g. the double pendulum and so-forth. Classical mechanics is constructed on symplectic manifolds. The flows on such systems can be deconstructed into stable and unstable manifolds; as a general rule, when this is possible, chaotic motion results. That this is generic can be seen by noting that the cotangent bundle of a Riemannian manifold is (always) a symplectic manifold; the geodesic flow is given by a solution to the Hamilton–Jacobi equations for this manifold. In terms of the canonical coordinates formula_97 on the cotangent manifold, the Hamiltonian or energy is given by 
with formula_99 the (inverse of the) metric tensor and formula_100 the momentum. The resemblance to the kinetic energy formula_101 of a point particle is hardly accidental; this is the whole point of calling such things "energy". In this sense, chaotic behavior with ergodic orbits is a more-or-less generic phenomenon in large tracts of geometry. 
Ergodicity results have been provided in translation surfaces, hyperbolic groups and systolic geometry. Techniques include the study of ergodic flows, the Hopf decomposition, and the Ambrose–Kakutani–Krengel–Kubo theorem. An important class of systems are the Axiom A systems. 
A number of both classification and "anti-classification" results have been obtained. The Ornstein isomorphism theorem applies here as well; again, it states that most of these systems are isomorphic to some Bernoulli scheme. This rather neatly ties these systems back into the definition of ergodicity given for a stochastic process, in the previous section. The anti-classification results state that there are more than a countably infinite number of inequivalent ergodic measure-preserving dynamical systems. This is perhaps not entirely a surprise, as one can use points in the Cantor set to construct similar-but-different systems. See measure-preserving dynamical system for a brief survey of some of the anti-classification results.
Historical development.
The idea of ergodicity was born in the field of thermodynamics, where it was necessary to relate the individual states of gas molecules to the temperature of a gas as a whole and its time evolution thereof. In order to do this, it was necessary to state what exactly it means for gases to mix well together, so that thermodynamic equilibrium could be defined with mathematical rigor. Once the theory was well developed in physics, it was rapidly formalized and extended, so that ergodic theory has long been an independent area of mathematics in itself. As part of that progression, more than one slightly different definition of ergodicity and multitudes of interpretations of the concept in different fields coexist.
For example, in classical physics the term implies that a system satisfies the ergodic hypothesis of thermodynamics, the relevant state space being position and momentum space. In dynamical systems theory the state space is usually taken to be a more general phase space. On the other hand in coding theory the state space is often discrete in both time and state, with less concomitant structure. In all those fields the ideas of time average and ensemble average can also carry extra baggage as well—as is the case with the many possible thermodynamically relevant partition functions used to define ensemble averages in physics, back again. As such the measure theoretic formalization of the concept also serves as a unifying discipline. In 1913 Michel Plancherel proved the strict impossibility for ergodicity for a purely mechanical system.
Etymology.
The term "ergodic" is commonly thought to derive from the Greek words ("ergon": "work") and ("hodos": "path", "way"), as chosen by Ludwig Boltzmann while he was working on a problem in statistical mechanics. At the same time it is also claimed to be a derivation of "ergomonode", coined by Boltzmann in a relatively obscure paper from 1884. The etymology appears to be contested in other ways as well.
Definition for discrete-time systems.
Formal definition.
Let formula_102 be a measurable space. If formula_64 is a measurable function from formula_2 to itself and formula_3 a probability measure on formula_102 then we say that formula_64 is formula_3-ergodic or formula_3 is an ergodic measure for formula_64 if formula_64 preserves formula_3 and the following condition holds: 
In other words there are no formula_64-invariant subsets up to measure 0 (with respect to formula_3). Recall that formula_64 preserving formula_3 (or formula_3 being formula_64-invariant) means that formula_123 for all formula_113 (see also Measure-preserving dynamical system).
Examples.
The simplest example is when formula_2 is a finite set and formula_3 the counting measure. Then a self-map of formula_2 preserves formula_3 if and only if it is a bijection, and it is ergodic if and only if formula_64 has only one orbit (that is, for every formula_130 there exists formula_131 such that formula_132). For example, if formula_133 then the cycle formula_134 is ergodic, but the permutation formula_135 is not (it has the two invariant subsets formula_136 and formula_137). 
Equivalent formulations.
The definition given above admits the following immediate reformulations: 
Importantly for applications, the condition in the last characterisation can be restricted to square-integrable functions only:
Further examples.
Bernoulli shifts and subshifts.
Let formula_153 be a finite set and formula_154 with formula_3 the product measure (each factor formula_153 being endowed with its counting measure). Then the shift operator formula_64 defined by formula_158 is formula_3-ergodic. 
There are many more ergodic measures for the shift map formula_64 on formula_2. Periodic sequences give finitely supported measures. More interestingly, there are infinitely-supported ones which are subshifts of finite type.
Irrational rotations.
Let formula_2 be the unit circle formula_163, with its Lebesgue measure formula_3. For any formula_165 the rotation of formula_2 of angle formula_167 is given by formula_168. If formula_169 then formula_170 is not ergodic for the Lebesgue measure as it has infinitely many finite orbits. On the other hand, if formula_167 is irrational then formula_170 is ergodic.
Arnold's cat map.
Let formula_173 be the 2-torus. Then any element formula_174 defines a self-map of formula_2 since formula_176. When formula_177 one obtains the so-called Arnold's cat map, which is ergodic for the Lebesgue measure on the torus.
Ergodic theorems.
If formula_3 is a probability measure on a space formula_2 which is ergodic for a transformation formula_64 the pointwise ergodic theorem of G. Birkhoff states that for every measurable functions formula_181 and for formula_3-almost every point formula_183 the time average on the orbit of formula_184 converges to the space average of formula_152. Formally this means that 
formula_186
The mean ergodic theorem of J. von Neumann is a similar, weaker statement about averaged translates of square-integrable functions.
Related properties.
Dense orbits.
An immediate consequence of the definition of ergodicity is that on a topological space formula_2, and if formula_188 is the σ-algebra of Borel sets, if formula_64 is formula_3-ergodic then formula_3-almost every orbit of formula_64 is dense in the support of formula_3. 
This is not an equivalence since for a transformation which is not uniquely ergodic, but for which there is an ergodic measure with full support formula_194, for any other ergodic measure formula_195 the measure formula_196 is not ergodic for formula_64 but its orbits are dense in the support. Explicit examples can be constructed with shift-invariant measures. 
Mixing.
A transformation formula_64 of a probability measure space formula_199 is said to be mixing for the measure formula_3 if for any measurable sets formula_201 the following holds: 
formula_202
It is immediate that a mixing transformation is also ergodic (taking formula_14 to be a formula_64-stable subset and formula_205 its complement). The converse is not true, for example a rotation with irrational angle on the circle (which is ergodic per the examples above) is not mixing (for a sufficiently small interval its successive images will not intersect itself most of the time). Bernoulli shifts are mixing, and so is Arnold's cat map.
This notion of mixing is sometimes called strong mixing, as opposed to weak mixing which means that 
formula_206
Proper ergodicity.
The transformation formula_64 is said to be "properly ergodic" if it does not have an orbit of full measure. In the discrete case this means that the measure formula_3 is not supported on a finite orbit of formula_64.
Definition for continuous-time dynamical systems.
The definition is essentially the same for continuous-time dynamical systems as for a single transformation. Let formula_102 be a measurable space and for each formula_211, then such a system is given by a family formula_212 of measurable functions from formula_2 to itself, so that for any formula_214 the relation formula_215 holds (usually it is also asked that the orbit map from formula_216 is also measurable). If formula_3 is a probability measure on formula_102 then we say that formula_212 is formula_3-ergodic or formula_3 is an ergodic measure for formula_64 if each formula_212 preserves formula_3 and the following condition holds: 
Examples.
As in the discrete case the simplest example is that of a transitive action, for instance the action on the circle given by formula_230 is ergodic for Lebesgue measure. 
An example with infinitely many orbits is given by the flow along an irrational slope on the torus: let formula_231 and formula_232. Let formula_233; then if formula_234 this is ergodic for the Lebesgue measure. 
Ergodic flows.
Further examples of ergodic flows are:
Ergodicity in compact metric spaces.
If formula_2 is a compact metric space it is naturally endowed with the σ-algebra of Borel sets. The additional structure coming from the topology then allows a much more detailed theory for ergodic transformations and measures on formula_2. 
Functional analysis interpretation.
A very powerful alternate definition of ergodic measures can be given using the theory of Banach spaces. Radon measures on formula_2 form a Banach space of which the set formula_238 of probability measures on formula_2 is a convex subset. Given a continuous transformation formula_64 of formula_2 the subset formula_242 of formula_64-invariant measures is a closed convex subset, and a measure is ergodic for formula_64 if and only if it is an extreme point of this convex. 
Existence of ergodic measures.
In the setting above it follows from the Banach-Alaoglu theorem that there always exists extremal points in formula_242. Hence a transformation of a compact metric space always admits ergodic measures. 
Ergodic decomposition.
In general an invariant measure need not be ergodic, but as a consequence of Choquet theory it can always be expressed as the barycenter of a probability measure on the set of ergodic measures. This is referred to as the "ergodic decomposition" of the measure. 
Example.
In the case of formula_246 and formula_247 the counting measure is not ergodic. The ergodic measures for formula_64 are the uniform measures formula_249 supported on the subsets formula_136 and formula_251 and every formula_64-invariant probability measure can be written in the form formula_253 for some formula_254. In particular formula_255 is the ergodic decomposition of the counting measure. 
Continuous systems.
Everything in this section transfers verbatim to continuous actions of formula_256 or formula_257 on compact metric spaces. 
Unique ergodicity.
The transformation formula_64 is said to be uniquely ergodic if there is a unique Borel probability measure formula_3 on formula_2 which is ergodic for formula_64. 
In the examples considered above, irrational rotations of the circle are uniquely ergodic; shift maps are not.
Probabilistic interpretation: ergodic processes.
If formula_262 is a discrete-time stochastic process on a space formula_263, it is said to be ergodic if the joint distribution of the variables on formula_264 is invariant under the shift map formula_265. This is a particular case of the notions discussed above. 
The simplest case is that of an independent and identically distributed process which corresponds to the shift map described above. Another important case is that of a Markov chain which is discussed in detail below. 
A similar interpretation holds for continuous-time stochastic processes though the construction of the measurable structure of the action is more complicated.
Ergodicity of Markov chains.
The dynamical system associated with a Markov chain.
Let formula_153 be a finite set. A Markov chain on formula_153 is defined by a matrix formula_268, where formula_269 is the transition probability from formula_270 to formula_271, so for every formula_272 we have formula_273. A stationary measure for formula_274 is a probability measure formula_275 on formula_153 such that formula_277 ; that is formula_278 for all formula_272. 
Using this data we can define a probability measure formula_280 on the set formula_154 with its product σ-algebra by giving the measures of the cylinders as follows:
formula_282
Stationarity of formula_275 then means that the measure formula_280 is invariant under the shift map formula_158.
Criterion for ergodicity.
The measure formula_280 is always ergodic for the shift map if the associated Markov chain is irreducible (any state can be reached with positive probability from any other state in a finite number of steps). 
The hypotheses above imply that there is a unique stationary measure for the Markov chain. In terms of the matrix formula_274 a sufficient condition for this is that 1 be a simple eigenvalue of the matrix formula_274 and all other eigenvalues of formula_274 (in formula_290) are of modulus <1. 
Note that in probability theory the Markov chain is called ergodic if in addition each state is aperiodic (the times where the return probability is positive are not multiples of a single integer >1). This is not necessary for the invariant measure to be ergodic; hence the notions of "ergodicity" for a Markov chain and the associated shift-invariant measure are different (the one for the chain is strictly stronger). 
Moreover the criterion is an "if and only if" if all communicating classes in the chain are recurrent and we consider all stationary measures.
Examples.
Counting measure.
If formula_291 for all formula_292 then the stationary measure is the counting measure, the measure formula_293 is the product of counting measures. The Markov chain is ergodic, so the shift example from above is a special case of the criterion. 
Non-ergodic Markov chains.
Markov chains with recurring communicating classes are not irreducible are not ergodic, and this can be seen immediately as follows. If formula_294 are two distinct recurrent communicating classes there are nonzero stationary measures formula_295 supported on formula_296 respectively and the subsets formula_297 and formula_298 are both shift-invariant and of measure 1.2 for the invariant probability measure formula_299. A very simple example of that is the chain on formula_300 given by the matrix formula_301 (both states are stationary). 
A periodic chain.
The Markov chain on formula_300 given by the matrix formula_303 is irreducible but periodic. Thus it is not ergodic in the sense of Markov chain though the associated measure formula_3 on formula_305 is ergodic for the shift map. However the shift is not mixing for this measure, as for the sets 
formula_306
and 
formula_307
we have formula_308 but 
formula_309
Generalisations.
Ergodic group actions.
The definition of ergodicity also makes sense for group actions. The classical theory (for invertible transformations) corresponds to actions of formula_310 or formula_256. 
Quasi-invariant measures.
For non-abelian groups there might not be invariant measures even on compact metric spaces. However the definition of ergodicity carries over unchanged if one replaces invariant measures by quasi-invariant measures. 
Important examples are the action of a semisimple Lie group (or a lattice therein) on its Furstenberg boundary.
Ergodic relations.
A measurable equivalence relation it is said to be ergodic if all saturated subsets are either null or conull. 