**Question:** If X is geometric with parameter p, find the probability that X is even.

**Analytical Solution**

This is a simple problem and I can think of many applications for this. Exercise 3.60 is would be the application of this exercise and it is mildly apparent to see why. The PMF of the geometric distribution is defined in one of the two ways. Which method is relevant would be dependent on whether you are tracking one of the following

- The number of failures required to get to the pass
- The instance on which the pass occurs

For the sake of this problem, we will look at the second instance which is the instance on which the pass occurs. We will both P{ X ∈ Even} and also P{ X ∈ Even }

Firstly, P { X = x } =(1-p)^{x-1} p ⇒

P { X = x | X ∈ Even } = Sum( P{X = x | X ∈ Even } ) and the summation limits are from 2 to ∞ in steps of 2 = – ^{(p-1)2}⁄_{(1-p)2(p-2)}

similarly,

P { X = x | X ∈ Odd } = Sum( P{X = x | x ∈ Odd } ) and the summation limits are from 1 to ∞ in steps of 2 = – ^{(p-1)2}⁄_{(1-p)(p-2)}

Pretty neat way to solve this. I simply used an infinite summation function in Mathematica and got these results. Then used the result to make a function which was used to plot the probabilities of being even or odd.

**Simulation Solution**

Look how the plots beautifully diverge while the sum probabilities along the y-axis is always equal one no matter what the x value is. The code for getting this plot is in the section below.

**Code**

A note, please paste the code below as-is. The symbolic notation from the code may not build itself appropriately if you create spaces in between

ClearAll[geometricOddEven]
geometricOddEven[p_Real] := {{p, \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(\[Infinity]\)]\(
\*SuperscriptBox[\((1 - p)\), \(\((2 i - 1)\) - 1\)] p\)\)}, {p, \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(\[Infinity]\)]\(
\*SuperscriptBox[\((1 - p)\), \(2 i - 1\)] p\)\)}}
geometricOddEven[p_List] := geometricOddEven /@ p
Module[{data = geometricOddEven[Range[0.05, 0.95, 0.05]]},
ListLinePlot[
Transpose[data],
Frame -> True,
GridLines -> {Range[0, 1, 0.05], Range[0, 1, 0.05]},
AspectRatio -> 1, ImageSize -> 700,
PlotLegends -> {"P{X=Odd}", "P{X=Even}"}, Mesh -> All,
MeshStyle -> {{Black, PointSize@0.005}},
FrameLabel -> {Style["p", 15, Italic], Style["P{X=Odd} and P{X=Even}", 15, Italic]}
]
]

End of the post 😀

### Like this:

Like Loading...