**Question: **An individual traveling on the real line is trying to reach the origin. However, the larger the desired step, the greater is the variance in the result of that step. Specifically, whenever the person is at location x, he next moves to a location having mean 0 and variance βx^{2}. Let X_{n} denote the position of the individual after having taken n steps. Supposing that X_{0} = x_{0}, find

- E[X
_{n}] - Var(X
_{n})

**Analytical Solution**

*E[X*– Calculation of the expectation is easy. This is an accumulation of events and at each stage, and at every step, the distance moved has a mean of zero. This means the E[X_{n}]_{n}] would be the initial position which is x_{0}*Var(X*This can be calculated as follows. Define the variance at the n_{n}) –^{th}step and back calculate using conditionality- Var(X
_{n}) = E[(X_{n})^{2}] – E[(X_{n})]^{2}= E[(X_{n})^{2}] – 0 = E[(X_{n})^{2}] = E[(X_{n})^{2}|X_{n-1}] = βE[(X_{n-1})^{2}] - Applying this recursively, we get β
^{n}E[(X_{n-1})^{2}]

- Var(X

**Simulation Solution**

What is being shown in the diagram? The diagrams are semi-self-explanatory

- The first one is the progression of the events, as in it shows the position of the person as the iterations progress
- The second collects the x
_{0}from across various steps and shows them as distribution at each stage, the labels on the top of the chart element are the E[X_{n}] for that iterations - The third also collects the x
_{0}from across various steps and shows them as distribution at each stage, but the labels on the top of the chart element are the Var(X_{n}) for that iterations

**Code**

Module[ {\[Beta] = 0.1, iterations = 25, simulation, iterationValues, linePlot, distributionMean, distributionVariance, aspectRatio = AspectRatio -> 0.3}, simulation = Table[ NestList[# + RandomVariate[NormalDistribution[0, \[Beta] Power[#, 2]]] &, 1, iterations], 100]; iterationValues = Transpose@simulation; linePlot = Labeled[ ListLinePlot[ simulation, PlotRange -> {{0, iterations + 1}, All}, PlotStyle -> {{Thickness[0], Opacity@0.2, Purple}}, InterpolationOrder -> 2, Frame -> True, GridLines -> {Range[0, iterations], None}, ImageSize -> 788, aspectRatio ], Rotate["Progression", Divide[Pi, 2]], Left]; {distributionMean, distributionVariance} = Table[ Labeled[ DistributionChart[iterationValues, GridLines -> {None, {1}}, ImageSize -> 788, ChartLabels -> Placed[Rotate[" " <> ToString[#], Divide[Pi, 2]] & /@ (params[[1]] /@ iterationValues), Above], ChartElementFunction -> "PointDensity", aspectRatio], Rotate[params[[2]], Divide[Pi, 2]], Left], {params, {{Mean, "Mean"}, {Variance, "Variance"}}}]; Framed@Column[{linePlot, distributionMean, distributionVariance}] ]

End of the post 😉

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.