3

Having worked on this very interesting question here, I wondered if there might be a general form for the number of paths for a lattice walk on diagonally overlapping square lattices from one end of the main diagonal to the other.

We define the following variables. Each square lattice has dimensions $n\times n$ single squares. There are $m$ square lattices, which overlap along a common diagonal. The overlapping area is a square lattice of $q\times q$ single squares, where $0\leq q<n$. We refer to this as an overlap of degree $q$. As an illustration, the diagram below shows the configuration for $n=5, m=4, q=2$.

$\hspace{4cm}$enter image description here

The preliminary conclusion is that, for the following cases, the solutions appear to have fairly neat closed forms.

(i) Overlap of $\bf0$ ($q=0$)

This is a trival case where the square lattices are joined at the tip with no overlapping squares. Number of paths is $$\binom {2n}n^m$$

(ii) Overlap of degree $\bf1$ ($q=1$)

This is the case described in the question referred to in the first paragraph. As shown in my solution, the general form for the number of paths is

$$2\binom {2n-1}{n-1}^m=2\binom{2n-1}n ^m$$

(iii) Overlap of degree $\bf {(n-1)}$ ($q=n-1$)

This is a one-square-apart zig-zag formation. The problem may be simplified by considering it as a truncated ${N}\times {N}$ lattice (where $N=n+m-1$) with truncation point at $\pm n$ from the centre of the diagonal. By applying the reflection principle, it can be shown that the general form for the number of paths is

$$\binom{2N}N-2\binom {2N}{m-2}+2\binom {2N}{m-n-3}-\cdots$$ where $\binom ab=0$ where $a<b$.

However, for other degrees of overlap, it appears that the solution may be rather unwieldy.

Question:
Is there is a general form for the number paths for any degree of overlap i.e. a formula for the number of paths as a function of $n,m,q$, and if so, is there a closed form for such a formula?

2 Answers2

2

Not quite a closed form, but this seems to give a reasonable formula.

You have a series of diagonal "bottlenecks" each with $q+1$ vertices; each path uses exactly one vertex from each bottleneck. Let $M=(m_{ij})$ denote the $(q+1)\times(q+1)$ matrix where $m_{ij}$ counts the paths from the $i$th vertex in one bottleneck to the $j$th vertex in the next. Since these vertices are opposite vertices of a $(n-q+i-j)\times(n-q+j-i)$ rectangle, we have $$m_{ij}=\binom{2(n-q)}{n-q+i-j}.$$

If there are $m\ge2$ chunks, there are $m-1$ bottlenecks. The product $M^{m-2}$ counts the paths from each vertex in the first bottleneck to each vertex in the last. To connect these bottlenecks up to the red dot points, we need to pre- and post- multiply by the vector of path counts connecting the start vertex to the first bottleneck, which is just the vector $v$ of binomial coefficients $$\binom{2n-q}{n-i}$$ for $i=0,\ldots,q$. So the final number of paths is just $$v M^{m-2} v^T.$$

In Mathematica:

M[n_,q_]:=Table[Binomial[2(n-q),n-q+i-j], {i,0,q},{j,0,q}];
f[n_,m_,q_]:=With[{v=Binomial[2n-q,n-#]& /@Range[0,q]}, 
v.MatrixPower[M[n,q],m-2].v]

For the example, we find $f(5,4,2)=22,036,472.$

The same method gives a formula if you have rectangles instead of squares, and can be used even if the overlap distances aren't constant as you go along.

Tad
  • 6,679
1

This is an extension of the very nice solution posted by @Tad. The objective is to show that for special cases, the results corresponds with those shown in the original question posted.

Let the number of paths be $P$. It has been shown that $$P=\mathbf{vM}^{m-2}\mathbf v^T=\left[\binom{2n-q}{n-i}\right]\left[\binom{2(n-q)}{n-q+i-j}\right]^{m-2}\left[\binom{2n-q}{n-i}\right]^T$$ where $i=0,1,\cdots q$.


For $\color{blue}{q=0}$, $$P=\binom {2n}n\binom {2n}n^{m-2}\binom{2n}n=\color{red}{\binom {2n}n^m}$$


For $\color{blue}{q=1}$, $$\begin{align} P&= \left[\binom{2n-1}{n-i}\right]\left[\binom{2n-2}{n-q+i-j}\right]^{m-2}\left[\binom{2n-1}{n-i}\right]^T\qquad (i=0,1) \\ &= \begin{array} &\left[\binom {2n-1}n\;\;\binom {2n-1}{n-1}\right]\\\hspace{1cm} \end{array} \left[\begin{array} & &\binom {2n-2}{n-1}&\binom {2n-2}n \\&\binom {2n-2}n&\binom {2n-2}{n-1} \end{array}\right]^{m-2} \left[\begin{array} &\binom {2n-1}{n}\\ \binom {2n-1}{n-1} \end{array}\right] \\ &= \begin{array} &\left[b\;\;\;b\right]\\\hspace{1cm} \end{array} \left[\begin{array} &a&c \\c&a \end{array}\right]^{m-2} \left[\begin{array} &b\\b \end{array}\right] \\ &\text{where }b=\binom {2n-1}n=\binom{2n-1}{n-1}, a=\binom {2n-2}{n-1}, c=\binom {2n-2}n\\ \text{Note that }a+c=b\\ \text{Note also that}\\ \mathbf{Mv}^T&=\left[\begin{array}&a&c \\c&a\end{array}\right] \left[\begin{array}&b\\b\end{array}\right]=b\left[\begin{array}&a+c \\c+a\end{array}\right]=b\left[\begin{array}&b\\b\end{array}\right]=b\mathbf v^T\\ \text{Hence }\qquad P=\mathbf{vM}^{m-2}\mathbf v^T&=\mathbf v(b^{m-2}\mathbf v^T)\\ &=b^{m-2}\mathbf{vv}^T\\ &=b^{m-2}(2b^2)\\ &=2b^m\\ &=\color{red}{2\binom {2n-1}n^m} \end{align}$$


For $\color{blue}{q=n-1}$, $$P=\left[\binom {n+1}{n-i}\right]\left[\binom 2{1+i-j}\right]^{m-2}\left[\binom {n+1}{n-i}\right]^T$$ Note that $$\mathbf M=\left[\binom 2{1+i-j}\right]= \begin{array} & && &i \\ && &0 &1 &2 &3 &4 &\cdots &(n-2) &(n-1)\\ \hline &&j &\color{orange}2 &\color{orange}1 &- &- &- &\cdots &- &-\\ &&1 &\color{orange}1 &\color{orange}2 &\color{orange}1 &- &- &\cdots &- &-\\ &&2 &- &1 &\color{orange}2 &\color{orange}1 &-&\cdots &- &-\\ &&3 &- &- &\color{orange}1 &\color{orange}2 &\color{orange}1&\cdots &- \\ &&\vdots\\ &&(n-2)&- &- &- &- &- &\cdots &\color{orange}2 &\color{orange}1\\ &&(n-1)&- &- &- &- &- &\cdots &\color{orange}1 &\color{orange}2\\ \end{array}$$ and that $$\sum_{r=0}^3 \binom 2r\binom {n+1}{n+k-r}=\binom {n+3}{n-k}$$ Hence, for $m=3$, $$\mathbf {Mv}^T=\left[\binom {n+1}{n+1-j}\right]^T-[1,0,0,\cdots,0,1]^T $$ and $$\begin{align}P=\mathbf {vMv}^T &=\left[\binom {n+1}{n-i}\right] \bigg\lbrace\color{blue}{\left[\binom {n+3}{n+1-j}\right]^T} \color{green}{-[1,0,0,\cdots,0,1]^T}\bigg\rbrace\\ &=\color{blue}{\binom {2n+4}{n+2}-\binom {n+1}1-\binom {n+1}n} - \color{green}{\binom {n+1}{n+1}\binom {n+3}{n+2}-\binom {n+1}0\binom {n+3}1}\\ &=\binom {2(n+2)}{n+2}-2\binom {2(n+2)}1 \end{align}$$ Similar, it can be shown that, for $m=4$, $$P=\mathbf{vM}^2\mathbf v^T=\binom {2(n+3)}{n+3}-2\binom {2(n+3)}2$$ It appears that, for any $m$ for $\color{blue}{q=n-1}$, $$\begin{align} P&=\binom {2N}N-2\binom {2N}{N-(n+1)}+2\binom {2N}{N-2(n+1)}+\cdots\\ &=\color{red}{\binom {2N}N-2\binom {2N}{m-2}+2\binom {2N}{m-n-3}-\cdots}\\ &=\color{red}{\binom {2N}N+2\sum_{r=0}^\infty (-1)^r\binom {2N}{N-r(n+1)}} \end{align}$$ where $N=n+m-1$ and $\binom ab=0$ for $a<b$. This can also be shown by using the reflection principle to count lattice paths on a Pascal triangle truncated on both sides.

If $N=\lambda (n+1)$ where $\lambda>1$ and $\lambda=\underbrace{\mu}_\text{integer part}+\underbrace{\delta}_\text{fractional part}$ then $P$ can be written as $$\color{red}{P=\sum_{r=0}^{2\mu}\binom {2N}{(\delta+r)(n+1)}(-1)^{r+\mu}}$$ If $\lambda$ is an integer, then $\mu=\lambda, \delta=0$, hence $$\color{red}{P=\sum_{r=0}^{2\lambda}\binom {2N}{r(n+1)}(-1)^{r+\lambda}}$$


For instance, if $n=3,m=6$, this gives $N=n+m-1=8$ hence $$\begin{align} P&=\binom {16}8-2\binom {16}4+2\binom {16}0&&[=9232]\\ &=\sum_{r=0}^4 \binom {16}{4r}(-1)^r\\ &=2\sum_{r=0}^2\binom {16}{8r}-\sum_{r=0}^4\binom {16}{4r}\\ &=2\cdot \frac 18\sum_{r=0}^7 \left(1+e^{i2\pi r/8}\right)^{16}-\frac 14\sum_{r=0}^3\left(1+e^{i2\pi r/4}\right)^{16}\\ &=\frac 14\sum_{r=0}^7 \left[2\left(\cos\frac {\pi r}8\right) e^{i2\pi r/8}\right]^{16}-\frac 14\sum_{r=0}^3 \left[2\left(\cos\frac {\pi r}4\right) e^{i2\pi r/4}\right]^{16}\\ &=\frac {2^{16}}4\sum_{r=0}^7 \left(\cos\frac {\pi r}8\right)^{16} -\frac {2^{16}}4\sum_{r=0}^3 \left(\cos\frac {\pi r}4\right)^{16}\\ &=\frac {2^{16}}4\left[\sum_{r=0}^7 \left(\cos\frac {\pi r}8\right)^{16}-\sum_{r=0,2,4,6} \left(\cos\frac {\pi r}8\right)^{16}\right]\\ &=2^{14}\sum_{r=1,3,5,7} \left(\cos\frac {\pi r}8\right)^{16}\\ &=2^{14}\sum_{r=1,3} 2\left(\cos\frac {\pi r}8\right)^{16} &&\left(\cos^2 \left(\frac\pi 8\right)=\frac {2+\sqrt 2}4\right)\\ &=2^{14}\cdot 4\cdot \frac {577}{4096}\\ &=2^4\cdot 577\\ &=9232 \end{align}$$

  • Very nice completion. I had worked out $q=0,1$ but did not have the energy to make progress on $q=n-1$. The pattern strongly suggests an inclusion/exclusion argument. – Tad Nov 25 '16 at 12:50
  • @Tad - Thanks, very kind of you to say so. There must be a more elegant way to derive the general form for the case where $q=n-1$. – Hypergeometricx Nov 25 '16 at 15:43
  • @Tad - Have just added a more compact summation form for the case where $q=n-1$. – Hypergeometricx Nov 25 '16 at 16:49