Random walk - What's bro's RMS?
Imagine you and your friend are standing on the sidewalk and you suggest a fun game.
"Hey, what if for no reason we flipped a coin, and if it lands on heads you move 1 meter right, and if it's tails you move 1 meter left?"
Your friend, who is "down for whatever bro," thinks it's a great idea and agrees to play. You decide to flip the coin 10 times because none of you losers have a life.
Symbols:
x₁ = One bro's current position
N = Number of flips
Here's how it works
If the coin lands on heads we add 1 to the current position (x₁), and if it lands on tails we subtract 1 from the current position.
Your friend starts at position 0 and you flip the coin and it lands on heads (+1).
x₁ = 1 (one step to the right)
Then you flip it again and it lands on heads (+1) again.
x₁ = 2 (two steps to the right)
The third flip it lands on tails (−1).
x₁ = 1 (back to one step to the right)
Now imagine you have more bros playing at the same time, like 10 of them. And each of them is going to participate in this stupid game.
Each bro gets assigned a number x₁ – x₂₀₀, and capital X without a subscript represents a list of all current positions for each bro:
X = [x₁, x₂, x₃, ..., x₁₀]
Each item in the above list represents an individual bro's current position.
Symbols updated:
x₁ = One bro's current position
N = Number of flips
X = All bros' current positions
Where is bro?
What if we wanted to ask the question: "If you pick any random bro from the list, what will his position be?" How would you answer that?
We know that each bro can only walk right (+1) or left (−1) for each flip, and they are both equally likely to happen since we are using a fair coin. That means that the result for 10 flips might look like this:
[1, 1, −1, 1, −1, −1, 1, −1, 1, −1]
That is five heads and five tails. Let's sum these:
x₁ = 1 + 1 − 1 + 1 − 1 − 1 + 1 − 1 + 1 − 1 = 0
This particular bro got five of each, so he is back where he started. Most bros won't be. Another bro might end up slightly to the right or left, and some bros are lucky to get long streaks:
X = [0, 2, −4, −2, 4, −2, 4, 2, −4, 0]
The sum of all bros ends up at 0 because each position cancels the others out.
⟨X⟩ = 0 / 10 = 0
Angle brackets ⟨⟩ mean average
If you pick a bro at random, will his position be 0? No. The problem with using the mean is that it answers the question "which direction does the coin push the bros?"
Then the answer 0 is correct: the coin is fair, so it does not push the bros in any direction.
Symbols updated:
x₁ = One bro's current position
N = Number of flips
X = All bros' current positions
⟨X⟩ = Mean of all bros' current positions
Where is bro, really?
To find out where bro would typically be, we calculate something called the root mean square, or RMS for short. The RMS will answer the question "how far from the start does a bro end up?"
Step 1 – Square each bro's position
X² = [0², 2², (−4)², (−2)², 4², (−2)², 4², 2², (−4)², 0²] = [0, 4, 16, 4, 16, 4, 16, 4, 16, 0]
Notice how squaring converts negative numbers to positive
Step 2 – Calculate the mean
Sum of X² = (0 + 4 + 16 + 4 + 16 + 4 + 16 + 4 + 16 + 0) = 80
⟨X²⟩ = 80 / 10 = 8
Step 3 – Root
√⟨X²⟩ = 2.83
Symbols updated:
x₁ = One bro's current position
N = Number of flips
X = All bros' current positions
⟨X⟩ = Mean of all bros' current positions
⟨X²⟩ = Mean squared of all bros' current positions
√⟨X²⟩ = Root of the mean squared of all bros' current positions
So the typical bro would be 2.83 meters from where he started. But what if we want to predict the RMS before we even start the game?
Predict the RMS
It turns out that ⟨X²⟩ equals the number of flips (N), which makes it pretty easy to calculate — because if ⟨X²⟩ = N, then √⟨X²⟩ = √N.
So let's try it with 10 flips:
√10 = 3.16
Wait, we got 2.83 when we tried it on a real run! Well, that's because our sample of bros is small. Use a bigger one and it settles down onto 3.16.
So now you can answer the question: WHERE ARE THE BROS, before they even start flippin' the coins.
RMS with different step lengths
If we want to change the step length from 1 meter to 2 meters per step ⟨X²⟩ = N no longer holds true. Instead we need to multiply with the step length instead using the symbol L for length.
⟨X²⟩ = L²N
The mean squared of all bros' current positions equals the step length squared, times the number of flips.
⟨X²⟩ = 2² × 10 = 4 × 10 = 40
And since the RMS is the square root of ⟨X²⟩:
√40 = 6.32