How to Find the Expected Squared Distance in a Random Walk
At a glance
- 1. Define distance
Specify the graph, the distance measure, and the random walk’s starting state or distribution.
- 2. Find transition probabilities
Use the transition matrix to determine the probability of being at each vertex after the chosen number of steps.
- 3. Square distances
Measure each possible endpoint’s distance from the reference vertex, then square that distance.
- 4. Take the expectation
Multiply each squared distance by its endpoint probability and add the results.
“Expected value of the distance square” is not a unique quantity: you must specify what is moving, how distance is measured, and what the distance is measured from. A common graph-theory interpretation is the expected squared graph distance from the starting vertex to the position of a random walker after a fixed number of steps.
For that interpretation, find the probability of ending at each vertex, square its distance from the start, and take the probability-weighted sum. The method also applies to other random processes once you identify their possible outcomes and distances.
Expected squared distance on a graph
Let a random walk start at vertex , and let be its position after steps. Write for the graph distance between vertices and : the number of edges in a shortest path. The quantity of interest is
The square applies to the distance for each possible outcome before you take the expectation. In general,
where . In fact, .
Compute it using a transition matrix
For a finite, time-homogeneous Markov walk, encode the walk in its transition matrix , where is the probability of moving from vertex to vertex in one step. If the walk starts at , the probability of being at after steps is the entry of . Therefore,
The matrix-power formula assumes the walk is Markov and its transition probabilities are fixed over time. For a walk whose starting vertex is itself random, let be its starting probability distribution. The probability distribution after steps is , so, provided every vertex with positive probability under is connected to a fixed reference vertex , the expected squared distance from is
Worked example: a walk on a three-vertex path
Consider the path ——. A simple random walk moves to a uniformly chosen neighbor. Start at vertex and take two steps.
The first step must go from to . From , the walk moves to or , each with probability . Thus
The distances from the starting vertex are and . Squaring and weighting by the probabilities gives
For comparison, the expected distance is , whose square is , not . This illustrates why you must square each possible distance before averaging.
Common mistakes
- Squaring the mean instead of taking the mean square. Compute , not .
- Using the wrong distance. Graph distance counts edges in a shortest path. If vertices have coordinates and you mean straight-line distance, use the Euclidean distance instead; the calculation is still a probability-weighted sum of squared distances.
- Ignoring the reference point or time. Distance after one step can differ from distance after many steps, and distance from the start differs from distance between two independently sampled positions.
- Assuming every edge is equally likely. Uniform choice among a vertex’s neighbors defines the usual simple random walk. Weighted edges or other transition rules require their own transition probabilities.
If the intended quantity is the squared displacement of a one-dimensional or multidimensional walk, use the same expectation rule with the square of the displacement. For example, for a one-dimensional walk with position , the squared displacement from the origin is , so its expected value is . The distance convention and the walk’s step distribution determine how to evaluate it.
References
- Markov Chains
- Random Walks and Electric Networks
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.