# How to simulate a random walk on a sphere

1. ### phonic

28
Dear All,

I am simulating a random walk on a sphere with unit radius. I want to move from current location p_t to the new location p_{t+1} along the big circle, whose arc has an angle omega relative to p_t's latitude. I tried using the law of cosine. But at the poles, the law of cosine diverges. Can anyone help find a method that works for all location on the sphere? Thanks!

So say, at each step, you want to move by an angle $\alpha$ along a random great circle through the current point. If your current point is the "north pole", i.e. (0,0,1) in xyz coordinates, then that's just a rotation, call it R, by $\alpha$, with axis a random line in the xy-plane.
So then the effect of $CRC^{-1}$ on p is to carry it to a new point at an angular distance $\omega$ away, along a random great circle passing through p.