FirstPassageTimeDistribution
represents the distribution of times for the Markov process mproc to pass from the initial state to final states f for the first time.
Details

- FirstPassageTimeDistribution is also known as first hitting time.
- The Markov process mproc can be a DiscreteMarkovProcess or ContinuousMarkovProcess.
- The probability for time t in a FirstPassageTimeDistribution is equivalent to Probability[x[t]∈f∧∀τ,0<τ<tx[τ]∉fx[0]i,xmproc], where i is the initial state.
- If mproc is already in the target state, FirstPassageTimeDistribution gives a distribution for the mean recurrence time.
- If the chain is absorbing and the target states are non-absorbing, FirstPassageTimeDistribution gives a distribution conditional on reaching the target states.
- FirstPassageTimeDistribution represents a discrete phase-type distribution for discrete-time Markov processes and a continuous phase-type distribution for continuous-time Markov processes.
- FirstPassageTimeDistribution can be used with such functions as Mean, Quantile, PDF, and RandomVariate.
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Compute the mean, variance, and PDF for the number of steps needed to go to state 3:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-bkoauo

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-jex408

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-bjf06u


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-fcck3k

Cumulative distribution function:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-cdhei7


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-y2037

Mean time to first passage and variance:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-djhuug


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-bsgg60

Scope (3)Survey of the scope of standard use cases
First passage time distribution for a continuous Markov process:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-qo3s5

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-jooaq4

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ld576x


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-fq54eu


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-j1xjm6


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-c06a3i

Compare with the result from simulation:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-tv2xj

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-brj8v0


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-me8le8

Compute the probability of an event:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-1cefn


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hr0ec6

Find the mean and the variance of the first passage time through target states, conditional on reaching them:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-p278q0

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-n09fgn


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-byxla6

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-evqu2r

Compare against a process simulation:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-f7216x

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-c02k24

Generate a set of pseudorandom numbers from the distribution:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-nj4yg

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-dmx7kz
Compare its histogram to the PDF:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-zaoeh

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-iifl09

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-mdb8xx

Applications (7)Sample problems that can be solved with this function
A taxi is located either at the airport or in the city. From the city, the next trip is to the airport with probability 1/4, or to somewhere else in the city with probability 3/4. From the airport, the next trip is always to the city. Model the taxi, using a discrete Markov process, with state 1 representing the city and state 2 representing the airport, starting at the airport:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-d0mrsk
Find the expected number of trips until the taxi's next visit to the airport:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hg5rnm

A gambler, starting with 3 units, places a 1-unit bet at each step, with a winning probability of 0.4 and a goal of winning 7 units before stopping. Find the expected playing time until the gambler achieves his goal or goes broke. The gambling process can be modeled as a discrete Markov process, where state represents the gambler having
units:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ck21qb

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ls41g3
Simulate some typical gambling scenarios:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-poecj


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-d1ubhz

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-b7zsm8

The full distribution for playing time:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-gcfutx

The probability that playing time is 10 or less:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-95oz6

Find how many times, on average, you have to roll a die until you have seen all six faces:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-g18k2w

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-m0fw0

When flipping an unbiased coin, on average it takes longer for HHT to occur than for HTT:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-qpny53

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-gfyjcx


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-i1z667


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-lyk44

A particle moves between the eight vertices of a cube by a symmetric random walk. Let be the initial vertex and
be the opposite vertex. Compute:
• the expected number of steps until the particle returns to
• the expected number of steps until the first visit to

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-xfj82

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-efyc1i

Expected number of steps before returning to , if starting at
:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ojtz6

Expected number of steps until first visit to , if starting at
:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-0rb9c

Use the mean hitting time to bound the expected cover time for an irreducible process:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-btvkt2

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-bcijvb

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-b0eotz


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-iddt9v

The Hubble space telescope carries six gyroscopes, with a minimum of three required for full accuracy. The operating times of the gyroscopes are independent and exponentially distributed with failure rate . If a fourth gyroscope fails, the telescope goes into sleep mode, in which further observations are suspended. It requires an exponential time with mean
to put the telescope into sleep mode, after which the base station on Earth receives a sleep signal and a shuttle mission is prepared. It takes an exponential time with mean
before the repair crew arrives at the telescope and has repaired the stabilizing unit with the gyroscopes. In the meantime, the other two gyroscopes may fail. If the last gyroscope fails, the telescope will crash. Suppose
,
, and
, all with units of inverse years:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-dvtx91

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-x0xst


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hb9lz9
Find the probability that the telescope will crash in the next 10 years:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hhmfx8

Find the probability that sleep mode is not reached (no shuttle mission is required) in 10 years:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ooc68l

Properties & Relations (4)Properties of the function, and connections to other functions
The average number of steps to go from state 1 to state 3 is 2:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ief5d8

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-jt4n7q


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-dyv78r

Since the process is deterministic, the variance is zero:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hy0su3

The mean and variance for a continuous process with acyclic bidiagonal transition rate matrix:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-d5v1rc

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-lflb4


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-drazgz

When the target is one of the absorbing states, a conditional distribution is returned:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ckq0xt

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-cb9633

The assumption is that the process reaches the target state and does not get stuck in state 1:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hlse76

Autosimplification to ExponentialDistribution or other phase-type distributions:

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-hhm0ii


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-qolmh


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-i19ktw


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-bmz3gz


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-ika9yv


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-dtspt4


https://wolfram.com/xid/0jvjoo367v4i5t0kra06-9j3c

Possible Issues (1)Common pitfalls and unexpected behavior
Here, a closed form is not available for the moments of arbitrary order :

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-plrrgv

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-10e4k

Obtain a moment by specifying the value of :

https://wolfram.com/xid/0jvjoo367v4i5t0kra06-gizzt

Wolfram Research (2012), FirstPassageTimeDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html.
Text
Wolfram Research (2012), FirstPassageTimeDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html.
Wolfram Research (2012), FirstPassageTimeDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html.
CMS
Wolfram Language. 2012. "FirstPassageTimeDistribution." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html.
Wolfram Language. 2012. "FirstPassageTimeDistribution." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html.
APA
Wolfram Language. (2012). FirstPassageTimeDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html
Wolfram Language. (2012). FirstPassageTimeDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html
BibTeX
@misc{reference.wolfram_2025_firstpassagetimedistribution, author="Wolfram Research", title="{FirstPassageTimeDistribution}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_firstpassagetimedistribution, organization={Wolfram Research}, title={FirstPassageTimeDistribution}, year={2012}, url={https://reference.wolfram.com/language/ref/FirstPassageTimeDistribution.html}, note=[Accessed: 26-March-2025
]}