Random Walk Probability Calculator

Enter the number of steps, target position and step probability to get the result.

Result

0.250823
6
2.00

How it is calculated

For a walk of n steps, each step goes right (+1) with probability p and left (−1) with probability q = 1 − p. To finish at net position k you need r = (n + k) / 2 right steps, and then P = C(n, r) × pr × qn−r. The tool also reports r and the expected final position (2p − 1) × n. Enter p as a fraction between 0 and 1 (0.6, not 60). If n + k is odd, or |k| is larger than n, the position cannot be reached and the probability is shown as 0.000000. Steps and position are rounded to whole numbers, and a negative n or a p outside 0 to 1 gives no result. The probability is shown to six decimals.

Worked example

Ten steps, ending two places to the right of the start, with p = 0.6. Right steps: r = (10 + 2) / 2 = 6, so 4 steps go left. The number of orderings is C(10, 6) = 210. Then 0.66 = 0.046656 and 0.44 = 0.0256, and 210 × 0.046656 × 0.0256 is about 0.2508. The tool shows a probability of 0.250823, with 6 right steps and an expected position of 2.00.

Try this example →

Common mistakes

  • Typing p as a percentage (60) instead of a fraction (0.6). Values above 1 are rejected and the tool returns no result.
  • Picking an impossible target. After 10 steps you can only be at an even position, so k = 3 gives 0.000000. This is correct, not an error: the position always has the same parity as n.
  • Confusing k with the number of right steps. k is the net displacement (right minus left); the right steps r = (n + k) / 2 are shown separately.
  • Reading the result as the probability of reaching k at some point during the walk. It is the probability of being exactly at k after the last step, not of ever visiting it.
  • Comparing the expected position with the most likely one. The expected value (2p − 1) × n is an average and may not be an attainable position itself, for example with odd n and p = 0.5.

About this calculator

The random walk probability calculator computes, for a simple 1D random walk of n steps where each step moves +1 with probability p and −1 with probability q = 1 − p, the probability of ending at a specific position k. Since ending at position k after n steps requires exactly (n+k)/2 forward steps and (n−k)/2 backward steps, the answer follows the binomial distribution: P(k) = C(n, (n+k)/2) × p^((n+k)/2) × q^((n−k)/2).

The random walk is one of the most widely reused models in applied math: it describes the diffusion of a particle in Brownian motion, is the discrete-time skeleton behind stock-price models like geometric Brownian motion, and shows up in gambler's-ruin problems in probability theory. Statistics and finance students, and researchers modeling stochastic processes use this calculator to check the closed-form binomial result against a simulation or textbook problem.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators