TITLE: Number of Dyck Paths that touch the diagonal exactly $k$ times?
QUESTION [8 upvotes]: What is the number of Dyck Ppaths from $(0,0)$ to $(n,n)$ which touch the diagonal exactly $k$ times?
The only permissible moves are  from $(x,y)$ to $(x+1,y)$ or $(x,y+1)$.

I know that when there is no restriction on the number of times we are allowed to touch the diagonal, the result is the $n^{th}$ Catalan Number.
If we touch the diagonal after $2*i_1, 2*i_2, \dots, 2*i_k$ moves respectively such that $2 \sum_{j=1}^{k} i_j = 2n$ then the result seems to be the Catalan $k$-fold convolution formula as given here.
This link claims that we can derive this formula in a simpler way by showing a bijection to paths related to the Catalan Triangle but the explanation seems to be rather unclear.
Any help or pointers in literature or hints?

REPLY [2 votes]: The number of lattice paths, going from $(0,0)$ to $(n,n)$, with steps in ${(1,0),(0,1)}$,
and remaining below or touching the diagonal is counted, as you said, by the Catalan Number
$$
C(n) = \left( \begin{gathered}
  2n \\ 
  n \\ 
\end{gathered}  \right) - \left( \begin{gathered}
  2n \\ 
  n + 1 \\ 
\end{gathered}  \right) = \left( \begin{gathered}
  2n \\ 
  n \\ 
\end{gathered}  \right) - \left( \begin{gathered}
  2n \\ 
  n - 1 \\ 
\end{gathered}  \right) = \frac{1}
{{n + 1}}\left( \begin{gathered}
  2n \\ 
  n \\ 
\end{gathered}  \right)
$$

Then, as shown in the sketch, the number of paths that remain below the diagonal
without touching it, except at the extremes, is given by
$$
N(n,1) = C(n - 1) = \left( \begin{gathered}
  2n - 2 \\ 
  n - 1 \\ 
\end{gathered}  \right) - \left( \begin{gathered}
  2n - 2 \\ 
  n - 2 \\ 
\end{gathered}  \right) = \frac{{\left[ {1 \leqslant n} \right]}}
{n}\left( \begin{gathered}
  2n - 2 \\ 
  n - 1 \\ 
\end{gathered}  \right)
$$
where the square brackets indicates the Iverson bracket.
Here the number of touches is counted as $1$, corresponding to the number of distinct contact points minus one.
So
$$
N(n,0) = \left[ {0 = n} \right]
$$
Clearly the number of paths below the diagonal, with exactly 1 touch in between,
will be the convolution of two "no-intermediate-touch" paths ($m=1$)
$$
N(n,2) = \sum\limits_{0\, \leqslant \,k\, \leqslant \,n} {N(k,1)N(n - k,1)}  = \sum\limits_{1\, \leqslant \,k\, \leqslant \,n - 1} {\frac{1}
{{k\left( {n - k} \right)}}\left( \begin{gathered}
  2k - 2 \\ 
  k - 1 \\ 
\end{gathered}  \right)\left( \begin{gathered}
  2n - 2k - 2 \\ 
  n - k - 1 \\ 
\end{gathered}  \right)} 
$$
and so on
$$
N(n,m) = \sum\limits_{0\, \leqslant \,k\, \leqslant \,n} {N(k,m - 1)N(n - k,1)} 
$$
Computing the convolutions as above you obtain for $N(n,m)$ the matrix
that corresponds to OEIS sequence A106566 (see also A033184 and A009766 ), whose row sums $=C(n)$ and which corresponds to the final formula given by Brian.