Random Signals for Engineers using MATLAB and Mathcad Copyright 1999 Springer Verlag NY Example 2.2 Geometric Distribution We will computer the probability that k heads in a row will occur before a tail appears in k + 1 repeated tosses of a coin. The coefficients of the individual probability terms are shown in Equation 2.1-2 to be equal to unity. The difference between this probability distribution and the Binomial one is that k can go between 0 and infinity. In order to calculate the probability that on the next set of coin tosses we will get 0 or 1 or .. k or .. heads in a row is determined by the summation of an infinite series. This series is called a geometric series and hence the name Geometric distribution. The formula for the closed form expression of the geometric series can verified using Matlab. Symbolically expand the closed form expression given to obtain syms a f=1/(1-a); pretty(f) 1 ----1 - a t=taylor(f,6); pretty(t) 2 1 + a + a 3 + a 4 + a 5 + a The terms in the series are identical to that in Equation 2.1-2. The series, which has individual terms equal to pk, can be directly summed for a finite number of terms and a closed form expression derived using Matlab. We may then take the limit as n goes to infinity to obtain the closed form expression for the series summation. syms p k t1=symsum(p^k,k,0,inf); pretty(t1) 1 - ----p - 1 The series can be shown to be convergent and hence the closed form expression is valid when |p| < 1. This condition is satisfied since p is a probability. The method used to find closed form expressions for series could be extended to a series where each term is k pk . This summation will be useful in further developments. Proceeding as above t2=symsum(k*p^k,k,1,inf); t2=simplify(t2) t2 = p/(p-1)^2 The closed form expression can be found directly from the expression for the geometric series. If we differentiate each term we obtain dp=simplify(diff(p^k,p)) dp = p^(k-1)*k When we multiply by p we obtain the term k pk. This can be performed for each term of the entire series as t3=diff(symsum(p^k,k,1,inf)); t3=simplify(t3) t3 = 1/(p-1)^2 Using a technique similar to the one used on the geometric series we can first differentiate the closed form expression and then expand the resultant closed form to obtain the desired series t4=taylor(t3,6); pretty(t4) 2 1 + 2 p + 3 p 3 + 4 p 4 + 5 p 5 + 6 p When we multiply by pwe obtain the desired closed form expression.