Monday, October 5, 2026

Just keep swimming, normally ...

Another pond that’s also long and straight contains many, many koi. Initially, they’re all placed at the center of the pond, after which they all swim off at random velocities chosen from a normal distribution with a mean of 0 and a standard deviation of 1 mile per hour. A fish with a positive velocity initially swims toward one end of the pond, while a fish with a negative velocity initially swims toward the other end. The fish then swim back and forth, over and over again.

As before, you place a sensor in the water that measures the speed of each passing fish. All speeds are recorded as positive; direction no longer matters. You collect many such measurements over the course of several days, after which you read out the data and compute the average speed the sensor detected. Toward what value will this average speed converge?

As we saw in the Classic problem, with the added caveat that the sensor will pick up absolute speed, rather than signed velocities, if we have $v_i \sim \mathcal{N}(0,1),$ $i = 1, \dots, n,$ then we have $$\hat{v}_n = \frac{\sum_{i=1}^n v_i^2}{\sum_{i=1}^n |v_i|}.$$ Since we have many fish, let's define break the numerator and denominator up and try to use the Central Limit Theorem to understand what will happen in this case.

Let's define $A_n = \sum_{i=1}^n v_i^2$ and $B_n = \sum_{i=1}^n |v_i|.$ Let's first establish the prerequisites for the CLT. Firstly we see that for each $i = 1, \dots, n,$ we have $$\mathbb{E} |v_i| = 2 \int_0^\infty v \frac{e^{-v^2/2}}{\sqrt{2\pi}} \,dv = \sqrt{\frac{2}{\pi}} \left[ - e^{-v^2/2} \right]_{v=0}^{v=\infty} = \sqrt{\frac{2}{\pi}} \lt \infty,$$ and since each $v_i \sim \mathcal{N}(0,1)$ we have $$\mathbb{E} v_i^2 = 1.$$ Further we have $$var(|v_i|) = \mathbb{E} \left( |v_i| - \sqrt{\frac{2}{\pi}} \right)^2 = \mathbb{E} v_i^2 - 2\sqrt{\frac{2}{\pi}} \mathbb{E} |v_i| + \left( \sqrt{\frac{2}{\pi}} \right)^2 = 1 - \frac{2}{\pi} \lt \infty$$ and $$var(v_i^2) = \mathbb{E} \left( v_i^2 - 1 \right)^2 = \mathbb{E} v_i^4 - 2 \mathbb{E} v_i^2 + 1 = 3 - 2 + 1 = 2 \lt \infty.$$ Therefore, we see from the CLT, that $A_n \to \mathcal{N} (n, 2n)$ and $B_n \to \mathcal{N} ( n\sqrt{\frac{2}{\pi}}, n(1- \frac{2}{\pi}) ),$ uniformly in distribution. In particular, since we have each $v_i$ is independent we have $$\mathbb{E} \left[ v_i^2 |v_j| \right] = \mathbb{E} \left[ v_i^2 \right] \mathbb{E} |v_j| = \sqrt{\frac{2}{\pi}}$$ if $i \ne j$ and \begin{align*}\mathbb{E} |v_i|^3 &= 2 \int_0^\infty v^3 \frac{e^{-v^2/2}}{\sqrt{2\pi}} \,dv\\ &= \sqrt{\frac{2}{\pi}} \left[ \left( -v^2e^{-v^2/2} \right)_{v=0}^{v=\infty} + 2\int_0^\infty ve^{-v^2/2} \,dv \right]\\ &= 2 \sqrt{\frac{2}{\pi}},\end{align*} so we further see that \begin{align*}corr(A_n, B_n) &= \mathbb{E} \left[ \left( \frac{A_n - n}{\sqrt{2n}} \right) \left( \frac{B_n - n \sqrt{\frac{2}{\pi}}}{\sqrt{n(1 - \frac{2}{\pi})}} \right) \right]\\ &= \frac{\sqrt{\pi}}{n\sqrt{2(\pi-2)}} \mathbb{E} \left[ \sum_{i=1}^n \sum_{j=1}^n v_i^2 |v_j| - n \sqrt{\frac{2}{\pi}} \sum_{i=1}^n v_i^2 - n \sum_{j=1}^n |v_j| + n^2 \sqrt{\frac{2}{\pi}} \right] \\ &= \frac{\sqrt{\pi}}{n \sqrt{2(\pi-2)}} \left( n \left(2 \sqrt{\frac{2}{\pi}} \right) + (n^2 - n) \sqrt{\frac{2}{\pi}} - n^2 \sqrt{\frac{2}{\pi}} \right) \\ &= \frac{\sqrt{\pi}}{ n \sqrt{2(\pi -2)}} \left( n \sqrt{\frac{2}{\pi}} \right) = \frac{1}{\sqrt{\pi - 2}}.\end{align*} So in particular, if we define $Z_A, Z_B \sim \mathcal{N}(0,1)$ with $\mathbb{E} Z_AZ_B = \frac{1}{\sqrt{\pi-2}},$ then we can define $A_n = n + \sqrt{2n} Z_A$ and $B_n = n\sqrt{\frac{2}{\pi}} + \sqrt{n (1 - \frac{2}{\pi})} Z_B.$

Let's define use the properties of the natural logarithm to see if we can discern the distribution of $\hat{v}_n = A_n / B_n.$ We see that \begin{align*}\ln \hat{v} = \ln \left(\frac{A_n}{B_n}\right) &= \ln \left( \frac{ n + \sqrt{2n} Z_A }{ n\sqrt{\frac{2}{\pi}} + \sqrt{ n(1-\frac{2}{\pi})} Z_B } \right) \\ &= \ln \left( \frac{n}{n \sqrt{\frac{2}{\pi}}} \frac{1 + \sqrt{\frac{2}{n}} Z_A}{1 + \sqrt{ \frac{\pi -2}{2n} } Z_B } \right)\\ &= \ln \sqrt{\frac{\pi}{2}} + \ln \left( 1 + \sqrt{\frac{2}{n}} Z_A \right) - \ln \left( 1 + \sqrt{\frac{ \pi - 2 }{ 2n} } Z_B \right) \\ & \approx \ln \sqrt{\frac{\pi}{2}} + \sqrt{\frac{2}{n}} Z_A - \sqrt{\frac{\pi-2}{2n}} Z_B,\end{align*} where we take advantage of the Taylor approximation $\ln (1+t) = t + O(t^2).$ Let's define $\tilde{Z} = \sqrt{\frac{2}{n}} Z_A - \sqrt{\frac{\pi-2}{2n}} Z_B \sim \mathbb{N}(0,\nu^2),$ where we can calculate \begin{align*}\nu^2 &= \left( \sqrt{\frac{2}{n}} \right)^2 + \left( \frac{\pi - 2}{2n} \right)^2 - 2 \left( \sqrt{\frac{2}{n}} \right) \left( \sqrt{\frac{\pi-2}{2n}} \right) \mathbb{E} Z_AZ_B \\&= \frac{2}{n} + \frac{\pi-2}{2n} - 2 \sqrt{ \frac{2}{n} \frac{\pi - 2}{2n} \frac{1}{\pi - 2} } = \frac{\pi-2}{2n}.\end{align*} Therefore, we see that $\hat{v}$ is approximately log-normally distributed as $\hat{v} \sim \text{Log}\mathcal{N} (\mu, \sigma^2)$ with parameters $\mu = \ln \sqrt{\frac{\pi}{2}}$ and $\sigma^2 = \frac{\pi-2}{2n}.$ From here we see that if there are many fish with normally distribution signed velocities, then the average speed recorded by our sensor will converge to $$\lim_{n\to \infty} \mathbb{E} \hat{v}_n = \lim_{n\to \infty} \exp \left( \ln \sqrt{\frac{\pi}{2}} + \frac{1}{2} \left( \frac{\pi-2}{2n} \right) \right) = \lim_{n\to\infty} \sqrt{\frac{\pi}{2}} \exp \left( \frac{\pi - 2}{4n} \right) = \sqrt{\frac{\pi}{2}}.$$

Just keep swimming ....

Two koi, Nemo and Dory, live in a pond that’s long and straight. All day long, they swim back and forth, over and over again. Nemo supposedly swims at a speed of exactly 1 mile per hour, while Dory swims faster at 2 miles per hour. That said, you design an experiment to measure their speeds.

You place a sensor in the water that measures the speed of any passing fish and records the event in a log. You collect many such measurements over the course of several days, after which you read out the data and compute the average speed of all the events in the log. If indeed the fish’s speeds were 1 and 2 miles per hour, what average should you expect to get?

Let's assume that the pond has a length of $\ell$ miles. No matter where Nemo and Dory start within the pond or where the sensor is, we know that if the fish's speeds really where 1 and 2 miles per hour, respectively, then after $T = 2 \ell$ hours, then Nemo would pass the sensor exactly twice while Dory would pass the sensor exactly four times. Therefore, the sensor's log would read something like $[ 2, 1, 2, 2, 1, 2 ],$ or any of the other 30 orderings, and thus the average fish speed would be $\frac{ 4 \cdot 2 + 2 \cdot 1 }{4 + 2} = \frac{5}{3}.$

But wait, you say, what if $T$ is not a multiple of $2 \ell$? Let's define the $N_n(T)$ and $N_d(T)$ as the number of times that the sensor picks up Nemo and Demo, respectively. Though obviously counting statistics are defined only on the integers, we see that we should have roughly $$N_n(T) \approx \frac{T}{\ell} \,\, \text{and} \,\, N_d(T) \approx \frac{2T}{\ell}.$$ Therefore, we again arrive at the fact that the average speed recorded by our sensor will be $$\hat{v} = \frac{ 1 \cdot N_n(T) + 2 \cdot N_d(T) }{N_n(T) + N_d(T)} \approx \frac{\frac{T}{\ell} + \frac{4T}{\ell}}{ \frac{T}{\ell} + \frac{2T}{\ell}} = \frac{5}{3}.$$

In general, we see that for any speeds $v_n$ and $v_d,$ that the average speed recorded would be $\hat{v}= \frac{v_n^2 + v_d^2}{v_n + v_d}.$