Tutorials › Stochastic Processes › Encoding Paths by Their Up-Steps

Simple Random Walks on the Integers · Tutorial 275 of 994

Encoding Paths by Their Up-Steps

Learn how endpoint and path length determine the number of up-steps, and how choosing their positions counts all paths with that endpoint.

Intermediate 9 min read

What You'll Learn

  • Represent a walk by its ordered sequence of up-steps and down-steps.
  • Derive the number of up-steps from the length and endpoint.
  • Identify when a specified endpoint is impossible.
  • Count endpoint-constrained paths with binomial coefficients.
  • Verify path counts by listing step positions and checking the total number of paths.

From a Walk to Its Up-Step Positions

A simple symmetric walk can be described one step at a time, but for counting purposes it is often more useful to record where its upward steps occur. Once the length and endpoint are fixed, the numbers of upward and downward steps are forced. The only choice left is the set of step positions occupied by the upward steps. This turns a path-counting question into a choice of positions.

Work on a probability space \((\Omega,\mathcal{F},\mathbb{P})\) carrying independent increments \((\xi_k)_{k\ge1}\), with \(\mathbb{P}(\xi_k=1)=\mathbb{P}(\xi_k=-1)=\tfrac12\). Define \(X_0=0\) and \(X_n=\sum_{k=1}^n \xi_k\), so \((X_n)_{n\ge0}\) is the simple symmetric random walk on the state space \(S=\mathbb{Z}\), in discrete time \(n\). Its transition kernel is \(p_{i,i+1}=p_{i,i-1}=\tfrac12\) for every \(i\in\mathbb{Z}\), with all other transition probabilities zero; each row sums to \(\tfrac12+\tfrac12=1\). When conditioning on the walk up to time \(n\), use the filtration \(\mathcal{F}_n=\sigma(\xi_1,\ldots,\xi_n)\), with \(\mathcal{F}_0=\{\varnothing,\Omega\}\).

A length-\(n\) path is its ordered list of \(n\) increments, or, equivalently, the sequence of positions \(X_0,X_1,\ldots,X_n\). An up-step is an increment \(+1\), and a down-step is an increment \(-1\). In this tutorial, paths are unrestricted: they may visit any integer at intermediate times. In particular, the count below does not impose a barrier or require the path to stay on one side of zero.

Definition: For a length-\(n\) path, its up-step set is \(U=\{k\in\{1,\ldots,n\}:\xi_k=1\}\). Its size \(|U|\) is the number of up-steps. Since every other step is down, the path is determined uniquely by \(U\).

The Endpoint Determines the Number of Up-Steps

Suppose a path starts at zero, has length \(n\), and ends at \(j\). If it has \(u\) up-steps, then it has \(n-u\) down-steps. Each up-step adds one to the position and each down-step subtracts one, so its endpoint is \(u-(n-u)\). Solving this relation for \(u\) gives the required number of up-steps.

Theorem (Path count by endpoint): Let \(n\) be a nonnegative integer and \(j\in\mathbb{Z}\). The number of length-\(n\) paths of the simple symmetric walk from \(0\) to \(j\) is \[ \binom{n}{(n+j)/2} \] when \((n+j)/2\) is an integer between \(0\) and \(n\), inclusive, and is zero otherwise. Here \(\binom{n}{r}\) counts the \(r\)-element subsets of \(\{1,\ldots,n\}\).

Proof. First suppose a path of length \(n\) ends at \(j\), and let \(u\) be its number of up-steps. Its number of down-steps is \(n-u\), so \(j=u-(n-u)=2u-n\). Thus \(u=(n+j)/2\). Because \(u\) counts steps, it must be an integer with \(0\le u\le n\). If either condition fails, no path can end at \(j\).

Now suppose \(u=(n+j)/2\) is an integer with \(0\le u\le n\). Choose any \(u\)-element subset \(U\) of the \(n\) step positions, assign an up-step at each position in \(U\), and assign a down-step at each remaining position. The resulting path has \(u\) up-steps and \(n-u\) down-steps, hence ends at \(2u-n=j\). Conversely, every path ending at \(j\) determines exactly one such subset, namely its up-step set. These two assignments are inverses, so they give a bijection between the paths in question and the \(u\)-element subsets. There are \(\binom{n}{u}=\binom{n}{(n+j)/2}\) such subsets. \(\square\)

This argument gives both a count and a construction: to make a path with the required endpoint, select the up-step positions, then fill every unselected position with a down-step. The endpoint restriction does not impose any further restrictions on the order of those steps. Paths that move far from their endpoint and later return are included as long as their total numbers of up-steps and down-steps are correct.

Worked Example: Five Steps Ending at One

Count the length-five paths from zero to \(1\). The transition probabilities at each state are \(\tfrac12\) to the state one higher and \(\tfrac12\) to the state one lower, so every transition row sums to \(1\). If \(u\) is the number of up-steps, the endpoint equation is \(u-(5-u)=1\), or \(2u-5=1\). Thus \(u=3\), and the count is \(\binom{5}{3}\).

For the arithmetic, \(\binom{5}{3}=\frac{5\cdot4\cdot3}{3\cdot2\cdot1}=\frac{60}{6}=10\). To check the count directly, the three up-step positions can be \((1,2,3)\), \((1,2,4)\), \((1,2,5)\), \((1,3,4)\), \((1,3,5)\), \((1,4,5)\), \((2,3,4)\), \((2,3,5)\), \((2,4,5)\), or \((3,4,5)\). This lists ten distinct choices. Each choice gives three \(+1\) steps and two \(-1\) steps, so its endpoint is \(3-2=1\).

Check: The ten listed subsets are all the three-element subsets of five positions. The endpoint calculation gives \(3-(5-3)=3-2=1\) for each one, as required.

Counting by Choosing Down-Step Positions

The same path can be encoded by its down-step positions instead. If the endpoint is \(j\), the number of down-steps is \(d=(n-j)/2\), since the endpoint is also \(n-2d\). Choosing the \(d\) down-step positions gives \(\binom{n}{d}\) paths. This agrees with the up-step count because \(d=n-u\), and choosing the complement of a set is a bijection between subsets of sizes \(u\) and \(n-u\). Thus \(\binom{n}{u}=\binom{n}{n-u}\). This is a second way to check a calculation, not a different restriction on the path.

Worked Example: Four Steps Ending at Zero

Count the length-four paths from zero back to zero. The transition kernel has probability \(\tfrac12\) for each of the two neighboring states at every integer state, so every row sums to \(1\). The endpoint equation \(u-(4-u)=0\) gives \(2u=4\), hence \(u=2\). Therefore the number of paths is \(\binom{4}{2}\).

Compute it explicitly: \(\binom{4}{2}=\frac{4\cdot3}{2\cdot1}=\frac{12}{2}=6\). The six choices of up-step positions are \((1,2)\), \((1,3)\), \((1,4)\), \((2,3)\), \((2,4)\), and \((3,4)\). Each has two up-steps and two down-steps, so each ends at \(2-2=0\). No other two-element subset of four positions exists.

Check by down-steps: There are also two down-steps, and choosing their positions gives \(\binom{4}{2}=\frac{4\cdot3}{2}=6\). For example, if the down-steps are at positions \(1\) and \(2\), the up-steps are at positions \(3\) and \(4\); this is the complementary choice to up-step positions \((1,2)\). The six choices therefore agree under complementation.

Feasibility and Boundary Cases

The formula includes its own feasibility test. A path cannot have a noninteger number of up-steps, and it cannot have fewer than zero or more than \(n\) up-steps. In particular, for a fixed length and endpoint, one should first calculate \((n+j)/2\), then check that it is an integer in the inclusive range from \(0\) to \(n\), and only then evaluate the binomial coefficient. This also handles the boundary cases: if \(j=n\), all \(n\) steps must be upward and there is one path; if \(j=-n\), all \(n\) steps must be downward and there is one path. When \(n=0\), the empty path ends at zero, and there is one such path; for any \(j\ne0\), there are none.

Worked Example: Six Steps Ending at Four

Count the length-six paths from zero to \(4\). The transition probabilities are again \(\tfrac12\) to each neighboring state, and each row sums to \(\tfrac12+\tfrac12=1\). Solving \(u-(6-u)=4\) gives \(2u-6=4\), then \(2u=10\) and \(u=5\). This is an integer between \(0\) and \(6\), so the count is \(\binom{6}{5}\).

Its value is \(\binom{6}{5}=\frac{6!}{5!1!}=\frac{6}{1}=6\). Equivalently, a path has exactly one down-step, whose position can be any one of \(1,2,3,4,5,6\). These are six distinct paths. Each has five upward moves and one downward move, so its endpoint is \(5-1=4\).

Check by the endpoint equation: Substituting \(u=5\) and \(n=6\) gives \(u-(n-u)=5-(6-5)=5-1=4\). Choosing the sole down-step position gives the same six choices as choosing five up-step positions, with each pair of descriptions complementary.

The same reasoning applies if the walk starts at a location \(x\) rather than zero. Its net displacement is \(j-x\) when it ends at \(j\), so the number of up-steps must be \((n+j-x)/2\). The count is the binomial coefficient with this value as its lower index when that value is an integer from \(0\) through \(n\); otherwise there are no such paths. This is just the endpoint calculation applied to the displacement, not a change in how step positions are encoded.

A Consistency Check Across All Endpoints

Result: For a fixed nonnegative integer \(n\), summing the path counts over all possible endpoints gives \(2^n\), the total number of length-\(n\) paths.

Proof. Every length-\(n\) path has an up-step set \(U\subseteq\{1,\ldots,n\}\), and each such subset determines exactly one path. The collection of all paths is therefore in bijection with the collection of all subsets of the \(n\) step positions. There are \(2^n\) subsets: each position is either included or not included. Also, every path has exactly one endpoint, so grouping the paths according to their endpoint partitions this same collection into disjoint groups. The group for endpoint \(j\) has the count given by the theorem, and summing those group sizes must give the total \(2^n\). For \(n=0\), the position set is empty and has one subset, the empty set, so the same argument gives \(2^0=1\). \(\square\)

This identity is a useful audit of endpoint counts: no path should be omitted, and no path should be counted twice. It does not require calculating any probabilities. If one later assigns probabilities to paths, the same partition can be used to aggregate their probabilities, but the combinatorial step here is simply to count the paths in each endpoint group.

Common Mistake: Reversing the Up-Step Formula

A frequent error is to use \((n-j)/2\) as the number of up-steps. That expression counts down-steps, not up-steps. For a concrete check, take \(n=5\) and \(j=1\). The incorrect formula gives \((5-1)/2=2\) up-steps, which would produce endpoint \(2-(5-2)=2-3=-1\), not \(1\). The correct equation is \(j=u-(n-u)=2u-n\), so \(u=(n+j)/2=(5+1)/2=3\). With three up-steps and two down-steps, the endpoint is \(3-2=1\).

A second pitfall is to evaluate a binomial coefficient before checking whether its lower index is a valid integer between zero and \(n\). For example, five steps cannot end at zero: the proposed number of up-steps would be \((5+0)/2=5/2\), which is not an integer. The impossibility follows directly from the step-count equation; it is not a case to repair by rounding. In general, the encoding provides a quick order of work: solve for the number of up-steps, check feasibility, then count the allowable position sets.

Check Your Understanding

In each question, treat paths as unrestricted at intermediate times. Check feasibility before evaluating a binomial coefficient.

  1. How many length-seven paths from zero end at \(1\)? State the number of up-steps and verify the endpoint.
  2. Can a length-six path from zero end at \(-5\)? Use the required number of up-steps to justify your answer.
  3. Count length-eight paths from zero to \(4\) by choosing down-step positions instead of up-step positions.
  4. For a walk starting at \(x=2\), how many length-five paths end at \(1\)? Give the displacement, the number of up-steps, and the count.
  5. Explain why summing the path counts over all possible endpoints gives \(2^n\), including when \(n=0\).