Every position in the random permutation has the same marginal colour probability, so . One can verify this with the law of total probability, conditioning on the first card:Here because both colour counts are positive.
The red positions form a uniformly chosen subset of size , so there are equally likely colour patterns. A contiguous red block can start at positions , giving exactly favourable patterns. ThereforeIf the cards are regarded as individually labelled, each colour pattern corresponds to permutations, so the same counting argument still applies. In the edge case , the formula correctly gives probability one.
Conditional on a contiguous red block, its possible starting positions remain equally likely because their original colour patterns had equal probabilities. The first card is red exactly when that block starts at position . HenceThis also follows by dividing the probability of the single favourable block position, , by the probability of all block positions.
Compute all three probabilities. From the preceding part, . Integrating the joint probability density function over givesOn one has and , soTherefore and are independent events. The minimum waiting time and the identity of the first clock are independent for competing exponential clocks; unequal rates change the winner probabilities but do not destroy that independence.
Using the rate parameter convention for the exponential distribution, independence gives the joint probability density functionFor , the survival probability of the minimum isThus has exponential distribution with rate , andValues of a probability density function at the single endpoint do not affect the probability distribution.
Condition on the fair coin choosing the initial chamber. The law of total probability gives . With , substituting the biased gambler's ruin probability givesBoth numerator and denominator in the first case have the same sign. Its limit as is the fair-walk value, since the ratio of their first derivatives is . The averaging is over initial locations, not over the transition probabilities.
The expected value of an indicator random variable is the probability of its event. For a simple symmetric random walk absorbed at , the gambler's ruin success probability from is . HenceThe boundary values are at the left exit and at chamber .
For , the success probability is , and the definition of conditional expectation on an event givesThereforeAt the value is zero because the trial has already ended. At the left absorbing state , conditioning on success would be undefined because it has zero probability. The formula concerns the successful trajectories, so it need not equal the unconditional mean .
Treat one visit to a level as a whole gambler's ruin excursion, starting at its chamber and ending at local chamber or . The room choices are fair, so the chance of reaching before is , and the chance of reaching first is . The one-way hatches reset the next excursion to chamber of the adjacent level. Thus the embedded Markov chain at level exits moves upward with probability and downward with probability , even though individual room choices are unbiased.
Let be the food probability from the lower starting chamber, and that from the upper chamber . The lower level either exits unsuccessfully or reaches the upper level, while the upper level either finds food or returns to the lower start. First-step analysis at these level exits givesSubstituting yields , soThis also follows from biased gambler's ruin probability on levels , starting at , with ratio : . Absorption occurs almost surely, since from each active level a fixed positive chance of terminal absorption occurs within two excursions; the original chamber excursions are also almost surely finite.
The maze reduced to level exits has upward probability one quarter and downward probability three quarters
. Details. For an array of size , the first probe finds the uniformly selected target with probability . Otherwise it leaves a half of size ; conditional on entering that half, its target is uniform there. Counting the first iteration in every case givesFor , the successful-search decision tree has targets at depth , requiring iterations. ThusThe numerator is , as follows by induction or by shifting and subtracting a finite geometric sum. Substituting givesThe base gives one iteration, as required.
Add a generic mapping method inside the supplied trait. Snapshot the finitely many source masses, and sum masses when different entries have the same image:Here the mapping is a mathematical function, and keys are assumed to have stable equality consistent with their intended identity. Each source atom is evaluated once when the new distribution is constructed. The distinct image list is exactly the finite support because all listed source atoms have positive mass. Summing collisions, rather than overwriting a previous mass, implements the probability pushforward.
def map[U](f: T => U): FiniteDist[U] = {
val entries = getDom.map(x => (f(x), getProb(x)))
val support = entries.map(_._1).distinct
new FiniteDist[U] {
def getDom: List[U] = support
def getProb(y: U): Double =
entries.foldLeft(0.0) { case (sum, (image, mass)) =>
if (image == y) sum + mass else sum
}
}
}The sets of source atoms with a fixed image partition the original support. Hence nonnegativity is preserved and, in exact probability arithmetic,Thus the result is a finite probability distribution. For a constant mapping, every atom merges into one outcome of mass one. Floating-point additions in the implementation can introduce rounding error, so numerical tests of normalization should use a suitable tolerance rather than demand exact equality of
Double sums.Equality can occur only at the two pairs and . Their combined probability isTaking the complementary probability givesSince , the supplied exponential bound impliesThis is a bound on the mismatch probability for this particular coupling of the two marginal distributions; the variables are not presumed independent.
Summing the two nonzero entries with givesThe remaining probability is , so has the Bernoulli distribution with parameter .
For the other marginal, the two entries at add to , the entry at is , and for the only nonzero entry is already . Thusand has the Poisson distribution with parameter . This also checks normalization of the joint probability mass function by summing the marginal.
There is no such value of in the specified interval. Indeed, , and the joint probability mass function givesThis contradicts independence for every . Equivalently, has joint probability zero but the product of its marginal probabilities is .
At the suggested value , the covariance is zero, but the same conditional probability contradiction still applies. This is an explicit example of how uncorrelated Bernoulli and Poisson variables need not be independent. Zero covariance controls one mixed moment, whereas independence requires the entire joint probability mass function to factor.
Let be a finite or countable partition of a set of the sample space into disjoint events, with . For any event , the law of total probability isTo prove it, the intersections are disjoint and have union . Countable additivity and the definition of conditional probability therefore giveIt is enough that the union of the partition events has probability one. Parts of probability zero contribute zero in the intersection formula and can be omitted before writing conditional probabilities; conditioning by division on a zero-probability part would be undefined.
There is no forbidden pair in a sequence of length zero or one, so . For , divide acceptable sequences into two disjoint cases. If the first digit differs from , its probability is , and the remaining independent digits must avoid the pair. If the first digit is , the next must differ from , which has combined probability , and the remaining digits must avoid the pair. The boundary between this prefix and the remaining digits cannot create a forbidden pair, because the prefix ends in a digit other than . ConsequentlyThe characteristic polynomial of a linear recurrence is , with distinct rootsWriting , the initial conditions give and . ThereforeFor example, , since only one of the nine equally likely pairs is forbidden. This is the case with success probability of the avoidance recurrence for two consecutive successes.
For , the first digits must all differ from and the next digit must be . Independence givesThus has the geometric distribution counting trials up to and including the first success, with success probability . For completeness, its mean follows from the tail-sum formula:The sum of the geometric series also proves finiteness of this expectation.
In the probability density function convention used here, a random variable has a nonnegative probability density function , with , such that for every Borel set ,In particular, its cumulative distribution function is and individual points have probability zero. More precisely, this property is the statement that the distribution is an absolutely continuous probability distribution; continuity of the cumulative distribution function alone is a weaker property and need not imply a probability density function.
The same integral works with both powers shifted:The assumptions and say precisely that the exponents at each endpoint are greater than , ensuring integrability there. Values of a negative power at the endpoints themselves can be assigned arbitrarily, because those endpoints have probability zero. This establishes the mixed power moments of a beta distribution without requiring and to be integers.[ref]
Let . Applying the same measurable function separately to independent and identically distributed random variables preserves those two properties, andIn particular, these bounded random variables are integrable random variables. The weak law of large numbers givesIf , then , whose probability tends to zero. If , then , whose probability also tends to zero. Taking a complement in the second case provesThe positive gap from is essential to this argument. Convergence in probability alone does not determine the answer at the excluded threshold .
