What is the Probability that a Knight stays on chessboard after N hops?

The problem is a Markov chain, and we can attack it with linear algebra!

First, we can simplify the problem by exploiting the symmetry of both the knight's movement and the chessboard. Let's add the following rule:

  • After every move, the knight is reflected across the horizontal, vertical, and diagonal axes of symmetry, until it rests in the upper-left triangle of $10$ squares.

In other words, the legal positions are 1a, 1b, 1c, 1d, 2b, 2c, 2d, 3c, 3d, and 4d. You can visualize these positions as occupying one of the $8$ triangles in this diagram:

Reflection symmetries of a square

Now, there are $11$ positions that the knight can occupy after a move: the $10$ positions just named, and $1$ position representing not-on-the-board. For $i,j\in[1,11]$, let $P_{i,j}$ be the probability of transitioning from $i$ to $j$. There are $11\times11=121$ probabilities to calculate, and I suspect that this part must be done by hand.

Now we have an $11\times11$ square matrix $P$. For all $n$, the matrix power $P^n$ is the transition matrix for $n$ moves! So, let's arbitrarily index the initial square as $i=1$ and the off-the-board position as $j=11$. Then the probability of leaving the board after $n$ moves is $(P^n)_{1,11}$, and the probability of staying on the board is: $$1-(P^n)_{1,11}$$ That's as far as I can take you. You could express this formula more explicitly by calculating $P$ and then finding its Jordan normal form. Then you'll have a formula for the powers $P^n$, and you can pull out whatever matrix element you want. If you've seen the explicit formula for the Fibonacci numbers, it's the same principle, but with a larger matrix!

Edit: You've commented that if the knight is in the center of the board, then it can't exit the board in $1$ move. This is a useful obvservation. If we index positions 3c, 3d, and 4d as $i=8,9,10$, then it tells us that $P_{8,11}=P_{9,11}=P_{10,11}=0$. So you see, the matrix $P$ can represent pretty much everything we know about the problem.

Another example of reading information from $P$: You have a rule that if the knight leaves the board, it can't come back. This translates to the statement that $P_{11,11}=1$, and for all $j<11$, $P_{11,j}=0$. Between this paragraph and the previous paragraph, we already know $14$ matrix elements. There are just $107$ more to calculate...

Edit 2: Another example. You commented that from the initial position, only $2$ out of $8$ possible moves stay on the board. That tells us that $P_{1,11}=3/4$. The knight can stay on the board by moving to 2c or 3b. In my scheme, 3b gets reflected back to 2c. So if we index 2c as $j=6$, then $P_{1,6}=1/4$. For all other $j$ besides $6$ and $11$, we have $P_{1,j}=0$. That's another $11$ matrix elements calculated; $96$ to go...


As mentioned by Chris Culter, the computation is somewhat tedious. Following Chris and labeling the 64 fields so as to make the symmetries explicit, e.g:

$$ 0 \ \ 7 \ \ 6 \ \ 3 \ \ 3 \ \ 6 \ \ 7 \ \ 0 \\ 7 \ \ 9 \ \ 1 \ \ 5 \ \ 5 \ \ 1 \ \ 9 \ \ 7 \\ 6 \ \ 1 \ \ 8 \ \ 4 \ \ 4 \ \ 8 \ \ 1 \ \ 6 \\ 3 \ \ 5 \ \ 4 \ \ 2 \ \ 2 \ \ 4 \ \ 5 \ \ 3 \\ 3 \ \ 5 \ \ 4 \ \ 2 \ \ 2 \ \ 4 \ \ 5 \ \ 3 \\ 6 \ \ 1 \ \ 8 \ \ 4 \ \ 4 \ \ 8 \ \ 1 \ \ 6 \\ 7 \ \ 9 \ \ 1 \ \ 5 \ \ 5 \ \ 1 \ \ 9 \ \ 7 \\ 0 \ \ 7 \ \ 6 \ \ 3 \ \ 3 \ \ 6 \ \ 7 \ \ 0 \\ $$ it follows that the probabilities for the knight at time step $n+1$ to be at each of the fields labeled with the numbers $0,1,2,..,9$ can be expressed via: $$\begin{pmatrix}p_0^{(n+1)}\\p_1^{(n+1)}\\p_2^{(n+1)}\\p_3^{(n+1)}\\p_4^{(n+1)}\\ p_5^{(n+1)}\\p_6^{(n+1)}\\p_7^{(n+1)}\\p_8^{(n+1)}\\p_9^{(n+1)}\end{pmatrix} = \frac{1}{8} \begin{pmatrix}0&1&0&0& 0 & 0 & 0 & 0 & 0 & 0\\ 1&0&1&1&1&1&1&0&0&0\\ 0&1&0&0&1&1&0&0&2&0\\ 0&1&0&0&1&0&0&0&1&1\\ 0&1&1&1&2&1&1&0&0&1\\ 0&1&1&0&1&0&1&1&1&0\\ 0&1&0&0&1&1&0&1&0&0\\ 0&0&0&0&0&1&1&0&1&0\\ 0&0&2&1&0&1&0&1&0&0\\ 0&0&0&1&1&0&0&0&0&0\end{pmatrix} \begin{pmatrix}p_0^{(n)}\\p_1^{(n)}\\p_2^{(n)}\\p_3^{(n)}\\p_4^{(n)}\\ p_5^{(n)}\\p_6^{(n)}\\p_7^{(n)}\\p_8^{(n)}\\p_9^{(n)}\end{pmatrix}$$

with $p_0^{(0)}=1/4$ and $p_i^{(0)}=0$ for all $i>0$.

The requested probability for the knight to be on the board after $n$ moves equals the sum $$4p_0^{(n)}+8p_1^{(n)}+4p_2^{(n)}+8p_3^{(n)} +8p_4^{(n)}+8p_5^{(n)}+8p_6^{(n)}+8p_7^{(n)}+4p_8^{(n)}+4p_9^{(n)}$$ For large $n$ this probability drops with each move by a factor equal to the largest eigenvalue of the above matrix.