Suppose we have a random walker on the 2D integer lattice $\mathbb{Z}^2$ starting at the origin (0,0), it can move in any direction (up, down, left, right) with equal probability (1/4).
What's the probability that it passes through the point (x, y) at least once in N steps.
I've tried multiple approaches, but didn't get far, this is a problem I stumbled upon while working on another, larger issue, and I'm not that well versed in random walks, I'm still looking for learning material.
In the meantime I wrote a small piece of python code that simulates the problem:
import random
def random_walk(n, a, b):
x = 0
y = 0
for i in range(n):
dx, dy = random.choice([(1,0), (-1,0), (0,1), (0,-1)])
x += dx
y += dy
if x == a and y == b:
return True # It reached the point (a, b)
return False # It never reached the point (a, b)
count = 0
for i in range(100000):
if random_walk(7, 3, 4):
count += 1
print("Percentage of times the random walk passes through (3, 4) with 7 steps: {:.2f}%".format(100 * count / 100000)) # About 0.2%