2D Random Walk Hitting Time Suppose there is a grid $[1,N]^2$. A person standing at some initial point $(x_0,y_0)$ walk randomly within the grid. At each location, he/she walks to a neighboring location with equal probability (e.g., for an interior point, the probability is $\frac{1}{4}$; for a corner, it's $\frac{1}{2}$.). Suppose there are $m$ absorbing barriers $B=\{(x_1,y_1),\cdots,(x_m,y_m)\}$ inside the grid. Once the person is on a barrier, the random walk process stops. I'd like to ask how to calculate the hitting probability and the expected number of steps for each barrier.
Edit: The problem can be transformed into a Markov chain. But the expected hitting time for each absorbing state is still not easy to calculate.
 A: As mentioned in the edit, this can be represented as a Markov chain - in particular, a discrete time Markov chain on a finite state space, which is absorbing.
For much of the answer below, my reference is "Grinstead and Snell's Introduction to Probability", currently located at this link https://math.dartmouth.edu/~prob/prob/prob.pdf
For such a Markov chain, the states which are not absorbing are called transient. If there are $t$ transient states (for the posted problem, $t=N^2 - m$) and $r$ absorbing states (for the posted problem, $r=m$), it is common to order the states so that the transient states are first, so that the probability transition matrix is in block form as:
$$
P = \begin{bmatrix} Q & R\\ 0 & I_r \end{bmatrix}
$$
Here $Q$ is $t \times t$, $R$ is $t \times r$, $0$ is the $r \times t$ zero matrix, and $I_r$ is the $r \times r$ identity matrix.
It is known that the $i,j$ entry of the "fundamental" matrix $N = (I_t - Q)^{-1}$ is the expected number of times that the chain will visit transient state $j$ if it started in transient state $i$.
Therefore, the sum of the $i^\mathrm{th}$ row of $N$ is the expected number of steps before being absorbed, if starting in transient state $i$.
The probability of being absorbed into absorbing state $j$, $1\le j \le r$, if the chain started in transient state $i$, is the $i,j$ entry of $B = NR$.
As for "the expected number of steps for each barrier", if the chain starts in a transient state $i$ that has a nonzero probability of not hitting a particular absorbing state $j$, then I believe the interpretation of the "expected number of steps to hit that barrier" would be infinity, since there is a positive probability that it will never hit the barrier.
But, if we are conditioning on the event that the chain is absorbed into barrier $j$, starting from state $i$, then to find the "expected number of steps before being absorbed", you proceed as above with two modifications:
First, you would consider a chain of only the transient states with positive probability of being absorbed into absorbing state $j$, together with absorbing state $j$ (so $r=1$).  Any transient states that could not be absorbed into absorbing state $j$ (such as a transient state surround by other barriers) would not be a part of this new chain. Neither would the other absorbing states.
Second, you would use conditional probabilities in your probability transition matrix for this chain, so that the rows still sum to one. For example, if a state used to have four neighbors, but one of them was a barrier that we know it doesn't transition to (since it eventually gets absorbed into a different barrier), then the conditional probability that the random walk transitions to each of those three remaining neighbors is $\frac{1}{3}$.
Then you would have
$$P' = \begin{bmatrix} Q' & R'\\ 0 & 1 \end{bmatrix}$$
You would solve for $N' = (I - Q')^{-1}$, and the expected number of steps before being absorbed, starting from transient state $i$, is the sum of the $i^\mathrm{th}$ row of $N'$.
