In the theory of stochastic processes in discrete time, a part of the mathematical theory of probability, the Doob decomposition theorem gives a unique decomposition of every adapted and integrable stochastic process as the sum of a martingale and a predictable process (or "drift") starting at zero. The theorem was proved by and is named for Joseph L. Doob. The analogous theorem in the continuous-time case is the Doob–Meyer decomposition theorem. Let be a probability space, I = {0, 1, 2, ..., N} with or a finite or an infinite index set, a filtration of , and X = (Xn)n∈I an adapted stochastic process with E[Xn] < ∞ for all n ∈ I. Then there exist a martingale M = (Mn)n∈I and an integrable predictable process A = (An)n∈I starting with A0 = 0 such that Xn = Mn + An for every n ∈ I. Here predictable means that An is -measurable for every n ∈ I \ {0}. This decomposition is almost surely unique. The theorem is valid word by word also for stochastic processes X taking values in the d-dimensional Euclidean space or the complex vector space . This follows from the one-dimensional version by considering the components individually. Using conditional expectations, define the processes A and M, for every n ∈ I, explicitly by and where the sums for n = 0 are empty and defined as zero. Here A adds up the expected increments of X, and M adds up the surprises, i.e., the part of every Xk that is not known one time step before. Due to these definitions, An+1 (if n + 1 ∈ I) and Mn are Fn-measurable because the process X is adapted, E[An] < ∞ and E[Mn] < ∞ because the process X is integrable, and the decomposition Xn = Mn + An is valid for every n ∈ I. The martingale property a.s. also follows from the above definition (), for every n ∈ I \ {0}. To prove uniqueness, let X = M + A be an additional decomposition. Then the process Y := M − M = A − A is a martingale, implying that a.s., and also predictable, implying that a.s. for any n ∈ I \ {0}.