rec.puzzles Archive

A knight starts on square A1 of a chessboard and makes random moves (each legal move equally likely) until it is again on A1.

probability/knight.return New

New entry, edited from material collected for the archive and not yet in a released version.

Problem

A knight starts on square A1 of a chessboard and makes random moves
(each legal move equally likely) until it is again on A1.  What is the
expected number of moves?
Show solution
This is a standard type of problem (called "Return to origin",
or "First passage through ...") in the subject of Markov chains.
As this is a little too mathematically advanced for this newsgroup,
I will describe an elementary method of solving it, using nothing
more complicated than a system of linear equations. However,
a computer is needed to solve this large system of equations.

For every square S of the chess board, define an unknown w_S ( or w(S) ),
whose value is equal to the expected (or average) number of random moves
it would take for a knight starting on square S to reach square A1.

Then these 64 values w(S) satisfy the following 64 equations:
  If S = the square A1, then w(S) = 0
  For all other S, w(S) = 1 + (average value of w(T), taking the average
  over all squares T that are exactly 1 knight move from the square S)

( Example: w(C2) = 1 + ( w(A1)+w(A3)+w(B4)+w(D4)+w(E3)+w(E1) )/6 .
Note that each of these averages will involve either 2 or 3 or 4
or 6 or 8 other squares T.)

Simply [ :-) ] solve these 64 equations in 64 unknowns. There is some
mathematical reason (which I cannot recall - it has something to do with
a dominant diagonal) that tells you these equations will have a
unique solution. Then your answer is 1 + ( w(C2)+w(B3) )/2.

There is one obvious simplification: the problem is symmetric across
the A1-H8 diagonal. This implies that w(C2) = w(B3), and 27 other similar
relations. This idea reduces the problem to 36 equations in 36 unknowns,
and the final answer becomes 1 + w(C2).

This method of solving the problem allows easy generalizations:
change the starting square, or use another chess piece, or  ...  .

-- Barry Wolk <wolk@ccm.umanitoba.ca>

[ Editor: the posting gives no number.  A shortcut from Markov chain
  theory gives it without solving the system: for a random walk on a
  connected graph, the expected time to return to a vertex v is 2E/deg(v),
  where E is the number of edges.  The knight's graph on an 8x8 board has
  168 edges (each 2x3 or 3x2 block of squares holds 2 knight moves, and
  there are 6*7 + 7*6 = 84 such blocks), and A1 has degree 2, so the
  expected number of moves is 2*168/2 = 168. ]