Parity considerations give a very clean solution, using surprisingly simple machinery: no Markov chains, no iterated expectations, and only high school level summations. The basic idea is that if the spider has moved an even number of times in the x direction, it has returned to its original x coordinate so can't be at the ant's position. If it has moved an odd number of times in the x direction, then its x coordinate matches the ant's. Only if it has moved an odd number of times in all three directions will it match the x, y and z coordinates of the ant.
Initially the spider has made zero moves in any of the three directions, so the parity for each direction is even. All three parities need to be flipped to reach the ant.
After the spider's first move (let's label that direction x), exactly one direction has odd parity and the other two (y and z) are even. To catch the ant, only those two parities need to be reversed. Since that can't be achieved in an odd number of subsequent moves, from now on we consider pairs of moves. There are nine possible combinations for the first paired move:
(x,x),(x,y),(x,z),(y,x),(y,y),(y,z),(z,x),(z,y),or(z,z)
We need to move in the y and z directions to reach the ant after one paired move, and two out of nine combinations will achieve this: (y,z) and (z,y) would ensure all three parities are odd.
The other seven combinations leave one odd and two even parities. The three repeated moves, (x,x), (y,y) or (z,z), leave all parities unchanged so we still require one y and one z movement to reach the ant. The other pairs contain two distinct moves, including one in the x direction. This switches the parity of x and one of the other parities (either y or z) so we are still left with one odd and two even parities. For instance the pair (x,z) leaves us needing one more x and one more y to reach the ant: an equivalent situation (after relabelling of axes) to where we were before. We can then analyse the next paired move in the same way.
In general paired moves start with one odd and two even parities, and will either end with three odd parities (with probability 29) and the immediate capture of the ant, or with one odd and two even parities (with probability 79) which returns us to the same situation.
Let M be the number of paired moves required to reach the ant. Clearly M follows the geometric distribution on the support {1,2,3,…} with probability of success p=29 so has mean E(M)=p−1=92=4.5. Let N be the total number of moves required, including the initial move and the M subsequent paired moves. Then N=2M+1 so, applying linearity of expectations, E(N)=2E(M)+1=2×4.5+1=10.
Alternatively you might note P(M≥m)=(79)m−1 and apply the well-known formula for the mean of a discrete distribution taking only non-negative integer values, E(M)=∑∞m=1P(M≥m). This gives E(M)=∑∞m=1(79)m−1 which is a geometric series with first term a=1 and common ratio r=79 so has sum a1−r=11−7/9=12/9=92. We can then take E(N) as before.
Comparison to Markov chain solutions
How might I have spotted this from the Markov chain transition matrix? Using @DLDahly's notation, the states in the transition matrix correspond to my description of the number of the number of directions with odd parity.
The one-step transition matrix is
P=⎡⎣⎢⎢⎢PS→SPA→SPB→SPE→SPS→APA→APB→APE→APS→BPA→BPB→BPE→BPS→EPA→EPB→EPE→E⎤⎦⎥⎥⎥=⎡⎣⎢⎢⎢⎢01/300102/3002/300001/31⎤⎦⎥⎥⎥⎥
The first row show us that after one movement, the spider is guaranteed to be in state A (one odd and two even parities). The two-step transition matrix is:
P(2)=P2=⎡⎣⎢⎢⎢⎢1/302/9007/9002/304/9002/91/31⎤⎦⎥⎥⎥⎥
The second row shows us that once the spider has entered state A, in two moves time it has either returned to state A with probability 7/9 or has reached state E (all odd parities) and captured the ant, with probabilty 2/9. So having reached state A, we see from the two-step transition matrix that the number of two-step moves required can be analysed using the geometric distribution as above. This isn't how I found my solution, but it is sometimes worth calculating the first few powers of the transition matrix to see if a useful pattern like this can be exploited. I have occasionally found this to give simpler solutions than having to invert a matrix or perform an eigendecomposition by hand - admittedly something that is only really relevant in an exam or interview situation.