Note: We allow all four directions (up, down, right, left but no diagonal)
The 6 x 6 grid is composed of 7 horizontal lines and 7 vertical lines. We are to calculate how many 14 steps paths are possible where it never returns to the same intersecting point.
The answer given is
$$C(12, 8) \times C(8,7) \times (6/8) \times 2 = 5940$$
where $C(n,r)$ is here is the Binomial Coefficient.
I cannot seem to figure out how this counting was done. Can somebody provide me with the explanation regarding how this counting argument was done please? Any help is appreciated, thank you.
I don't know how that formula was obtained but here is another argument which gives the same result numerically. We generalise to finding paths of length $m+n+2$ on an $m\times n$ grid from $(0,0)$ to $(m,n)$.
It is not hard to see that the path must consist of one of the following mutually exclusive possibilities:
To count the first type we begin by arranging $m-2$ letters R and $n+2$ letters U: this can be done in $C(m+n,m-2)$ ways. Then we replace one of the letters U by RDR: this can be done for any of the $n+2$ letters U except the first or last, so there are $n$ options. A similar argument for the second case gives the total number of paths as $$n\binom{m+n}{m-2}+m\binom{m+n}{n-2}\ .$$ If $m=n$ this is $$2m\binom{2m}{m-2}\ ,$$ and in particular for the $6\times6$ grid it is $$12\binom{12}{4}=5940\ .$$