  We derive a simple expression for the probability of trajectories of a master
equation. The expression is particularly useful when the number of states is
small and permits the calculation of observables that can be defined as
functionals of whole trajectories. We illustrate the method with a two-state
master equation, for which we calculate the distribution of the time spent in
one state and the distribution of the number of transitions, each in a given
time interval. These two expressions are obtained analytically in terms of
modified Bessel functions.
