j}{a-(c+1)j+b-1\choose b-1}.\end{split}$

if $a>0$: $1$ if $a=0$: and $0$ otherwise (See, e.g. Charalambides, (2002)).

###  6.2 Closed expression for the PMF of $\left(L_{n}^{(1)}\leq k\right)$

We now make some useful Definition and Lemma for the proofs of Theorem in the
sequel.

######  Definition 6.2.

For $0<q\leq 1$, we define

$\begin{split}V_{q}(r,s,k)={\sum_{x_{1},\ldots,x_{r}}}q^{x_{2}+2x_{3}+\cdots+(r-1)x_{r}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{r}$ satisfying

$\begin{split}0\leq x_{j}\leq k\quad\text{for}\quad j=1,\ldots,r,\
\text{and}\end{split}$ $\begin{split}x_{1}+\cdots+x_{r}=s\end{split}$

The following gives a recurrence relation useful for the computation of
$V_{q}(r,s,k)$.

######  Lemma 6.2.

For $0<q\leq 1$, $V_{q}(r,s,k)$ obeys the following recurrence relation.

$\begin{split}V_{q}&{}^{k}(r,s,k)=\left\\{\begin{array}[]{ll}\sum_{a=0}^{k}q^{a(r-1)}V_{q}(r-1,s-a,k)&\text{for}\
r>1,\ \text{and}\ 0\leq s\leq kr\\\ 1&\text{for}\ r=1,\ \text{and}\ 0\leq
s\leq k,\ \text{or}\\\ 0&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $r>1$ and $0\leq s\leq kr$, we observe that since $x_{r}$ can assume the
values $1,\ldots,k$, then $V_{q}(r,s,k)$ can be written as follows.

$\begin{split}V_{q}(r,s,k)=&\sum_{x_{r}=0}^{k}\ q^{x_{r}(r-1)}{\hskip
14.22636pt\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=m-x_{s}\\\
x_{1},\ldots,x_{r-1}\in\\{0,1,\ldots,k\\}\end{subarray}}}\quad
q^{x_{2}+2x_{3}+\cdots+(r-2)x_{r-1}}\end{split}$

Using simple algebraic arguments to simplify, then $V_{q}(r,s,k)$ can be
rewritten as follows.

$\begin{split}V_{q}&(r,s,k)=\sum_{a=0}^{k}q^{a(r-1)}V_{q}(r-1,s-a,k).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 32.

We observe that $V_{1}(r,s,k)$ is the number of integer solutions $(x_{1},\
\ldots,\ x_{r})$ of

$\begin{split}0\leq x_{j}\leq k\quad\text{for}\quad j=1,\ldots,r,\
\text{and}\end{split}$ $\begin{split}x_{1}+\cdots+x_{r}=s\end{split}$

which is

$\begin{split}V_{1}(r,s,k)=C(s,\ r,\ k),\end{split}$

where $C(a,\ b,\ c)$ denotes the total number of integer solutions
$x_{1}+x_{2}+\cdots+x_{b}=a$ such that $0\leq x_{i}\leq c$ for
$i=1,2,\ldots,b$. Alternatively, it is the number of ways of distributing $a$
identical balls into $b$ different cells , so that each cell is occupied by at
most $c$ balls. The number can be expressed as

$\begin{split}C(a,\ b,\ c)=\sum_{j=0}^{b}(-1)^{j}{b\choose
j}{a-(c+1)j+b-1\choose b-1}.\end{split}$

if $a>0$: $1$ if $a=0$: and $0$ otherwise (See, e.g. Charalambides, (2002).

We shall study of the cumulative distribution function
$P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ of the length $L_{n}^{(1)}$ of
the longest success run. The probability function of the
$P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ is obtained by the following
theorem.

######  Theorem 6.2.

The PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ is given by

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k\Big{)}=&\sum_{y=[n/(k+1)]}^{n-k}\theta^{n-y}\ {\prod_{j=1}^{y}}\
\left(1-\theta q^{j-1}\right)\ V_{q}(y+1,\ n-y,\ k).\end{split}$

###### Proof.

We partition the event $\left\\{L_{n}^{(1)}=k\right\\}$ into disjoint events
given by $F_{n}=y,$ for $y=[n/(k+1)],\ldots,n-k$. Adding the probabilities we
have

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}=k\Big{)}=\sum_{y=[n/(k+1)]}^{n-k}P_{q,\theta}\Big{(}L_{n}^{(1)}=k\
\wedge\ F_{n}=y\Big{)}.\\\ \end{split}$

We are going to focus on the event $\left\\{L_{n}^{(1)}\leq k\ \wedge\
F_{n}=y\right\\}$. A typical element of the event $\Big{\\{}L_{n}^{(1)}\leq k\
\wedge\ F_{n}=y\Big{\\}}$ is an ordered sequence which consists of $n-y$
successes and $y$ failures such that the length of the longest success run is
less and equal to $k$. The number of these sequences can be derived as
follows. First we will distribute the $y$ failures which form $y+1$ cells.
Next, we will distribute the $n-y$ successes in the $y+1$ distinguishable
cells, so that each cell occupied by at most $k$ successes balls. Thus, the
event $\left\\{L_{n}^{(1)}\leq k\ \wedge\ F_{n}=y\right\\}$ is defined as
follows.

$\begin{split}\underbrace{1\ldots 1}_{0\leq x_{1}\leq k}0\underbrace{1\ldots
1}_{0\leq x_{2}\leq k}0\underbrace{1\ldots 1}_{0\leq x_{3}\leq k}0\ldots
0\underbrace{1\ldots 1}_{0\leq x_{y}\leq k}0\underbrace{1\ldots 1}_{0\leq
x_{y+1}\leq k},\\\ \end{split}$

with $y$ $0$’s and $n-y$ $1$’s, where $x_{j}$ $(j=1,\ldots,y+1$ represents a
length of run of $1$’s . And all integers $x_{1},\ldots,x_{s}$ satisfy the
conditions

$\begin{split}0\leq x_{j}\leq k\mbox{\ for\ }j=1,...,y+1,\ \mbox{\ and}\
x_{1}+\cdots+x_{y+1}=n-y,\end{split}$

Then the probability of the event $\left\\{L_{n}^{(1)}\leq k\ \wedge\
F_{n}=y\right\\}$ is given by

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\ \wedge\ F_{n}=y\Big{)}&\\\
=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{y+1}=n-y\\\
x_{1},\ldots,x_{y+1}\in\\{1,\ldots,k\\}\end{subarray}}&\Big{(}\theta
q^{0}\Big{)}^{x_{1}}\Big{(}1-\theta q^{0}\Big{)}\Big{(}\theta
q^{1}\Big{)}^{x_{2}}\Big{(}1-\theta q^{1}\Big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\ &\Big{(}1-\theta
q^{y-2}\Big{)}\Big{(}\theta q^{y-1}\Big{)}^{x_{y}}\Big{(}1-\theta
q^{y-1}\Big{)}\Big{(}\theta q^{y}\Big{)}^{x_{y+1}}.\\\ \end{split}$

Using simple exponentiation algebra arguments to simplify,

$\begin{split}P_{q,\theta}\Big{(}&L_{n}^{(1)}\leq k\ \wedge\
F_{n}=y\Big{)}=\\\ &\theta^{n-y}\ {\prod_{j=1}^{y}}\ \left(1-\theta
q^{j-1}\right)\ \sum_{\begin{subarray}{c}x_{1}+\cdots+x_{y+1}=n-y\\\
x_{1},\ldots,x_{y+1}\in\\{0,1,\ldots,k\\}\end{subarray}}q^{x_{2}+2y_{3}\cdots+(y-1)x_{y}+yx_{y+1}}.\\\
\end{split}$

Using Lemma 6.2, we can rewrite as follows.

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\ \wedge\
F_{n}=y\Big{)}=\theta^{n-y}\ \left(1-\theta q^{j-1}\right)\ V_{q}(y+1,\ n-y,\
k),\\\ \end{split}$

where

$\begin{split}V_{q}(y+1,\ n-y,\
k)=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{y+1}=n-y\\\
x_{1},\ldots,x_{y+1}\in\\{0,1,\ldots,k\\}\end{subarray}}q^{x_{2}+2y_{3}\cdots+(y-1)x_{y}+yx_{y+1}}.\end{split}$

Therefore we can compute the probability of the event $\left\\{L_{n}^{(1)}\leq
k\right\\}$ as follows.

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k\Big{)}=&\sum_{y=[n/(k+1)]}^{n}\theta^{n-y}\ {\prod_{j=1}^{y}}\
\left(1-\theta q^{j-1}\right)\ V_{q}(y+1,\ n-y,\ k).\\\ \end{split}$

Thus proof is completed. ∎

It is worth mentioning here that the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k\Big{)}$ approaches the probability function of
$P_{\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ in the limit as $q$ tends to 1 of
IID model. The details are presented in the following remark.

######  Remark 33.

For $q=1$, the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ reduces to
the PMF $P_{\theta}\Big{(}L_{n}^{(1)}\leq k\Big{)}$ is given by

$\begin{split}P_{\theta}\Big{(}L_{n}^{(1)}\leq
k\Big{)}=&\sum_{y=[n/(k+1)]}^{n}\theta^{n-y}(1-\theta)^{y}\ V_{1}(y+1,\ n-y,\
k)\\\ =&\sum_{y=[n/(k+1)]}^{n}\theta^{n-y}(1-\theta)^{y}\ C(n-y,\ y+1,\
k),\end{split}$

where

$\begin{split}C(a,\ b,\ c)=\sum_{j=0}^{b}(-1)^{j}{b\choose
j}{a-(c+1)j+b-1\choose b-1}.\end{split}$

if $a>0$: $1$ if $a=0$: and $0$ otherwise (See, e.g. Charalambides, (2002)).

##  7 Joint distribution of the longest success and failure runs for
$q$-binary trials

In this section, we study the joint distribution of the lengths of the longest
success and longest failure runs. Let $\\{X_{i}\\}_{i\geq 1}$ be an arbitrary
sequence of $n$ binary (zero and one) trials ordered on a line, with
probability of ones varying according to a geometric rule. We consider that an
ordered sequence of $n$ trials which consist of $n_{1}$ of the total number of
successes and $n_{2}$ of the total number of failures, where $n_{1}+n_{2}=n$.
We consider these $n$ trials how they are arranged to form a random sequence
and we shall discuss various aspects of the representation of successes and
failures trials which arise. We will distribute the $n_{1}$ successes and the
$n_{2}$ failures. We first consider the failure runs. Let $s$$(1\leq s\leq
n_{2})$ be the number of runs of failures and then $n_{1}$ failures can be
arranged to form $s$ runs. It is true that whenever there are $s$ runs of
failures there are three alternatives for the successes :

  * •

there are $s-1$ runs of successes and the series can begin only with a run of
failures (B-type);

  * •

there are $s$ runs of failures and the series can begin with a run of
successes or a run of failures (D and A-type, respectively) and

  * •

there are $s+1$ runs of successes and the series can begin only with a run of
successes (C-type).

Thus sequence $X_{1}$, $\ldots$,$X_{n}$ has one of the following four forms:

$\begin{split}\text{A-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s}},\\\ \text{B-type}\
:&\quad\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s-1}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \text{C-type}\
:&\quad\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s}}\mid\overbrace{1\ldots
1}^{x_{s+1}},\\\ \text{D-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s-1}}\mid\overbrace{1\ldots 1}^{x_{s}}\mid\overbrace{0\ldots
0}^{y_{s}},\\\ \end{split}$

It is noteworthy that the representations of A to D-type are based on the
arguments given in the proof of Theorem 3.2.1 of Gibbons and Chakraborti,
(2020). It is of interest to note that, for the first and fourth forms total
number of success and failure runs are both equal and we have $(s-1)$ and
$(s+1)$ success runs for the second and third forms, respectively. Here, we
derive the joint distribution of the lengths of the longest success and
longest failure runs. More specifically, we derive the joint distributions for
$P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$, $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}$, $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\Big{)}$ and $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq
k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\Big{)}$.

###  7.1 Closed expression for the PMF of $\left(L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\right)$

We shall study of the joint distribution of $\left(L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\right)$. The probability function of the
$P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$ is obtained by the following theorem.

######  Theorem 7.1.

The PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$ for $n\geq 1$

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}=&\sum_{i=1}^{n}\theta^{n-i}\ {\prod_{j=1}^{i}}\
(1-\theta q^{j-1})\sum_{s=1}^{i}\Big{[}D_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)\\\
&+A_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)+C_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\
s+1)\\\ &+B_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\
s)\Big{]}+\eta(n,k_{1})\theta^{n},\end{split}$

where $\eta(n,k_{1})$ is the function by $\eta(n,k_{1})=1$ if $n\leq k_{1}$
and $0$ otherwise.

###### Proof.

We partition the event $\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\right\\}$ into disjoint events given by $F_{n}=i,$ for $i=1,\ldots,n$.
Adding the probabilities we have

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}=\sum_{i=1}^{n}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\ \wedge\ F_{n}=i\Big{)}.\\\ \end{split}$

We will write $E_{n,i}=\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\ \wedge\ F_{n}=i\right\\}$. We can now rewrite as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\leq
k_{2}\Big{)}=\sum_{i=1}^{n}P_{q,\theta}\left(E_{n,i}\right).\end{split}$

We are going to focus on the event $E_{n,\ i}$. A typical element of the event
$\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\right\\}$ is an
ordered sequence which consists of $n-i$ successes and $i$ failures such that
the length of the longest success run is less than or equal to $k_{1}$. The
number of these sequences can be derived as follows. First we will distribute
the $i$ failures and the $n-i$ successes. Let $s$ $(1\leq s\leq i)$ be the
number of runs of failures in the event $E_{n,\ i}$. We divide into two cases:
starting with a success run or starting with a failure run. Thus, we
distinguish between four types of sequences in the event
$\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\right\\}$,
respectively named A, B, C and D-type, which are defined as follows.

$\begin{split}\text{A-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s,\mbox{\ and\
}x_{1}+\cdots+x_{s}=n-i,\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{B-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s-1}}\mid\overbrace{1\ldots 1}^{x_{s-1}}\mid\overbrace{0\ldots
0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s-1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s-1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s-1,\mbox{\ and\
}x_{1}+\cdots+x_{s-1}=n-i,\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\
for\ }j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{C-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s+1}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s+1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s+1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s+1,\mbox{\ and\
}x_{1}+\cdots+x_{s+1}=n-i,\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\
for\ }j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{D-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{3}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s,\mbox{\ and\
}x_{1}+\cdots+x_{s}=n-i,\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

Then the probability of the event $E_{n,\ i}$ is given by

$\begin{split}P_{q,\theta}\Big{(}E_{n,\ i}\Big{)}&\\\
=\sum_{s=1}^{i}\Bigg{[}\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\times\\\ &\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\times\\\ &\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}+y_{3}}\Big{)}^{x_{3}}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\big{(}1-\theta q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\Big{(}\theta
q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s}}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\big{(}1-\theta q^{y_{1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s-1}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\quad\quad\quad\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\
x_{1},\ldots,x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\ &\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s+1}}\bigg{\\}}+\\\
\end{split}$

$\begin{split}\quad\quad\quad\quad\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}\Bigg{]}.\\\ \end{split}$

Using simple exponentiation algebra arguments to simplify,

$\begin{split}&P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\\\
&\theta^{n-i}{\prod_{j=1}^{i}}\ \left(1-\theta q^{j-1}\right)\times\\\
&\sum_{s=1}^{i}\Bigg{[}\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}}+\\\
\end{split}$

$\begin{split}&\quad\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}+\\\
&\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\
x_{1},\ldots,x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}}+\\\
&\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}\Bigg{]}.\\\
\end{split}$

Using Lemma 3.1, Lemma 3.2, Lemma 3.3 and Lemma 3.4, we can rewrite as
follows.

$\begin{split}P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})&\sum_{s=1}^{i}\Big{[}D_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\
s)+A_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)\\\ &+C_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\
s+1)+B_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)\Big{]},\\\ \end{split}$

where

$\begin{split}D_{q}^{k_{1}+1,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\ \hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\end{split}$
$\begin{split}A_{q}^{k_{1}+1,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\end{split}$
$\begin{split}C_{q}^{k_{1}+1,k_{2}+1}(n&-i,\ i,\ s+1)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\
x_{1},\ldots,x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\ \hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}},\end{split}$

and

$\begin{split}B_{q}^{k_{1}+1,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\ \hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}.\end{split}$

Therefore we can compute the probability of the event $\left\\{L_{n}^{(1)}\leq
k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\right\\}$ as follows.

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}=&\sum_{i=1}^{n}\theta^{n-i}\ {\prod_{j=1}^{i}}\
(1-\theta q^{j-1})\sum_{s=1}^{i}\Big{[}D_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)\\\
&+A_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)+C_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\
s+1)\\\ &+B_{q}^{k_{1}+1,k_{2}+1}(n-i,\ i,\ s)\Big{]}.\\\ \end{split}$

Thus proof is completed. ∎

It is worth mentioning here that the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\Big{)}$ approaches the probability
function of $P_{\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$ in the limit as $q$ tends to 1 of IID model. The details are
presented in the following remark.

######  Remark 34.

For $q=1$, the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}$ reduces to the PMF
$P_{\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\Big{)}$
for $n\geq 1$ is given by

$\begin{split}P_{\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}=&\sum_{i=1}^{n}\theta^{n-i}(1-\theta)^{i}\sum_{s=1}^{i}\Big{[}S(s,\
k_{1}+1,\ n-i)\\\ &+S(s,\ k_{1}+1,\ n-i)+S(s+1,\ k_{1}+1,\ n-i)\\\ &+S(s,\
k_{1}+1,\ n-i)\Big{]}S(s,\ k_{2}+1,\ i)+\eta(n,k_{1})\theta^{n},\\\
\end{split}$

where $\ S(a,\ b,\
c)=\sum_{j=0}^{min(a,\left[\frac{c-a}{b-1}\right])}(-1)^{j}{a\choose
j}{c-j(b-1)-1\choose a-1}$, and $\eta(n,k_{1})$ is the function by
$\eta(n,k_{1})=1$ if $n\leq k_{1}$ and $0$ otherwise.

###  7.2 Closed expression for the PMF of $\left(L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\right)$

We shall study of the joint distribution of $\left(L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\right)$. We now make some useful Definition and
Lemma for the proofs of Theorem in the sequel.

######  Definition 7.1.

For $0<q\leq 1$, we define

$\begin{split}\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,a}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)$.

######  Lemma 7.1.

$\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)$ obeys the following recurrence
relation.

$\begin{split}&\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{v-(s-1)}\sum_{a=1}^{k_{1}-1}q^{va}\overline{M}_{q,0,0}^{k_{1},\infty}(u-a,v-b,s-1),&\text{for}\
s>1,\ s\leq u\leq s(k_{1}-1)\\\ &\text{and}\ s\leq v\\\ 1,&\text{for}\ s=1,\
1\leq u\leq k_{1}-1,\ \text{and}\ 1\leq v\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq u\leq s(k_{1}-1)$ and $s\leq v$, we observe that $x_{s}$ may
assume any value $1,\ldots,k_{1}-1$, then
$\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)$ can be written as

$\begin{split}\overline{M}&{}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}{\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{u-x_{s},s-1}^{0}\end{subarray}}}\
{\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{v,s}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,v-(s-1)$, then $\overline{M}_{q,0,0}^{k_{1},\infty}(u,v,s)$ can be
rewritten as

$\begin{split}\overline{M}&{}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
=&\sum_{y_{s}=1}^{v-(s-1)}\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{v,s}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
=&\sum_{b=1}^{v-(s-1)}\sum_{a=1}^{k_{1}-1}q^{va}\overline{M}_{q,0,0}^{k_{1},\infty}(u-a,v-b,s-1)\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 35.

We observe that $\overline{M}_{1,0,0}^{k_{1},\infty}(u,v,s)$ is the number of
integer solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

which is

$\begin{split}\overline{M}_{1,0,0}^{k_{1},\infty}(u,v,s)=S(s,\ k_{1},\ u)M(s,\
v),\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solutions
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number can be expressed as

$\begin{split}S(a,\ b,\
c)=\sum_{j=0}^{min(a,\left[\frac{c-a}{b-1}\right])}(-1)^{j}{a\choose
j}{c-j(b-1)-1\choose a-1}.\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+y_{2}+\cdots+y_{a}=b$ such that $(y_{1},\ldots,y_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.2.

For $0<q\leq 1$, we define

$\begin{split}M_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$M_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$.

######  Lemma 7.2.

$M_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}M&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}M_{q,0,k_{2}}^{k_{1},\infty}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{M}_{q}(m-a,r-b,s-1),&\text{for}\
s>1,\ s\leq m\leq s(k_{1}-1)\\\ &\text{and}\ (s-1)+k_{2}\leq r\\\
1,&\text{for}\ s=1,\ 1\leq m\leq k_{1}-1,\ \text{and}\ k_{2}\leq r\\\
0,&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq m\leq s(k_{1}-1)$ and $(s-1)+k_{2}\leq r$, we observe that
$x_{s}$ may assume any value $1,\ldots,k_{1}-1$, then
$M_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ can be written as

$\begin{split}M&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,r-(s-1)$, then $M_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ can be
rewritten as

$\begin{split}M&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}M_{q,0,k_{2}}^{k_{1},\infty}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{M}_{q,0,0}^{k_{1},\infty}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 36.

We observe that $M_{1,0,k_{2}}^{k_{1},\infty}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{r,s}^{k_{2}-1}.\end{split}$

given by

$\begin{split}M_{1,0,k_{2}}^{k_{1},\infty}(m,r,s)=S(s,\ k_{1},\ m)R(s,\
k_{2},\ r),\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.3.

For $0<q\leq 1$, we define

$\begin{split}\overline{N}_{q,0,0}^{k_{1},\infty}(u,v,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s-1}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s-1}$ satisfying

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{v,s-1}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{N}_{q,0,0}^{k_{1},\infty}(u,v,s)$.

######  Lemma 7.3.

$\overline{N}_{q,0,0}^{k_{1},\infty}(u,v,s)$ obeys the following recurrence
relation.

$\begin{split}\overline{N}&{}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{v-(s-2)}\sum_{a=1}^{k_{1}-1}q^{va}\overline{N}_{q,0,0}^{k_{1},\infty}(u-a,v-b,s-1),&\text{for}\
s>1,\ s\leq u\leq s(k_{1}-1)\\\ &\text{and}\ s-1\leq v\\\ 1,&\text{for}\ s=1,\
1\leq u\leq k_{1}-1,\ \text{and}\ v=0\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq u\leq s(k_{1}-1)$ and $s-1\leq v$, we observe that $x_{s}$
may assume any value $1,\ldots,k_{1}-1$, then
$\overline{N}_{q,0,0}^{k_{1},\infty}(u,v,s)$ can be written as

$\begin{split}\overline{N}&{}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{v,s-1}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s-1}$ can assume the values
$1,\ldots,v-(s-2)$, then $\overline{N}_{q,0,0}^{k_{1},\infty}(u,v,s)$ can be
rewritten as

$\begin{split}\overline{N}&{}_{q,0,0}^{k_{1},\infty}(u,v,s)\\\
=&\sum_{y_{s-1}=1}^{v-(s-2)}\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-2})\in
S_{v-y_{s-1},s-2}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{b=1}^{v-(s-2)}\sum_{a=1}^{k_{1}-1}q^{va}\overline{N}_{q,0,0}^{k_{1},\infty}(u-a,v-b,s-1)\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 37.

We observe that $\overline{N}_{1,0,0}^{k_{1},\infty}(u,v,s)$ corresponds to
the number of integer solutions $(x_{1},\ldots,x_{s})$ and
$(y_{1},\ldots,y_{s-1})$ satisfying

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{v,s-1}^{0}\end{split}$

given by

$\begin{split}\overline{N}_{1,0,0}^{k_{1},\infty}(u,v,s)=S(s,\ k_{1},\
u)M(s-1,\ v)\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solutions
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number can be expressed as

$\begin{split}S(a,\ b,\
c)=\sum_{j=0}^{min(a,\left[\frac{c-a}{b-1}\right])}(-1)^{j}{a\choose
j}{c-j(b-1)-1\choose a-1}.\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+y_{2}+\cdots+y_{a}=b$ such that $(y_{1},\ldots,y_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.4.

For $0<q\leq 1$, we define

$\begin{split}N_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s-1}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s-1}$ satisfying

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{r,s-1}^{k_{2}-1}\end{split}$

The following gives a recurrence relation useful for the computation of
$N_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$.

######  Lemma 7.4.

$N_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}N&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}N_{q,0,k_{2}}^{k_{1},\infty}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{N}_{q,0,0}^{k_{1},\infty}(m-a,r-b,s-1),&\text{for}\
s>1,\ s\leq m\leq s(k_{1}-1)\\\ &\text{and}\ (s-2)+k_{2}\leq r\\\
0,&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq m\leq s(k_{1}-1)$ and $(s-2)+k_{2}\leq r$, we observe that
$x_{s}$ may assume any value $1,\ldots,k_{1}-1$, then
$N_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ can be written as

$\begin{split}N&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r,s-1}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s-1}$ can assume the values
$1,\ldots,r-(s-2)$, then $N_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)$ can be
rewritten as

$\begin{split}N&{}_{q,0,k_{2}}^{k_{1},\infty}(m,r,s)\\\
=&\sum_{y_{s-1}=1}^{k_{2}-1}\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{k_{2}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-2})\in
S_{r-y_{s-1},s-2}^{0}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s-1}=k_{2}}^{r-(s-2)}\sum_{x_{s}=k_{1}}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}-1\\}\\\
(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ \ldots,\ y_{s-2})\in
S_{r-y_{s-1},s-2}^{0}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}N_{q,0,k_{2}}^{k_{1},\infty}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{N}_{q,0,0}^{k_{1},\infty}(m-a,r-b,s-1,k_{1},k_{2}).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 38.

We observe that $N_{1,0,k_{2}}^{k_{1},\infty}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s-1})$ of

$\begin{split}0<x_{j}<k_{1}\mbox{\ for\ }j=1,...,s,\end{split}$
$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{r,s-1}^{k_{2}-1}\end{split}$

given by

$\begin{split}N_{1,0,k_{2}}^{k_{1},\infty}(m,r,s)=S(s,\ k_{1},\ m)R(s-1,\
k_{2},\ r)\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

The probability function of the $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\Big{)}$ is obtained by the following theorem.

######  Theorem 7.2.

The PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\Big{)}$ for $n\geq k_{2}$

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}=&\sum_{i=k_{2}}^{n}\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i-k_{2}+1}\Big{[}M_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s)\\\ &+E_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s)+N_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s+1)\\\
&+F_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s)\Big{]}.\\\ \end{split}$

###### Proof.

We partition the event $\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\right\\}$ into disjoint events given by $F_{n}=i,$ for
$i=k_{2},\ldots,n$. Adding the probabilities we have

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}=\sum_{i=k_{2}}^{n}P\Big{(}L_{n}^{(1)}\leq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\ \wedge\ F_{n}=i\Big{)}.\\\ \end{split}$

We will write $E_{n,i}=\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\ \wedge\ F_{n}=i\right\\}$. We can now rewrite as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq
k_{2}\Big{)}=\sum_{i=k_{2}}^{n}P_{q,\theta}\left(E_{n,i}\right).\end{split}$

We are going to focus on the event $E_{n,\ i}$ which consists of $n-i$
successes and $i$ failures. First we will distribute the $i$ failures and the
$n-i$ successes. Let $s$ $(1\leq s\leq i-k_{2}+1)$ be the number of runs of
failures in the event $E_{n,\ i}$. We distinguish between four types of
sequences in the event $\left\\{L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\ \wedge\ F_{n}=i\right\\}$, respectively named A, B, C and D-type, which
are defined as follows.

$\begin{split}\text{A-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s,\mbox{\ and\
}x_{1}+\cdots+x_{s}=n-i,\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$ $\begin{split}\text{B-type}\
:&\quad\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s-1}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s-1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s-1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s-1,\mbox{\ and\
}x_{1}+\cdots+x_{s-1}=n-i,\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

$\begin{split}\text{C-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s+1}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s+1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s+1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s+1,\mbox{\ and\
}x_{1}+\cdots+x_{s+1}=n-i,\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

$\begin{split}\text{D-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{3}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}0<x_{j}<k_{1}+1\mbox{\ for\ }j=1,...,s,\mbox{\ and\
}x_{1}+\cdots+x_{s}=n-i,\text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{i,s}^{k_{2}-1}.\end{split}$

Then the probability of the event $E_{n,\ i}$ is given by

$\begin{split}P_{q,\theta}\Big{(}E_{n,\ i}\Big{)}\quad\ &\\\
=\sum_{s=1}^{i-k_{2}+1}\Bigg{[}\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\times\\\ &\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\times\\\ &\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}+y_{3}}\Big{)}^{x_{3}}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\big{(}1-\theta q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\Big{(}\theta
q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s}}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\quad\quad\quad\quad\quad\bigg{\\{}&\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\big{(}1-\theta q^{y_{1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s-1}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\quad\quad\quad\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\
x_{1},\ldots,x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\ &\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s+1}}\bigg{\\}}+\\\
\end{split}$

$\begin{split}\quad\quad\quad\quad\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}\Bigg{]}.\\\ \end{split}$

Using simple exponentiation algebra arguments to simplify,

$\begin{split}&P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\\\
&\theta^{n-i}{\prod_{j=1}^{i}}\ (1-\theta q^{j-1})\times\\\
&\sum_{s=1}^{i-k_{2}+1}\Bigg{[}\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}}+\\\
&\quad\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}+\\\
&\quad\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\ x_{1},\
\ldots,\ x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}}+\\\
&\quad\quad\quad\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}\Bigg{]}.\\\
\end{split}$

Using Lemma 3.6, Lemma 3.8, Lemma 7.2 and Lemma 7.4, we can rewrite as
follows.

$\begin{split}P_{q,\theta}\Big{(}E_{n,i}\Big{)}=&\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i-k_{2}+1}\Big{[}M_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s)+E_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s)\\\
&+N_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s+1)+F_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s)\Big{]},\\\ \end{split}$

where

$\begin{split}M_{q,0,k_{2}}^{k_{1}+1,\infty}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\end{split}$
$\begin{split}E_{q,0,k_{2}}^{k_{1}+1,\infty}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s-1}=n-i\\\
x_{1},\ldots,x_{s-1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\end{split}$
$\begin{split}N_{q,0,k_{2}}^{k_{1}+1,\infty}(n&-i,\ i,\ s+1)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s+1}=n-i\\\
x_{1},\ldots,x_{s+1}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}},\end{split}$

and

$\begin{split}F_{q,0,k_{2}}^{k_{1}+1,\infty}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}x_{1}+\cdots+x_{s}=n-i\\\
x_{1},\ldots,x_{s}\in\\{1,\ldots,k_{1}\\}\end{subarray}}\
\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}.\end{split}$

Therefore we can compute the probability of the event $\left\\{L_{n}^{(1)}\leq
k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\right\\}$ as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}=&\sum_{i=k_{2}}^{n}\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i-k_{2}+1}\Big{[}M_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s)\\\ &+E_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\
s)+N_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s+1)\\\
&+F_{q,0,k_{2}}^{k_{1}+1,\infty}(n-i,\ i,\ s)\Big{]}.\\\ \end{split}$

Thus proof is completed. ∎

It is worth mentioning here that the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq
k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\Big{)}$ approaches the probability
function of $P_{\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\Big{)}$ for $n\geq 1$ in the limit as $q$ tends to 1 of IID model. The
details are presented in the following remark.

######  Remark 39.

For $q=1$, the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}$ for $n\geq k_{2}$ reduces to the PMF
$P_{\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\Big{)}$
for $n\geq 1$ is given by

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\leq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}=&\sum_{i=k_{2}}^{n}\theta^{n-i}(1-\theta)^{i}\
\sum_{s=1}^{i-k_{2}+1}\Big{[}S(s,\ k_{1}+1,\ n-i)\\\ &+S(s-1,\ k_{1}+1,\
n-i)+S(s+1,\ k_{1}+1,\ n-i)\\\ &+S(s,\ k_{1}+1,\ n-i)\Big{]}R(s,\ k_{2},\
i),\\\ \end{split}$

where

$\begin{split}S(a,\ b,\
c)=\sum_{j=0}^{min(a,\left[\frac{c-a}{b-1}\right])}(-1)^{j}{a\choose
j}{c-j(b-1)-1\choose a-1}\end{split}$

and

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

###  7.3 Closed expression for the PMF of $\left(L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\right)$

We shall study of the joint distribution of $\left(L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\right)$. We now make some useful Definition and
Lemma for the proofs of Theorem in the sequel.

######  Definition 7.5.

For $0<q\leq 1$, we define

$\begin{split}\overline{O}_{q,0,0}^{0,k_{2}}(u,v,s)={\sum_{x_{1},\ldots,x_{s-1}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s-1},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{u,s-1}^{0},\ \text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{O}_{q,0,0}^{\infty,k_{2}}(u,v,s)$.

######  Lemma 7.5.

$\overline{O}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ obeys the following recurrence
relation.

$\begin{split}\overline{O}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{a=1}^{u-(s-2)}\sum_{b=1}^{k_{2}-1}q^{a(v-b)}\overline{O}_{q,0,0}^{\infty,k_{2}}(u-a,v-b,s-1),&\text{for}\
s>1,\ s-1\leq u\\\ &\text{and}\ s\leq v\leq s(k_{2}-1)\\\ 1,&\text{for}\ s=1,\
u=0,\ \text{and}\ 1\leq v\leq k_{2}-1\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s-1\leq u$ and $s\leq v\leq s(k_{2}-1)$, we observe that $y_{s}$
may assume any value $1,\ldots,k_{2}-1$, then
$\overline{O}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ can be written as

$\begin{split}\overline{O}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u,s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}\end{subarray}}}q^{x_{s-1}(v-y_{s})}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\end{split}$

Similarly, we observe that since $x_{s-1}$ can assume the values
$1,\ldots,r-(s-2)$, then $\overline{O}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ can be
rewritten as

$\begin{split}\overline{O}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
=&\sum_{x_{s-1}=1}^{u-(s-2)}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s-1}(v-y_{s})}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-2})\in
S_{u-x_{s-1},s-2}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}{0}\end{subarray}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
=&\sum_{a=1}^{u-(s-2)}\sum_{b=1}^{k_{2}-1}q^{a(v-b)}\overline{O}_{q,0,0}^{\infty,k_{2}}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 40.

We observe that $\overline{O}_{1,0,0}^{\infty,k_{2}}(m,r,s)$ is the number of
integer solutions $(x_{1},\ldots,x_{s-1})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{u,s-1}^{0},\ \text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

given by

$\begin{split}\overline{O}_{1,0,0}^{\infty,k_{2}}(m,r,s)=M(s-1,\ u)S(s,\
k_{2},\ v),\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=b$ such that $(y_{1},\ldots,y_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.6.

For $0<q\leq 1$, we define

$\begin{split}O_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s-1}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s-1},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{u,s-1}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$O_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$.

######  Lemma 7.6.

$O_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}O&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{a=1}^{k_{1}-1}\sum_{b=1}^{k_{2}-1}q^{a(r-b)}O_{q,k_{1},0}^{\infty,k_{2}}(m-a,r-b,s-1)\\\
+\sum_{a=k_{1}}^{m-(s-2)}\sum_{b=1}^{k_{2}-1}q^{a(r-b)}\overline{O}_{q,0,0}^{\infty,k_{2}}(m-a,r-b,s-1),&\text{for}\
s>1,\ (s-2)+k_{1}\leq m)\\\ &\text{and}\ s\leq r\leq s(k_{2}-1)\\\
1,&\text{for}\ s=1,\ m=0,\ \text{and}\ 1\leq r\leq k_{2}-1\\\
0,&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-2)+k_{1}\leq m)$ and $s\leq r\leq s(k_{2}-1)$, we observe that
$y_{s}$ may assume any value $1,\ldots,k_{2}-1$, then
$O_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$ can be written as

$\begin{split}O&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m,s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{x_{s-1}(r-y_{s})}\
q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\end{split}$

Similarly, we observe that since $x_{s-1}$ can assume the values
$1,\ldots,m-(s-2)$, then $O_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$ can be
rewritten as

$\begin{split}O&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
=&\sum_{x_{s-1}=1}^{k_{1}-1}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s-1}(r-y_{s})}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{k_{1}-1}\end{subarray}}}\quad{\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in S_{r-y_{s},s-1}^{0}\end{subarray}}}\
q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{x_{s-1}=k_{1}}^{m-(s-2)}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s-1}(r-y_{s})}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{0}\end{subarray}}}\quad{\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
=&\sum_{a=1}^{k_{1}-1}\ \sum_{b=1}^{k_{2}-1}\ q^{a(r-b)}\
O_{q,k_{1},0}^{\infty,k_{2}}(m-a,r-b,s-1)+\sum_{a=k_{1}}^{m-(s-2)}\
\sum_{b=1}^{k_{2}-1}\ q^{a(r-b)}\
\overline{O}_{q,0,0}^{\infty,k_{2}}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 41.

We observe that $O_{1,k_{1},0}^{\infty,k_{2}}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s-1})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{m,s-1}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{r,s}^{0},\end{split}$

given by

$\begin{split}O_{1,k_{1},0}^{\infty,k_{2}}(m,r,s)=R(s-1,\ k_{1},\ m)S(s,\
k_{2},\ r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.7.

For $0<q\leq 1$, we define

$\begin{split}\overline{P}_{q,0,0}^{\infty,k_{2}}(u,v,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{P}_{q,0,0}^{\infty,k_{2}}(u,v,s)$.

######  Lemma 7.7.

$\overline{P}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ obeys the following recurrence
relation.

$\begin{split}\overline{P}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{a=1}^{u-(s-1)}\sum_{b=1}^{k_{2}-1}q^{a(v-b)}\overline{P}_{q,0,0}^{\infty,k_{2}}(u-a,v-b,s-1),&\text{for}\
s>1,\ s\leq u\\\ &\text{and}\ s\leq v\leq s(k_{2}-1)\\\ 1,&\text{for}\ s=1,\
1\leq u,\ \text{and}\ 1\leq v\leq k_{2}-1\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq u$ and $s\leq v\leq s(k_{2}-1)$, we observe that $y_{s}$ may
assume any value $1,\ldots,k_{2}-1$, then
$\overline{P}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ can be written as

$\begin{split}\overline{P}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{u,s}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}\end{subarray}}}q^{x_{s}(v-y_{s})}\
q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\end{split}$

Similarly, we observe that since $x_{s}$ can assume the values
$1,\ldots,u-(s-1)$, then $\overline{P}_{q,0,0}^{\infty,k_{2}}(u,v,s)$ can be
rewritten as

$\begin{split}\overline{P}&{}_{q,0,0}^{\infty,k_{2}}(u,v,s)\\\
=&\sum_{x_{s}=1}^{u-(s-1)}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s}(v-y_{s})}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in S_{v-y_{s},s-1}^{0}\end{subarray}}}\
q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{a=1}^{u-(s-1)}\sum_{b=1}^{k_{2}-1}q^{a(v-b)}\overline{P}_{q,0,0}^{\infty,k_{2}}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 42.

We observe that $\overline{P}_{1,0,0}^{\infty,k_{2}}(u,v,s)$ is the number of
integer solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{0},\ \text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{0},\end{split}$

given by

$\begin{split}\overline{P}_{1,0,0}^{\infty,k_{2}}(m,r,s)=M(s,\ u)S(s,\ k_{2},\
v),\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=b$ such that $y_{1},\ldots,y_{a}\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.8.

For $0<q\leq 1$, we define

$\begin{split}P_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{r,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$P_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$.

######  Lemma 7.8.

$P_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$ obeys the following recurrence relation,

$\begin{split}P&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\
\sum_{a=1}^{k_{1}-1}q^{a(r-b)}P_{q,k_{1},0}^{\infty,k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\
\sum_{a=1}^{k_{1}-1}q^{a(r-b)}\overline{P}_{q,0,0}^{\infty,k_{2}}(m-a,r-b,s-1),&\text{for}\quad
s>1,\ (s-1)+k_{1}\leq m\\\ &\text{and}\quad s\leq r\leq s(k_{2}-1)\\\
1,&\text{for}\quad s=1,\ k_{1}\leq m\ \text{and}\\\ &1\leq r\leq k_{2}-1\\\
0,&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq m$ and $s\leq r\leq s(k_{2}-1)$, we observe that
$y_{s}$ may assume any value $1,\ldots,k_{2}-1$, then
$P_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)$ can be written as

$\begin{split}P&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{m,s}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}0<y_{1},\ldots,y_{s-1}<k_{2}\\\
(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{x_{s}(r-y_{s})}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\end{split}$

Similarly, we observe that since $x_{s}$ can assume the values
$1,\ldots,m-(s-1)$, then $L_{q,k_{1},0}(m,r,s)$ can be rewritten as

$\begin{split}P&{}_{q,k_{1},0}^{\infty,k_{2}}(m,r,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s}(r-y_{s})}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{m-(s-1)}\sum_{y_{s}=1}^{k_{2}-1}q^{x_{s}(r-y_{s})}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{a=1}^{k_{1}-1}\
\sum_{b=1}^{k_{2}-1}q^{a(r-b)}P_{q,k_{1},0}^{\infty,k_{2}}(m-a,r-b,s-1)+\sum_{a=k_{1}}^{m-(s-1)}\
\sum_{b=1}^{k_{2}-1}q^{a(r-b)}\overline{P}_{q,0,0}^{\infty,k_{2}}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 43.

We observe that $P_{1,k_{1},0}^{\infty,k_{2}}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}0<y_{j}<k_{2}\ \text{for}\ j=1,\ldots,s,\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{r,s}^{0},\end{split}$

given by

$\begin{split}P_{1,k_{1},0}^{\infty,k_{2}}(m,r,s)=R(s,\ k_{1},\ m)S(s,\
k_{2},\ r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $S(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $0<x_{i}<b$ for $i=1,2,\ldots,a$. The
number is given by

$\begin{split}S(a,\ b,\ c)=\sum_{j=0}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

The probability function of $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}$ for $n\geq k_{1}$ is obtained by the following
theorem.

######  Theorem 7.3.

The PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$ for $n\geq k_{1}$

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}=&\sum_{i=1}^{n-k_{1}}\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i}\Big{[}H_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s)\\\
&+O_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\
s)+G_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s+1)\\\
&+P_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\
s)\Big{]}J(n,k_{1}+1)+J(n,k_{1})\theta^{n},\\\ \end{split}$

where $J(n,k_{1})$ is the function defined by $J(n,k_{1})=1$ if $n\geq k_{1}$
and $0$ otherwise.

###### Proof.

We partition the event $\left\\{L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\right\\}$ into disjoint events given by $F_{n}=i,$ for $i=k_{2},\ldots,\
n$. Adding the probabilities we have

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq
k_{2}\Big{)}=\sum_{i=1}^{n-k_{1}}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\leq k_{2}\ \wedge\ F_{n}=i\Big{)}.\\\ \end{split}$

We will write $E_{n,i}=\left\\{L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\ \wedge\ F_{n}=i\right\\}$. We can now rewrite as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq
k_{2}\Big{)}=\sum_{i=1}^{n-k_{1}}P_{q,\theta}\left(E_{n,i}\right).\end{split}$

We are going to focus on the event $E_{n,\ i}$. A typical element of the event
$\Big{\\{}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\ \wedge\
F_{n}=i\Big{\\}}$ is an ordered sequence which consists of $n-i$ successes and
$i$ failures such that the length of the longest success run is greater than
or equal to $k_{1}$ and the length of the longest failure run is less than or
equal to $k_{2}$. The number of these sequences can be derived as follows.
First we will distribute the $i$ failures and the $n-i$ successes. Let $s$
$(1\leq s\leq i)$ be the number of runs of failures in the event $E_{n,\ i}$.
We divide into two cases: starting with a failure run or starting with a
success run. Thus, we distinguish between four types of sequences in the event
$\Big{\\{}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\ \wedge\
F_{n}=i\Big{\\}}$, respectively named A, B, C and D-type, which are defined as
follows.

$\begin{split}\text{A-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s})\in S_{n-i,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{B-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s-1}}\mid\overbrace{1\ldots 1}^{x_{s-1}}\mid\overbrace{0\ldots
0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s-1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s-1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{n-i,s-1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{C-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s+1}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s+1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s+1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s+1})\in S_{n-i,s+1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

$\begin{split}\text{D-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{3}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s})\in S_{n-i,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}0<y_{j}<k_{2}+1\mbox{\ for\
}j=1,...,s,\mbox{\ and\ }y_{1}+\cdots+y_{s}=i.\end{split}$

Then the probability of the event $E_{n,\ i}$ is given by

$\begin{split}P_{q,\theta}\Big{(}E_{n,\ i}\Big{)}&\\\
=\sum_{s=1}^{i}\Bigg{[}\bigg{\\{}&\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\times\\\ &\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\times\\\ &\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}+y_{3}}\Big{)}^{x_{3}}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\big{(}1-\theta q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\Big{(}\theta
q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s}}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\
&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\big{(}1-\theta q^{y_{1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s-1}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\quad\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\ &\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s+1}}\bigg{\\}}+\\\
\end{split}$

$\begin{split}\quad\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\hskip
8.5359pt\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}\Bigg{]}.\\\ \end{split}$

Using simple exponentiation algebra arguments to simplify,

$\begin{split}&P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\\\
&\theta^{n-i}{\prod_{j=1}^{i}}\ (1-\theta q^{j-1})\times\\\
&\sum_{s=1}^{i}\Bigg{[}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}}+\\\
&\quad\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}+\\\
&\quad\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}}+\\\
&\quad\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}\Bigg{]}.\\\
\end{split}$

Using Lemma 3.10, Lemma 3.12, Lemma 7.6 and Lemma 7.8, we can rewrite as
follows.

$\begin{split}P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i}&\Big{[}H_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\
s)+O_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s)\\\
&+G_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\
s+1)+P_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s)\Big{]},\\\ \end{split}$

where

$\begin{split}H_{q,k_{1},0}^{\infty,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\end{split}$
$\begin{split}O_{q,k_{1},0}^{\infty,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\end{split}$
$\begin{split}G_{q,k_{1},0}^{\infty,k_{2}+1}(n&-i,\ i,\ s+1)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}},\end{split}$

and

$\begin{split}P_{q,k_{1},0}^{\infty,k_{2}+1}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}y_{1}+\cdots+y_{s}=i\\\
y_{1},\ldots,y_{s}\in\\{1,\ldots,k_{2}\\}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}.\end{split}$

Therefore we can compute the probability of the event $\left\\{L_{n}^{(1)}\geq
k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\right\\}$ as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}=&\sum_{i=1}^{n-k_{1}}\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i}\Big{[}H_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s)\\\
&+O_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\
s)+G_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s+1)\\\
&+P_{q,k_{1},0}^{\infty,k_{2}+1}(n-i,\ i,\ s)\Big{]}.\\\ \end{split}$

Thus proof is completed. ∎

It is worth mentioning here that the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq
k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\Big{)}$ approaches the probability
function of $P_{\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}$ of IID model. The details are presented in the following remark.

######  Remark 44.

For $q=1$, the PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\leq k_{2}\Big{)}$ for $n\geq k_{1}$ reduces to the PMF
$P_{\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq k_{2}\Big{)}$
for $n\geq k_{1}$ is given by

$\begin{split}P\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\leq
k_{2}\Big{)}=&\sum_{i=1}^{n-k_{1}}\theta^{n-i}\
(1-\theta)^{i}\sum_{s=1}^{i}S(s,\ k_{2}+1,\ i)\Big{[}R(s,\ k_{1},\ n-i)\\\
&+R(s-1,\ k_{1},\ n-i)+S(s+1,\ k_{1},\ n-i)\\\ &+R(s,\ k_{1},\
n-i)\Big{]}J(n,k_{1}+1)+J(n,k_{1})\theta^{n},\\\ \end{split}$

where

$\begin{split}S(a,\ b,\
c)=\sum_{j=0}^{min(a,\left[\frac{c-a}{b-1}\right])}(-1)^{j}{a\choose
j}{c-j(b-1)-1\choose a-1},\end{split}$

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

and $J(n,k_{1})$ is the function defined by $J(n,k_{1})=1$ if $n\geq k_{1}$
and $0$ otherwise.

###  7.4 Closed expression for the PMF of $\left(L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\right)$

We shall study of the joint distribution of $\left(L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\right)$. We now make some useful Definition and
Lemma for the proofs of Theorem in the sequel.

######  Definition 7.9.

For $0<q\leq 1$, we define

$\begin{split}\overline{Q}_{q,k_{1},0}(u,v,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{v,s}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{Q}_{q,k_{1},0}(u,v,s)$.

######  Lemma 7.9.

$\overline{Q}_{q,k_{1},0}(u,v,s)$ obeys the following recurrence relation.

$\begin{split}\overline{Q}&{}_{q,k_{1},0}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{a=1}^{k_{1}-1}\sum_{b=1}^{v-(s-1)}q^{va}\overline{Q}_{q,k_{1},0}(u-a,v-b,s-1)\\\
+\sum_{a=k_{1}}^{u-(s-1)}\sum_{b=1}^{v-(s-1)}q^{va}\overline{J}_{q}(u-a,v-b,s-1),&\text{for}\
s>1,\ (s-1)+k_{1}\leq u\\\ &\text{and}\ s\leq v\\\ 1,&\text{for}\ s=1,\
k_{1}\leq u,\ \text{and}\ 1\leq v\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq u$ and $s\leq v$, we observe that $y_{s}$ may
assume any value $1,\ldots,v-(s-1)$, then $\overline{Q}_{q}(u,v,s)$ can be
written as

$\begin{split}\overline{Q}&{}_{q,k_{1},0}(u,v,s)\\\
=&\sum_{y_{s}=1}^{v-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{u,s}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}.\end{split}$

Similarly, we observe that since $x_{s}$ can assume the values
$1,\ldots,u-(s-1)$, then $\overline{Q}_{q}(u,v,s)$ can be rewritten as

$\begin{split}\overline{Q}&{}_{q,k_{1},0}(u,v,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}\sum_{y_{s}=1}^{v-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{u-(s-1)}\sum_{y_{s}=1}^{v-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}\end{subarray}}}q^{vx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
=&\sum_{a=1}^{k_{1}-1}\sum_{b=1}^{v-(s-1)}q^{va}\overline{Q}_{q,k_{1},0}(u-a,v-b,s-1)+\sum_{a=k_{1}}^{u-(s-1)}\sum_{b=1}^{v-(s-1)}q^{va}\overline{J}_{q}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 45.

We observe that $\overline{Q}_{1,k_{1},0}(u,v,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{v,s}^{0}.\end{split}$

given by

$\begin{split}\overline{Q}_{1,k_{1},0}(u,v,s)=R(s,\ k_{1},\ u)M(s,\
v),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=b$ such that $(x_{1},\ldots,x_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.10.

For $0<q\leq 1$, we define

$\begin{split}Q_{q,k_{1},k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$Q_{q,k_{1},k_{2}}(m,r,s)$.

######  Lemma 7.10.

$Q_{q,k_{1},k_{2}}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}Q&{}_{q,k_{1},k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}Q_{q,k_{1},k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{Q}_{q,k_{1},0}(m-a,r-b,s-1)\\\
+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}J_{q,0,k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}\overline{J}_{q}(m-a,r-b,s-1),&\text{for}\
s>1,\ (s-1)+k_{1}\leq m\\\ &\text{and}\ (s-1)+k_{2}\leq r\\\ 1,&\text{for}\
s=1,\ k_{1}\leq m,\ \text{and}\ k_{2}\leq r\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq m$ and $(s-1)+k_{2}\leq r$, we observe that
$x_{s}$ may assume any value $1,\ldots,m-(s-1)$, then
$Q_{q,k_{1},k_{2}}(m,r,s)$ can be written as

$\begin{split}Q&{}_{q,k_{1},k_{2}}(m,r,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{m-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,r-(s-1)$, then $Q_{q,k_{1},k_{2}}(m,r,s)$ can be rewritten as

$\begin{split}Q&{}_{q}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=1}^{k_{1}-1}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s}=1}^{k_{1}-1}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=k_{1}}^{m-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s}=k_{1}}^{m-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}\end{subarray}}}q^{rx_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}Q_{q,k_{1},k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{Q}_{q,k_{1},0}(m-a,r-b,s-1)\\\
&+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}J_{q,0,k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}\overline{J}_{q}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 46.

We observe that $Q_{1,k_{1},k_{2}}(m,r,s)$ is the number of integer solutions
$(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{r,s}^{k_{2}-1}\end{split}$

given by

$\begin{split}Q_{1,k_{1},k_{2}}(m,r,s)=R(s,\ k_{1},\ m)R(s,\ k_{2},\
r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

######  Definition 7.11.

For $0<q\leq 1$, we define

$\begin{split}\overline{R}_{q,0,k_{2}}(u,v,s)={\sum_{x_{1},\ldots,x_{s-1}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s-1},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{u,s-1}^{0},\ \text{and}\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{R}_{q,0,k_{2}}(u,v,s)$.

######  Lemma 7.11.

$\overline{R}_{q,0,k_{2}}(u,v,s)$ obeys the following recurrence relation.

$\begin{split}\overline{R}&{}_{q,0,k_{2}}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{u-(s-2)}q^{a(v-b)}\overline{R}_{q,0,k_{2}}(u-a,v-b,s-1)\\\
+\sum_{b=k_{2}}^{v-(s-1)}\sum_{a=1}^{u-(s-2)}q^{a(v-b)}\overline{K}_{q}(u-a,v-b,s-1),&\text{for}\
s>1,\ s-1\leq u\ \text{and}\\\ &(s-1)+k_{2}\leq v\\\ 1,&\text{for}\ s=1,\
u=0,\ \text{and}\ k_{2}\leq v\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s-1\leq u$ and $(s-1)+k_{2}\leq v$, we observe that $x_{s-1}$ may
assume any value $1,\ldots,u-(s-2)$, then $\overline{R}_{q,0,k_{2}}(u,v,s)$
can be written as

$\begin{split}\overline{R}&{}_{q,0,k_{2}}(u,v,s)\\\
=&\sum_{x_{s-1}=1}^{u-(s-2)}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u,s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{v,s}^{k_{2}-1}}}q^{x_{s-1}(v-y_{s})}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,v-(s-1)$, then $\overline{R}_{q,0,k_{2}}(u,v,s)$ can be rewritten as

$\begin{split}\overline{R}&{}_{q,0,k_{2}}(u,v,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s-1}=1}^{u-(s-2)}q^{x_{s-1}(v-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s-1},s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{y_{s}=k_{2}}^{v-(s-1)}\sum_{x_{s-1}=1}^{u-(s-2)}q^{x_{s-1}(v-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s-1},s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{u-(s-2)}q^{a(v-b)}\overline{R}_{q,0,k_{2}}(u-a,v-b,s-1)+\sum_{b=k_{2}}^{v-(s-1)}\sum_{a=1}^{u-(s-2)}q^{a(v-b)}\overline{K}_{q}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 47.

We observe that $\overline{R}_{1,0,k_{2}}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s-1})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{u,s-1}^{0},\ \text{and}\end{split}$

$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{k_{2}-1}\end{split}$

given by

$\begin{split}\overline{R}_{1,0,k_{2}}(m,r,s)=M(s-1,\ u)R(s,\ k_{2},\
v),\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=b$ such that $(y_{1},\ldots,y_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.12.

For $0<q\leq 1$, we define

$\begin{split}R_{q,k_{1},k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s-1}}}\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s-1},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{m,s-1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$R_{q,k_{1},k_{2}}(m,r,s)$.

######  Lemma 7.12.

$R_{q,k_{1},k_{2}}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}R&{}_{q,k_{1},k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{a(r-b)}R_{q,k_{1},k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{a(r-b)}K_{q,k_{1},0}(m-a,r-b,s-1)\\\
+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-2)}q^{a(r-b)}\overline{R}_{q,0,k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-2)}q^{a(r-b)}\overline{K}_{q}(m-a,r-b,s-1),&\text{for}\
s>1,\ (s-2)+k_{1}\leq m\\\ &\text{and}\ (s-1)+k_{2}\leq r\\\
0,&\text{otherwise.}\\\ \end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-2)+k_{1}\leq m$ and $(s-1)+k_{2}\leq r$, we observe that
$x_{s-1}$ may assume any value $1,\ldots,m-(s-2)$, then
$R_{q,k_{1},k_{2}}(m,r,s)$ can be written as

$\begin{split}R&{}_{q,k_{1},k_{2}}(m,r,s)\\\
=&\sum_{x_{s-1}=1}^{k_{1}-1}{\hskip 8.5359pt\sum_{(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{k_{1}-1}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}}}q^{x_{s-1}(r-y_{s})}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{x_{s-1}=k_{1}}^{m-(s-2)}{\hskip
8.5359pt\sum_{(x_{1},\ldots,x_{s-2})\in S_{m-x_{s-1},s-2}^{0}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}}}q^{x_{s-1}(r-y_{s})}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}.\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,r-(s-1)$, then $R_{q,k_{1},k_{2}}(m,r,s)$ can be rewritten as

$\begin{split}R&{}_{q,k_{1},k_{2}}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s-1}=1}^{k_{1}-1}q^{x_{s-1}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{k_{1}-1}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s-1}=1}^{k_{1}-1}q^{x_{s-1}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{k_{1}-1}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s-1}=k_{1}}^{m-(s-2)}q^{x_{s-1}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ \ldots,\ y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s-1}=k_{1}}^{m-(s-2)}q^{x_{s-1}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-2})\in
S_{m-x_{s-1},s-2}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-2}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{a(r-b)}R_{q,k_{1},k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}q^{a(r-b)}K_{q,k_{1},0}(m-a,r-b,s-1)\\\
&+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-2)}q^{a(r-b)}\overline{R}_{q,0,k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-2)}q^{a(r-b)}\overline{K}_{q}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 48.

We observe that $R_{1,k_{1},k_{2}}(m,r,s)$ is the number of integer solutions
$(x_{1},\ldots,x_{s-1})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{m,s-1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{split}$

given by

$\begin{split}R_{1,k_{1},k_{2}}(m,r,s)=R(s-1,\ k_{1},\ m)R(s,\ k_{2},\
r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=c$ such that $(x_{1},\ldots,x_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.13.

For $0<q\leq 1$, we define

$\begin{split}\overline{S}_{q,k_{1},0}(u,v,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s-1}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s-1}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s-1})\in
S_{v,s-1}^{0}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{S}_{q,k_{1},0}(u,v,s)$.

######  Lemma 7.13.

$\overline{S}_{q,k_{1},0}(u,v,s)$ obeys the following recurrence relation.

$\begin{split}\overline{S}&{}_{q,k_{1},0}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{a=1}^{k_{1}-1}\sum_{b=1}^{v-(s-2)}q^{va}\overline{S}_{q,k_{1},0}(u-a,v-b,s-1)\\\
+\sum_{a=k_{1}}^{u-(s-1)}\sum_{b=1}^{v-(s-2)}q^{va}\overline{I}_{q}(u-a,v-b,s-1),&\text{for}\
s>1,\ (s-1)+k_{1}\leq u\ \text{and}\ (s-1)\leq v\\\ 1,&\text{for}\ s=1,\
k_{1}\leq u,\ \text{and}\ v=0\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq u$ and $(s-1)\leq v$, we observe that $y_{s-1}$
may assume any value $1,\ldots,v-(s-2)$, then
$\overline{S}_{q,k_{1},0}(u,v,s)$ can be written as,

$\begin{split}\overline{S}&{}_{q,k_{1},0}(u,v,s)\\\
=&\sum_{y_{s-1}=1}^{v-(s-2)}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{u,s}^{k_{1}-1}\end{subarray}}}{\hskip
14.22636pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{v-y_{s-1},s-2}^{0}}}q^{vx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}.\end{split}$

Similarly, we observe that since $x_{s}$ can assume the values
$1,\ldots,u-(s-1)$, then $\overline{S}_{q,k_{1},0}(u,v,s)$ can be rewritten as

$\begin{split}\overline{R}&{}_{q,k_{1},0}(u,v,s)\\\
=&\sum_{x_{s}=1}^{k_{1}-1}\sum_{y_{s-1}=1}^{v-(s-2)}{\hskip
5.69046pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{v-y_{s-1},s-2}^{0}}}q^{vx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{u-(s-1)}\sum_{y_{s-1}=1}^{v-(s-2)}{\hskip
5.69046pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{v-y_{s-1},s-2}^{0}}}q^{vx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{a=1}^{k_{1}-1}\sum_{b=1}^{v-(s-2)}q^{va}\overline{S}_{q,k_{1},0}(u-a,v-b,s-1)+\sum_{a=k_{1}}^{u-(s-1)}\sum_{b=1}^{v-(s-2)}q^{va}\overline{I}_{q}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 49.

We observe that $\overline{S}_{1,k_{1},0}(u,v,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s-1})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{u,s}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{v,s-1}^{0}\end{split}$

given by

$\begin{split}\overline{S}_{1,k_{1},0}(u,v,s)=R(s,\ k_{1},\ u)M(s-1,\
v),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$x_{1}+x_{2}+\cdots+x_{a}=b$ such that $(x_{1},\ldots,x_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.14.

For $0<q\leq 1$, we define

$\begin{split}S_{q,k_{1},k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s-1}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s-1}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s-1})\in
S_{r,s-1}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$S_{q,k_{1},k_{2}}(m,r,s)$.

######  Lemma 7.14.

$S_{q,k_{1},k_{2}}(m,r,s)$ obeys the following recurrence relation.

$\begin{split}S&{}_{q,k_{1},k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}S_{q,k_{1},k_{2}}(u-a,v-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{S}_{q,k_{1},0}(u-a,v-b,s-1)\\\
+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}I_{q,0,k_{2}}(u-a,v-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=k_{1}}^{m-(s-1)}q^{ra}\overline{I}_{q}(u-a,v-b,s-1),&\text{for}\
s>1,\ (s-1)+k_{1}\leq m\\\ &\text{and}\ (s-2)+k_{2}\leq r\\\ 1,&\text{for}\
s=1,\ k_{1}\leq m,\ \text{and}\ r=0\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq m$ and $(s-2)+k_{2}\leq r$, we observe that
$x_{s}$ may assume any value $1,\ldots,m-(s-1)$, then
$S_{q,k_{1},k_{2}}(m,r,s)$ can be written as

$\begin{split}S&{}_{q,k_{1},k_{2}}(m,r,s)\\\ =&\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r,s-1}^{k_{2}-1}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{m-(s-1)}{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r,s-1}^{k_{2}-1}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}.\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,r-(s-2)$, then $S_{q,k_{1},k_{2}}(m,r,s)$ can be rewritten as

$\begin{split}S&{}_{q,k_{1},k_{2}}(m,r,s)\\\
=&\sum_{y_{s-1}=1}^{k_{2}-1}\sum_{x_{s}=1}^{m-(s-1)}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{r-y_{s-1},s-2}^{k_{2}-1}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s-1}=k_{2}}^{r-(s-2)}\sum_{x_{s}=1}^{k_{1}-1}\hskip
8.5359pt{\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{k_{1}-1}\end{subarray}}}\hskip
8.5359pt{\sum_{(y_{1},\ldots,y_{s-2})\in
S_{r-y_{s-1},s-2}^{0}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s-1}=1}^{k_{2}-1}\sum_{x_{s}=k_{1}}^{m-(s-1)}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{r-y_{s-1},s-2}^{k_{2}-1}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s-1}=k_{2}}^{r-(s-2)}\sum_{x_{s}=k_{1}}^{m-(s-1)}{\hskip
8.5359pt\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s-1}^{0}\end{subarray}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s-2})\in
S_{r-y_{s-1},s-2}^{0}}}q^{rx_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
\end{split}$

$\begin{split}=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}q^{ra}S_{q,k_{1},k_{2}}(u-a,v-b,s-1)+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=1}^{k_{1}-1}q^{ra}\overline{S}_{q,k_{1},0}(u-a,v-b,s-1)\\\
&+\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{m-(s-1)}q^{ra}I_{q,0,k_{2}}(u-a,v-b,s-1)+\sum_{b=k_{2}}^{r-(s-2)}\sum_{a=1}^{m-(s-1)}q^{ra}\overline{I}_{q}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed.

∎

######  Remark 50.

We observe that $S_{1,k_{1},k_{2}}(m,r,s)$ is the number of integer solutions
$(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s-1})$ of

$\begin{split}(x_{1},\ldots,x_{s})\in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$

$\begin{split}(y_{1},\ldots,y_{s-1})\in S_{r,s-1}^{k_{2}-1}\end{split}$

given by

$\begin{split}S_{1,k_{1},k_{2}}(m,r,s)=R(s,\ k_{1},\ u)R(s-1,\ k_{2},\
r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.15.

For $0<q\leq 1$, we define

$\begin{split}\overline{T}_{q}(u,v,s)={\sum_{x_{1},\ldots,x_{s-1}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\ \in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{k_{2}-1}.\end{split}$

The following gives a recurrence relation useful for the computation of
$\overline{T}_{q,0,k_{2}}(u,v,s)$.

######  Lemma 7.15.

$\overline{T}_{q,0,k_{2}}(u,v,s)$ obeys the following recurrence relation.

$\begin{split}\overline{T}&{}_{q,0,k_{2}}(u,v,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{u-(s-1)}q^{a(v-b)}\overline{T}_{q,0,k_{2}}(u-a,v-b,s-1)\\\
+\sum_{b=k_{2}}^{v-(s-1)}\sum_{a=1}^{u-(s-1)}q^{a(v-b)}\overline{L}_{q}(u-a,v-b,s-1),&\text{for}\
s>1,\ s\leq u\ \text{and}\ (s-1)+k_{2}\leq v\\\ 1,&\text{for}\ s=1,\ 1\leq u\
\text{and}\ k_{2}\leq v\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $s\leq u$ and $(s-1)+k_{2}\leq v$, we observe that $x_{s}$ may
assume any value $1,\ldots,u-(s-1)$, then $\overline{T}_{q,0,k_{2}}(u,v,s)$
can be written as

$\begin{split}\overline{T}&{}_{q,0,k_{2}}(u,v,s)\\\
=&\sum_{x_{s}=1}^{u-(s-1)}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{v,s}^{k_{2}-1}}}q^{x_{s}(v-y_{s})}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,v-(s-1)$, then $\overline{T}_{q,0,k_{2}}(u,v,s)$ can be rewritten as

$\begin{split}\overline{T}&{}_{q,0,k_{2}}(u,v,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=1}^{u-(s-1)}q^{x_{s}(v-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{v-(s-1)}\sum_{x_{s}=1}^{u-(s-1)}q^{x_{s}(v-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{u-x_{s},s-1}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{v-y_{s},s-1}^{0}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{u-(s-1)}q^{a(v-b)}\overline{T}_{q,0,k_{2}}(u-a,v-b,s-1)+\sum_{b=k_{2}}^{v-(s-1)}\sum_{a=1}^{u-(s-1)}q^{a(v-b)}\overline{L}_{q}(u-a,v-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 51.

We observe that $\overline{T}_{1,0,k_{2}}(m,r,s)$ is the number of integer
solutions $(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\ \in S_{u,s}^{0},\ \text{and}\end{split}$
$\begin{split}(y_{1},\ldots,y_{s})\in S_{v,s}^{k_{2}-1}\end{split}$

given by

$\begin{split}\overline{T}_{1,0,k_{2}}(u,v,s)=M(s,\ u)R(s,\ k_{2},\
v),\end{split}$

where $M(a,\ b)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=b$ such that $(y_{1},\ldots,y_{a})\in S_{b,a}^{0}$.
The number is given by

$\begin{split}M(a,\ b)={b-1\choose a-1}.\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

######  Definition 7.16.

For $0<q\leq 1$, we define

$\begin{split}T_{q,k_{1},k_{2}}(m,r,s)={\sum_{x_{1},\ldots,x_{s}}}\
\sum_{y_{1},\ldots,y_{s}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}},\
\end{split}$

where the summation is over all integers $x_{1},\ldots,x_{s},$ and
$y_{1},\ldots,y_{s}$ satisfying

$\begin{split}(x_{1},\ldots,x_{s})\ \in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{split}$

The following gives a recurrence relation useful for the computation of
$T_{q,k_{1},k_{2}}(m,r,s)$.

######  Lemma 7.16.

$T_{q,k_{1},k_{2}}(m,r,s)$ obeys the following recurrence relation,

$\begin{split}T&{}_{q,k_{1},k_{2}}(m,r,s)\\\
&=\left\\{\begin{array}[]{ll}\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}\
q^{a(r-b)}T_{q,k_{1},k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}\
q^{a(r-b)}L_{q,k_{1},0}(m-a,r-b,s-1)\\\
+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-1)}\
q^{a(r-b)}\overline{T}_{q,0,k_{2}}(m-a,r-b,s-1)\\\
+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-1)}\
q^{a(r-b)}\overline{L}_{q}(m-a,r-b,s-1),&\text{for}\quad s>1,\ (s-1)+k_{1}\leq
m\\\ &\text{and}\ (s-1)+k_{2}\leq r\\\ 1,&\text{for}\ s=1,\ k_{1}\leq m,\
\text{and}\ k_{2}\leq r\\\ 0,&\text{otherwise.}\\\
\end{array}\right.\end{split}$

###### Proof.

For $s>1$, $(s-1)+k_{1}\leq m$ and $(s-1)+k_{2}\leq r$, we observe that
$x_{s}$ may assume any value $1,\ldots,m-(s-1)$, then
$T_{q,k_{1},k_{2}}(m,r,s)$ can be written as

$\begin{split}T&{}_{q,k_{1},k_{2}}(m,r,s)\\\ =&\sum_{x_{s}=1}^{k_{1}-1}{\hskip
8.5359pt\sum_{(x_{1},\ldots,x_{s-1})\in S_{m-x_{s},s}^{k_{1}-1}}}{\hskip
8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}}}q^{x_{s}(r-y_{s})}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{x_{s}=k_{1}}^{m-(s-1)}{\sum_{(x_{1},\ldots,x_{s})\in
S_{m,s}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}}}q^{x_{s}(r-y_{s})}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\end{split}$

Similarly, we observe that since $y_{s}$ can assume the values
$1,\ldots,r-(s-1)$, then $T_{q,k_{1},k_{2}}(m,r,s)$ can be rewritten as

$\begin{split}T&{}_{q,k_{1},k_{2}}(m,r,s)\\\
=&\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=1}^{k_{1}-1}q^{x_{s}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s}^{k_{1}-1}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s}=1}^{k_{1}-1}q^{x_{s}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s}^{k_{1}-1}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s}=1}^{k_{2}-1}\sum_{x_{s}=k_{1}}^{m-(s-1)}q^{x_{s}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{k_{2}-1}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
&+\sum_{y_{s}=k_{2}}^{r-(s-1)}\sum_{x_{s}=k_{1}}^{m-(s-1)}q^{x_{s}(r-y_{s})}{\sum_{(x_{1},\ldots,x_{s-1})\in
S_{m-x_{s},s}^{0}}}{\hskip 8.5359pt\sum_{(y_{1},\ldots,y_{s-1})\in
S_{r-y_{s},s-1}^{0}}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-2})x_{s-1}}\\\
=&\sum_{b=1}^{k_{2}-1}\sum_{a=1}^{k_{1}-1}\
q^{a(r-b)}T_{q,0,k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=1}^{k_{1}-1}\
q^{a(r-b)}L_{q,k_{1},0}(m-a,r-b,s-1)\\\
&+\sum_{b=1}^{k_{2}-1}\sum_{a=k_{1}}^{m-(s-1)}q^{a(r-b)}\overline{T}_{q,0,k_{2}}(m-a,r-b,s-1)+\sum_{b=k_{2}}^{r-(s-1)}\sum_{a=k_{1}}^{m-(s-1)}\
q^{a(r-b)}\overline{L}_{q}(m-a,r-b,s-1).\end{split}$

The other cases are obvious and thus the proof is completed. ∎

######  Remark 52.

We observe that $T_{1,k_{1},k_{2}}(m,r,s)$ is the number of integer solutions
$(x_{1},\ldots,x_{s})$ and $(y_{1},\ldots,y_{s})$ of

$\begin{split}(x_{1},\ldots,x_{s})\ \in S_{m,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{r,s}^{k_{2}-1}\end{split}$

given by

$\begin{split}T_{1,k_{1},k_{2}}(m,r,s)=R(s,\ k_{1},\ m)R(s,\ k_{2},\
r),\end{split}$

where $R(a,\ b,\ c)$ denotes the total number of integer solution
$y_{1}+x_{2}+\cdots+y_{a}=c$ such that $(y_{1},\ldots,y_{a})\in
S_{r,a}^{k_{2}}$. The number is given by

$\begin{split}R(a,\ b,\ c)=\sum_{j=1}^{min\left(a,\
\left[\frac{c-a}{b-1}\right]\right)}(-1)^{j+1}{a\choose j}{c-j(b-1)-1\choose
a-1}.\end{split}$

See, e.g. Charalambides, (2002).

The probability function of $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}$ is obtained by the following theorem.

######  Theorem 7.4.

The PMF $P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\Big{)}$ for $n\geq k_{1}+k_{2}$

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\geq k_{2}\Big{)}=&\sum_{i=k_{2}}^{n-k_{1}}\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i}\Big{[}Q_{q,k_{1},k_{2}}(n-i,\ i,\ s)\\\
&+R_{q,k_{1},k_{2}}(n-i,\ i,\ s)+S_{q,k_{1},k_{2}}(n-i,\ i,\ s+1)\\\
&+T_{q,k_{1},k_{2}}(n-i,\ i,\ s)\Big{]}.\\\ \end{split}$

###### Proof.

We partition the event $\left\\{L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\right\\}$ into disjoint events given by $F_{n}=i,$ for $i=k_{2},\ldots,\
n-k_{1}$. Adding the probabilities we have

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\geq
k_{2}\Big{)}=\sum_{i=k_{2}}^{n-k_{1}}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\
\wedge\ L_{n}^{(0)}\geq k_{2}\ \wedge\ F_{n}=i\Big{)}.\\\ \end{split}$

We will write $E_{n,i}=\left\\{L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\geq
k_{2}\ \wedge\ F_{n}=i\right\\}$. We can now rewrite as follows

$\begin{split}P_{q,\theta}\Big{(}L_{n}^{(1)}\geq k_{1}\ \wedge\
L_{n}^{(0)}\geq
k_{2}\Big{)}=\sum_{i=k_{2}}^{n-k_{1}}P_{q,\theta}\left(E_{n,i}\right).\end{split}$

We are going to focus on the event $E_{n,\ i}$. A typical element of the event
$\Big{\\{}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\ \wedge\
F_{n}=i\Big{\\}}$ is an ordered sequence which consists of $n-i$ successes and
$i$ failures such that the length of the longest success run is greater than
or equal to $k_{1}$ and the length of the longest failure run is greater than
or equal to $k_{2}$. The number of these sequences can be derived as follows.
First we will distribute the $i$ failures and the $n-i$ successes. Let $s$
$(1\leq s\leq i)$ be the number of runs of failures in the event $E_{n,\ i}$.
We divide into two cases: starting with a failure run or starting with a
success run. Thus, we distinguish between four types of sequences in the event
$\Big{\\{}L_{n}^{(1)}\geq k_{1}\ \wedge\ L_{n}^{(0)}\geq k_{2}\ \wedge\
F_{n}=i\Big{\\}}$, respectively named A, B, C and D-type, which are defined as
follows.

$\begin{split}\text{A-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s})\in S_{n-i,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

$\begin{split}\text{B-type}\ :&\quad\overbrace{0\ldots
0}^{y_{1}}\mid\overbrace{1\ldots 1}^{x_{1}}\mid\overbrace{0\ldots
0}^{y_{2}}\mid\overbrace{1\ldots 1}^{x_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s-1}}\mid\overbrace{1\ldots 1}^{x_{s-1}}\mid\overbrace{0\ldots
0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s-1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s-1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s-1})\in S_{n-i,s-1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

$\begin{split}\text{C-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\ldots\mid\overbrace{0\ldots
0}^{y_{s}}\mid\overbrace{1\ldots 1}^{x_{s+1}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s+1)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s+1}$, and
$y_{1},\ldots,y_{s}$ satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s+1})\in S_{n-i,s+1}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

$\begin{split}\text{D-type}\ :&\quad\overbrace{1\ldots
1}^{x_{1}}\mid\overbrace{0\ldots 0}^{y_{1}}\mid\overbrace{1\ldots
1}^{x_{2}}\mid\overbrace{0\ldots 0}^{y_{2}}\mid\overbrace{1\ldots
1}^{x_{3}}\mid\ldots\mid\overbrace{0\ldots 0}^{y_{s-1}}\mid\overbrace{1\ldots
1}^{x_{s}}\mid\overbrace{0\ldots 0}^{y_{s}},\\\ \end{split}$

with $i$ $0$’s and $n-i$ $1$’s, where $x_{j}$ $(j=1,\ldots,s)$ represents a
length of run of $1$’s and $y_{j}$ $(j=1,\ldots,s)$ represents the length of a
run of $0$’s. And all integers $x_{1},\ldots,x_{s}$, and $y_{1},\ldots,y_{s}$
satisfy the conditions

$\begin{split}(x_{1},\ldots,x_{s})\in S_{n-i,s}^{k_{1}-1},\
\text{and}\end{split}$ $\begin{split}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}.\end{split}$

Then the probability of the event $E_{n,\ i}$ is given by

$\begin{split}P_{q,\theta}\Big{(}E_{n,\ i}\Big{)}\ &\\\
=\sum_{s=1}^{i}\Bigg{[}\bigg{\\{}&\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\times\\\ &\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\times\\\ &\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\Big{(}\theta
q^{y_{1}+y_{2}+y_{3}}\Big{)}^{x_{3}}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\big{(}1-\theta q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\Big{(}\theta
q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s}}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\
&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}1-\theta
q^{0}\big{)}\cdots\big{(}1-\theta q^{y_{1}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}}\Big{)}^{x_{1}}\big{(}1-\theta q^{y_{1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}-1}\big{)}\times\\\ &\Big{(}\theta
q^{y_{1}+y_{2}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s-1}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}+\\\ \end{split}$

$\begin{split}\quad\quad\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\ &\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s}}\Big{)}^{x_{s+1}}\bigg{\\}}+\\\
\end{split}$

$\begin{split}\quad\quad&\bigg{\\{}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}\big{(}\theta
q^{0}\big{)}^{x_{1}}\big{(}1-\theta q^{0}\big{)}\cdots(1-\theta
q^{y_{1}-1})\times\\\ &\Big{(}\theta q^{y_{1}}\Big{)}^{x_{2}}\big{(}1-\theta
q^{y_{1}+y_{2}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}-1}\big{)}\times\\\
&\Big{(}\theta q^{y_{1}+y_{2}}\Big{)}^{x_{3}}\big{(}1-\theta
q^{y_{1}}\big{)}\cdots\big{(}1-\theta q^{y_{1}+y_{2}+y_{3}-1}\big{)}\times\\\
&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\vdots\\\
&\Big{(}\theta q^{y_{1}+\cdots+y_{s-1}}\Big{)}^{x_{s}}\big{(}1-\theta
q^{y_{1}+\cdots+y_{s-1}}\big{)}\cdots\big{(}1-\theta
q^{y_{1}+\cdots+y_{s}-1}\big{)}\bigg{\\}}\Bigg{]}.\\\ \end{split}$

Using simple exponentiation algebra arguments to simplify,

$\begin{split}&P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\\\
&\theta^{n-i}{\prod_{j=1}^{i}}\ (1-\theta q^{j-1})\times\\\
&\sum_{s=1}^{i}\Bigg{[}\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}}+\\\
&\quad\ \sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}}+\\\
&\quad\ \sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}}+\\\
&\quad\quad\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s}}\Bigg{]}.\\\
\end{split}$

Using Lemma 7.10, Lemma 7.12, Lemma 7.14 and Lemma 7.16, we can rewrite as
follows.

$\begin{split}P_{q,\theta}\Big{(}E_{n,i}\Big{)}=\theta^{n-i}\
{\prod_{j=1}^{i}}\ (1-\theta
q^{j-1})\sum_{s=1}^{i}&\Big{[}Q_{q,k_{1},k_{2}}(n-i,\ i,\
s)+R_{q,k_{1},k_{2}}(n-i,\ i,\ s)\\\ &+S_{q,k_{1},k_{2}}(n-i,\ i,\
s+1)+T_{q,k_{1},k_{2}}(n-i,\ i,\ s)\Big{]},\\\ \end{split}$

where

$\begin{split}Q_{q,k_{1},k_{2}}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s})\in
S_{n-i,s}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s})x_{s}},\end{split}$
$\begin{split}R_{q,k_{1},k_{2}}(n&-i,\ i,\ s)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s-1})\in
S_{n-i,s-1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{1}+(y_{1}+y_{2})x_{2}+\cdots+(y_{1}+\cdots+y_{s-1})x_{s-1}},\end{split}$
$\begin{split}S_{q,k_{1},k_{2}}(n&-i,\ i,\ s+1)\\\
&=\sum_{\begin{subarray}{c}(x_{1},\ldots,x_{s+1})\in
S_{n-i,s+1}^{k_{1}-1}\end{subarray}}\quad\sum_{\begin{subarray}{c}(y_{1},\ldots,y_{s})\in
S_{i,s}^{k_{2}-1}\end{subarray}}q^{y_{1}x_{2}+(y_{1}+y_{2})x_{3}+\cdots+(y_{1}+\cdots+y_{s})x_{s+1}},\end{split}$

and

$\begin{split}T_{q,k_{1},k_{2}}(n&-i,\ i,\ s)\\\