Expected Number of Distinct Subsequences in Randomly Generated Binary Strings

Abstract: When considering binary strings, it's natural to wonder how many distinct subsequences might exist in a given string. Given that there is an existing algorithm which provides a straightforward way to compute the number of distinct subsequences in a fixed string, we might next be interested in the expected number of distinct subsequences in random strings. This expected value is already known for random binary strings where each letter in the string is, independently, equally likely to be a 1 or a 0. We generalize this result to random strings where the letter 1 appears independently with probability $\alpha \in [0,1]$. Also, we make some progress in the case of random strings from an arbitrary alphabet as well as when the string is generated by a two-state Markov chain.

\section{Introduction}
This paper uses the definitions for string and subsequence provided in \cite{Flaxman}. A binary string of length $n$ is some $A=a_1a_2...a_n \in \{0,1\}^n$, and another string $B$ of length $m \le n$ is a subsequence of $A$ if there exist indices $i_1 < i_2 < ...< i_m$ such that
$$B=a_{i_1}a_{i_2}...a_{i_m}$$
We use the notation $B \preceq A$ when $B$ is a subsequence of $A$.

Now, suppose $T_n$ is a {\it fixed} binary string of length $n$. Then, define $t_i$ to be the $i^{th}$ letter of $T_n$, $T_i$ to be the string formed by truncating $T_n$ after the $i\textsuperscript{th}$ letter, and $\phi(T_n)$ to be the number of distinct subsequences in $T_n$. If we let $S_n$ be a {\it random} binary string of length $n$, it was shown in \cite{Flaxman} that when Pr$[s_i=1]=.5$ (that is, when each independently generated letter in $S_n$ is equally likely to be a 0 or a 1), then $E[\phi(S_n)] \sim k(\frac{3}{2})^n$ for a constant $k$. Later, \cite{Collins} improved this result by finding that $E[\phi(S_n)]=2(\frac{3}{2})^n-1$ under the same conditions.

In Section 2, we generalize the second result and find a formula for the expected value of $\phi(S_n)$ when Pr$[s_i=1]=\alpha \in (0,1)$. Since the cases when Pr$[s_i=1]$ is 0 or 1 are trivial, we will then have $E[\phi(S_n)]$ when $\alpha \in [0,1]$. Our method for finding this formula is very different from that used by  \cite{Collins}. We will define a new property of a string---the number of new distinct subsequences--and then use these numbers as the entries in a binary tree. Our formula is then given as a weighted sum of the entries in this tree.  In Section 3 we produce recursions for the expected number of subsequences in two more complicated cases, namely when (i) the string of letters is independently generated in a non-uniform fashion from an arbitrary alphabet; and (ii) the binary string is Markov-dependent.  We also show, using subadditivity arguments, that the expected number of distinct subsequences in the first case above is asymptotic to $c^n$ for some $c$, in the sense that
\[(E[\phi(S_n)])^{1/n}\to c\enspace(n\to\infty).\]
Finally, in Section 4 we indicate some important directions for further investigation.

\section{Main Result}\label{main}
In this section, we let Pr$[s_i=1]=\alpha \in [0,1]$. We first consider the trivial cases, when $\alpha \in \{0,1\}$.

\begin{prop} If $\alpha \in \{0,1\}$, then $\phi(S_n)=n$ for any string $S_n$. \end{prop}
\begin{proof} If $\alpha \in \{0,1\}$, then either $S_n=11...1$ or $S_n=00...0$. In either case, there is exactly one distinct subsequence of each length between 1 and $n$.
\end{proof}

With those cases dispensed with, we will assume for the remainder of this section that $\alpha \in (0,1)$. Before continuing, we need to establish three new definitions.  We recall that $S_n$ is a random variable that equals a fixed string $T_n$ according to a specified probability distribution.

\begin{defn}The \emph{weight} of $T_n$, a fixed binary string of length $n$, is $\phi(T_n) \cdot \text{Pr}[S_n=T_n]$. That is, the weight of $T_n$ is the number of distinct subsequences in $T_n$ times the probability that a random length $n$ string is $T_n$.
\end{defn}

\begin{defn}A \emph{new} subsequence of $T_n$ is a subsequence contained in $T_n$ but not contained in $T_{n-1}$. We will let $\nu(T_n)$ be the number of distinct new subsequences in a string $T_n$.
\end{defn}

\begin{defn} The \emph{new weight} of $T_n$ is the product $\nu(T_n) \cdot \text{Pr}[S_n=T_n]$.
\end{defn}

It will be useful to be able to compute the number of new distinct subsequences in a string; to do so we modify a result from \cite{Elzinga}.

\begin{lemma}[Elzinga, Rahmann, and Wang] \label{ERW} Given $T_n$, let $l$ be the greatest number less than $n$ such that $t_l=t_n$, and if no such number exists, let $l=0$. Then,
\\
$$\nu(T_n)=
\begin{cases}
n &\mbox{if } l=0;
\\
\displaystyle \sum_{i=l}^{n-1} \nu(T_i) &\mbox{if } l>0.
\end{cases}$$
\end{lemma}
\noindent\textit{Proof:} Fix $T_n$ and suppose $l=0$. Then, without loss of generality, assume that $T_n$ consists of $n-1$ 0s followed by a 1. The new subsequences contained in $T_n$ are exactly those which contain a 1. There are $n$ such subsequences: $1, 01, 001,..., \underbrace{00...0}_{n-1}1$, so $\nu(T_n)=n$.
\\
\indent Now suppose $l>0$ and $U_k$ is a new subsequence of length $k$ in $T_n$. We assume that the last letter in $U_k$ is $t_n$ because otherwise $U_k$ is clearly not new. If $U_{k-1} \preceq T_{l-1}$, then we could use $t_l$ to complete $U_k$, so $U_k \preceq T_l$ and $U_k$ would not be new in $T_n$. Conversely, if $U_{k-1} \not\preceq T_{l-1}$, then $U_k$ cannot be completed by $t_l$, nor can it be completed by any other $t_i$ before $t_n$, so $U_k$ is a new subsequence in $T_n$. Therefore, there is one distinct new subsequence in $T_n$ for every distinct new subsequence found in some $T_i$ with $l \le i \le n-1$. Summing up all of those distinct new subsequences gives the number of distinct new subsequences in $T_n$.
{\raggedright\qed}
\\
\\
Now, let $B$ be a binary tree whose entries are binary strings, and let $B_{n,m}$ be the $m\textsuperscript{th}$ entry in the $n\textsuperscript{th}$ row of $B$. The root of $B$ is the empty string, each left child is its parent with a 1 appended, and each right child is its parent with a 0 appended. If we call the first row ``row 0", then row $n$ of this tree contains all length $n$ binary strings. Rows 0-3 of this tree are shown below:

\begin{center}
\begin{tikzpicture}[node/.style={circle, draw=black!0, fill=green!0, thin, minimum size=2mm}, level/.style={sibling distance = 8cm/#1, level distance = 1.5cm},]
\node[node] () {()}
child
{
	node[node] {1}
	child
	{
		node[node]{11}
		child
		{
			node[node]{111}
		}
		child
		{
			node[node]{110}
		}
	}
	child
	{
		node[node] {10}
		child
		{
			node[node]{101}
		}
		child
		{
			node[node]{100}
		}
	}
}
child
{
	node[node] {0}
	child
	{
		node[node]{01}
		child
		{
			node[node]{011}
		}
		child
		{
			node[node]{010}
		}
	}
	child
	{
		node[node]{00}
		child
		{
			node[node]{001}
		}
		child
		{
			node[node]{000}
		}
	}
};
\end{tikzpicture}
\end{center}

Next, we form the binary tree $B'$ with $B'_{n,m}$ denoting the $m\textsuperscript{th}$ entry in the $n\textsuperscript{th}$ row of $B'$. Then, we define each $B'_{n,m}$ to be $\nu(B_{n,m})$ which we can calculate using Lemma 2.5. Finally, for each child $B'_{n,m}$ we assign the edge between it and its parent $B'_{n-1,\lceil\frac{m}{2}\rceil}$ a weight equal to Pr$[S_n=B_{n,m}|S_{n-1}=B_{n-1,\lceil\frac{m}{2}\rceil}]$. Thus we give each edge going to a left child the weight $\alpha$ and each edge going to a right child the weight $1-\alpha$. Rows 0-3 of $B'$ are shown below:
\\
\begin{center}
\begin{tikzpicture}[node/.style={circle, draw=black!0, fill=green!0, thin, minimum size=2mm}, level/.style={sibling distance = 8cm/#1, level distance = 1.5cm},]
\node[node] (1) {0}
child
{
	node[node] {1}
	child
	{
		node[node]{1}
		child
		{
			node[node]{1}
			edge from parent node[left]{$\alpha$}
		}
		child
		{
			node[node]{3}
			edge from parent node[right]{$1-\alpha$}
		}
		edge from parent node[left]{$\alpha$}
	}
	child
	{
		node[node] {2}
		child
		{
			node[node]{3}
			edge from parent node[left]{$\alpha$}
		}
		child
		{
			node[node]{2}
			edge from parent node[right]{$1-\alpha$}
		}
		edge from parent node[right]{$1-\alpha$}
	}
	edge from parent node[left]{$\alpha$}
}
child
{
	node[node] {1}
	child
	{
		node[node]{2}
		child
		{
			node[node]{2}
			edge from parent node[left]{$\alpha$}
		}
		child
		{
			node[node]{3}
			edge from parent node[right]{$1-\alpha$}
		}
		edge from parent node[left]{$\alpha$}
	}
	child
	{
		node[node]{1}
		child
		{
			node[node]{3}
			edge from parent node[left]{$\alpha$}
		}
		child
		{
			node[node]{1}
			edge from parent node[right]{$1-\alpha$}
		}
		edge from parent node[right]{$1-\alpha$}
	}
	edge from parent node[right]{$1-\alpha$}
};
\end{tikzpicture}
\end{center}

It is clear that the value of the root should be 0 and the value of its two children should be 1. Moreover, we can apply Lemma 2.5 to find that each row begins and ends with a 1. To characterize the remaining entries of $B'$ we need two lemmas which together will give us that the portion of each row between the initial and final 1s consists of pairs of identical numbers. The numbers in every other pair are the sums of the parents of those elements, and the numbers in the remaining pairs have the same value as their parents. For instance, the first pair of the third row is a pair of 3s and parents of the elements of this pair are a 1 and a 2 which sum to 3. Then, the second pair of the third row is a pair of 2s, and the parents of the elements of this pair are also 2s.

\begin{lemma}\label{joint} Suppose $n \ge 2$ and $m \equiv 2$ (mod 4). Then, $B'_{n,m}=B'_{n,m+1}=B'_{n-1,\frac{m}{2}}+B'_{n-1,\frac{m}{2}+1}$. \end{lemma}
\begin{proof}Given these restrictions on $n$ and $m$, both $B_{n,m}$ and $B_{n,m+1}$ are grandchildren of the same string $T_{n-2}$. Then, $B_{n,m}=T_{n-2}10$ and $B_{n,m+1}=T_{n-2}01$. First, consider the case when $T_{n-2}$ consists of only 0s or only 1s, and without loss of generality, assume it consists of only 0s. Using Lemma 2.5 we get the following equalities:
\begin{align*} \nu(T_{n-2}10)&=\nu(T_{n-2})+\nu(T_{n-2}1)=1+(n-1)=n; \\
\nu(T_{n-2}01)&=n; \\
\nu(T_{n-2}0)+\nu(T_{n-2}1)&=1+(n-1)=n,
\end{align*}
so the lemma is proved in this case. Otherwise, there exist $k,l >0$ such that $k$ is the greatest integer with $t_k=0$ and $l$ is the greatest integer with $t_l=1$. Then, the following hold, again by Lemma 2.5:
\begin{align*} \nu(T_{n-2}0)&=\displaystyle \sum_{i=k}^{n-2} \nu(T_{i}); \\
\nu(T_{n-2}1)&=\displaystyle \sum_{i=l}^{n-2} \nu(T_{i}); \\
\nu(T_{n-2}01)&=\displaystyle \sum_{i=l}^{n-2} \nu(T_{i})+\nu(T_{n-2}0)=\nu(T_{n-2}1)+\nu(T_{n-2}0); \\
\nu(T_{n-2}10)&=\displaystyle \sum_{i=k}^{n-2} \nu(T_{i})+\nu(T_{n-2}1)=\nu(T_{n-2}0)+\nu(T_{n-2}1).
\end{align*}
Since $T_{n-2}1=B_{n-1,\frac{m}{2}}$ and $T_{n-2}0=B_{n-1,\frac{m}{2}+1}$, this completes the proof.
\end{proof}
\begin{lemma}\label{single} Suppose $n \ge 2$, $m \equiv 0$ (mod 4), and $m \neq 2^n$. Then $B'_{n,m}=B'_{n,m+1}=B'_{n-1,\frac{m}{2}}=B'_{n-1,\frac{m}{2}+1}$ \end{lemma}
\begin{proof}
We will proceed by induction on $n$. As a base case, note that when $n=2$, the hypotheses of Lemma 2.7 are never satisfied, so it is true.

Now, suppose Lemma 2.7 holds for $n<p$, and consider $B'_{p,m}$ where $m$ satisfies the hypotheses of the lemma. Since $m \equiv 0$ (mod 4), it follows that $B_{p,m}=B_{p-1,\frac{m}{2}}0$, and $B_{p-1,\frac{m}{2}}$ also ends in 0. Then, $m+1 \equiv 1$ (mod 4), so $B_{p,m+1}=B_{p-1,\frac{m}{2}+1}1$, and $B_{p-1,\frac{m}{2}+1}$ also ends in 1. Therefore, by Lemma 2.5, $B'_{p,m}=B'_{p-1,\frac{m}{2}}$ and $B'_{p,m+1}=B'_{p-1,\frac{m}{2}+1}$. Now, $B'_{p-1,\frac{m}{2}}$ and $B'_{p-1,\frac{m}{2}+1}$ are consecutive elements and $\frac{m}{2}$ is even. If $\frac{m}{2} \equiv 2$ (mod 4), then $B'_{p-1,\frac{m}{2}}=B'_{p-1,\frac{m}{2}+1}$ by Lemma 2.6, and if $\frac{m}{2} \equiv 0$ (mod 4), then $B'_{p-1,\frac{m}{2}}=B'_{p-1,\frac{m}{2}+1}$ by the induction hypothesis. In either case, the proof is finished by induction.
\end{proof}

Now, the original question about distinct subsequences can reinterpreted as a question about the tree $B'$. In particular, if we find the path from each node $B'_{n,m}$ to the root and call the product of the weights of all the edges on that path $p_{n,m}$, we find that $p_{n,m}=\text{Pr}[S_n=B_{n,m}]$, and that
\begin{equation} \label{crux}
E[\phi(S_n)]= E\bigg[\displaystyle \sum_{i=1}^n \nu(S_i)\bigg]= \displaystyle \sum_{i=1}^n E[\nu(S_i)] =  \displaystyle \sum_{i=1}^n \displaystyle \sum_{j=1}^{2^i} B'_{i,j}\cdot p_{i,j}
\end{equation}
The first equality comes from the fact that each subsequence in $S_n$ is new exactly once, the second equality holds by linearity of expectation, and the third equality rewrites $E[\nu(S_i)]$ using the definition of expectation.

Now, recall the definition of new weight and note that the combined new weight of all the strings in row $i$ of $B$ is given by $\displaystyle \sum_{j=1}^{2^i} B'_{i,j}\cdot p_{i,j}$. With $i$ fixed, we define the quantity $a_i$ to be the total new weight of left children, i.e., strings ending in 1, in row $i$ of $B$ and $b_i$ to be the total new weight of right children, i.e., strings ending in 0, in row $i$ of $B$. We now find two simultaneous recurrence relations that describe $a_i$ and $b_i$.

\begin{lemma} The sequences $\{a_i\}$ and $\{b_i\}$ satisfy the following recurrence relations:  $$a_i=a_{i-1}+\alpha b_{i-1}; \quad b_i=b_{i-1}+(1-\alpha)a_{i-1}.$$\end{lemma}

\begin{proof}
Consider the left children in row $i$ of $B'$. First consider the left children whose parents are also left children. Each of these has the same value as its parent by Lemma 2.7, so the combined new weight of all of them is $\alpha \cdot a_{i-1}$. Now consider the left children whose parents are right children. By Lemma 2.6, each of these has a value which is the sum of the values of its parent, a right child, and this parent's sibling, a left child. In this way, each right child in row $i-1$ contributes its new weight times $\alpha$ to its left child in row $i-1$. Meanwhile, each left child in row $i-1$ contributes to the left child of its sibling its new weight times $1-\alpha$ since its path to the root contains one fewer edges labelled $1-\alpha$ than the path from the row $i$ left child to the root, but both paths contain the same number of edges labelled $\alpha$. Thus we get:
$$a_i=\alpha  a_{i-1} +\alpha  b_{i-1} + (1-\alpha)a_{i-1}=a_{i-1}+\alpha  b_{i-1}$$
The second recurrence relation follows by the same argument. The right children of row $i-1$ contribute their new weight times $1-\alpha$ to their own right children, and also contribute their new weight times $\alpha$ to the right children of their siblings. Meanwhile, the left children of row $i-1$ contribute their new weight times $1-\alpha$ to their right children, and so we get:
$$b_i=b_{i-1}+(1-\alpha)a_{i-1},$$
which completes the proof.\end{proof}

Now, we solve for $a_i$ as follows:
\begin{align*} \alpha b_{i-1}&=a_i-a_{i-1} \\
\alpha(1-\alpha)a_{i-1}&=\alpha b_i-\alpha b_{i-1} \\
\alpha(1-\alpha)a_{i-1}&=a_{i+1}-a_i -(a_i-a_{i-1}) \\
a_{i+1}&=2a_i-(1-\alpha(1-\alpha))a_{i-1} \end{align*}
The quadratic $x^2=2x-(1-\alpha(1-\alpha))$ has two real solutions: $\Big(1+\sqrt{\alpha(1-\alpha)}\Big)$ and $\Big(1-\sqrt{\alpha(1-\alpha)}\Big)$, so $a_i=c_1\Big(1+\sqrt{\alpha(1-\alpha)}\Big)^i+c_2\Big(1-\sqrt{\alpha(1-\alpha)}\Big)^i$ where $c_1$ and $c_2$ are constants. Inspecting the tree $B'$ gives that $a_1=\alpha$ and $a_2=2\alpha-\alpha^2$, and it is straightforward to verify that the following is an explicit formula of the correct form satisfying the initial conditions:
$$a_i=\frac{1}{2}\Big(\Big(\alpha-\sqrt{\alpha(1-\alpha)}\Big)\Big(1-\sqrt{\alpha(1-\alpha)}\Big)^{i-1}+\Big(\alpha+\sqrt{\alpha(1-\alpha)}\Big)\Big(1+\sqrt{\alpha(1-\alpha)}\Big)^{i-1}\Big)$$
To find an explicit formula for $b_i$, we simply note that if we substitute $a_i$ for $b_i$, $b_i$ for $a_i$, and $\alpha$ for $1-\alpha$, we obtain the recurrence that we just solved. Thus, making the reverse substitutions, we get that
$$b_i=\frac{1}{2}\Big(\Big(1-\alpha-\sqrt{\alpha(1-\alpha)}\Big)\Big(1-\sqrt{\alpha(1-\alpha)}\Big)^{i-1}+\Big(1-\alpha+\sqrt{\alpha(1-\alpha)}\Big)\Big(1+\sqrt{\alpha(1-\alpha)}\Big)^{i-1}\Big)$$
and combining these two expressions gives the total new weight in row $i$ as
$$a_i+b_i=\frac{1}{2}\Big(\Big(1-2\sqrt{\alpha(1-\alpha)}\Big)\Big(1-\sqrt{\alpha(1-\alpha)}\Big)^{i-1}+\Big(1+2\sqrt{\alpha(1-\alpha)}\Big)\Big(1+\sqrt{\alpha(1-\alpha)}\Big)^{i-1}\Big)$$
As suggested by (\ref{crux}), the final step will be to find the sum $\displaystyle \sum_{i=0}^n (a_i +b_i)$. This follows from the geometric sum formula, and we get

\resizebox{\hsize}{!}{$\displaystyle \sum_{i=0}^n (a_i +b_i)=\frac{\Big(\Big(1-2\sqrt{\alpha(1-\alpha)}\Big)\Big(1-\Big(1-\sqrt{\alpha(1-\alpha)}\Big)^n\Big)+\Big(1+2\sqrt{\alpha(1-\alpha)}\Big)\Big(\Big(1+\sqrt{\alpha(1-\alpha)}\Big)^n-1\Big)}{2{\sqrt{\alpha(1-\alpha)}}}$}

We have now derived the main theorem of this section.

\begin{thm} Suppose Pr$[s_i=1]=\alpha \in [0,1]$ for all $1 \le i \le n$. Then we have

\resizebox{\hsize}{!}{$\phi(S_n)=
\begin{cases}
n &\mbox{if } \alpha=0,1,
\\
\frac{\big(1-2\sqrt{\alpha(1-\alpha)}\big)\big(1-\big(1-\sqrt{\alpha(1-\alpha)}\big)^n\big)+\big(1+2\sqrt{\alpha(1-\alpha)}\big)\big(\big(1+\sqrt{\alpha(1-\alpha)}\big)^n-1\big)}{2{\sqrt{\alpha(1-\alpha)}}} &\mbox{if } \alpha \neq 0,1.
\end{cases}
$} \end{thm}
Since this formula is rather unwieldy for $\alpha \in (0,1)$, we also give the following asymptotic result.

\begin{cor} Suppose Pr$[s_i=1]=\alpha \in (0,1)$ for all $1 < i < n$. Then there exists a constant $k$ such that
$$\phi(S_n) \sim k \big(1+\sqrt{\alpha(1-\alpha)}\big)^n.$$\end{cor}
\begin{proof}
We take the limit of the quantity in Theorem 2.9. Since $\big(1-\sqrt{\alpha(1-\alpha)}\big)<1$, it follows that $\displaystyle \lim_{n \rightarrow \infty} \big(1-\sqrt{\alpha(1-\alpha)}\big)^n =0$. Therefore
$$\displaystyle \lim_{n \rightarrow \infty} \frac{\phi(S_n)}{\big(1+\sqrt{\alpha(1-\alpha)}\big)^n}\cdot \frac{2\sqrt{\alpha(1-\alpha)}}{\big(1+2\sqrt{\alpha(1-\alpha)}\big)}=1,$$
as asserted.\end{proof}
\section{Variations: Larger Alphabets, Markov Chains, and Growth Rates}
In the previous section, we looked at strings on a binary alphabet generated by a random process in which the probability that any given element was 1 was fixed at $\alpha$. In this section, we generalize this in two ways. First, we consider strings on the alphabet $\{1,2,...,d\}=[d]$ where each letter is independently $j$ with probability $\alpha_j$ for all $j \in [d]$. After that, we return to binary strings, but this time they will be generated according to a two-state Markov chain; in particular, if a letter follows a 1, then it is 1 with probability $\alpha$, but if it follows a 0, then it is 1 with probability $\beta$. In both these cases, we will find recurrences for the expected new weight contributed by the $n\textsuperscript{th}$ letter, which will lead to explicit matrix equations for that expected new weight. Unfortunately, we will not be able to find a closed-form formula for the total expected number of subsequences like we did in Section \ref{main}.
\subsection{A Larger Alphabet}
In this section, we consider strings on the alphabet $[d]$. In Section \ref{main}, $T_n$ was a fixed length-$n$ string on the alphabet $\{0,1\}$; here we let $T_n$ be a fixed length-$n$ string on the alphabet $[d]$. Similarly, $S_n$ is now a random length-$n$ string on the alphabet $[d]$ where, independently, Pr$[s_i=j] = \alpha_j$ for all $i \in [n] ,j \in [d]$ (note that $\sum_{j=1}^d \alpha_j = 1$).

We begin by stating a generalization of Lemma \ref{ERW}. The first paragraph of the proof is the same as in the proof of the original lemma, but is included for completeness.
\begin{lemma}\label{genERW}
Given $T_n$, let $l$ be the greatest number less than $n$ such that $t_l=t_n$, and if no such number exists, let $l=0$. Then,
\\
$$\nu(T_n)=
\begin{cases}
\displaystyle\sum_{i=1}^{n-1} \nu(T_i) + 1 &\mbox{if } l=0,
\\
\displaystyle \sum_{i=l}^{n-1} \nu(T_i) &\mbox{if } l>0.
\end{cases}$$
\end{lemma}

\begin{proof}Suppose $l>0$ and $U_k$ is a subsequence of length $k$ in $T_n$. We assume that the last letter in $U_k$ is $t_n$ because otherwise $U_k$ is clearly not new. If $U_{k-1} \preceq T_{l-1}$, then we could use $t_l$ to complete $U_k$, so $U_k \preceq T_l$ and $U_k$ would not be new in $T_n$. Conversely, if $U_{k-1} \not\preceq T_{l-1}$, then $U_k$ cannot be completed by $t_l$, nor can it be completed by any other $t_i$ before $t_n$, so $U_k$ is a new subsequence in $T_n$. Therefore, there is one distinct new subsequence in $T_n$ for every distinct new subsequence found in some $T_i$ with $l \le i \le n-1$. Counting up all of those distinct new subsequences gives the number of distinct new subsequences in $T_n$.

Now suppose $l=0$ and $U_k$ is a subsequence of length $k$ in $T_n$. As before, we can assume that the last letter of $U_k$ is $t_n$, but this time every subsequence of length ending in $t_n$ is new in $T_n$. Therefore, there is nearly a bijection between the subsequence which appeared by $T_{n-1}$ and the ones which are new in $T_n$ given by mapping a subsequence appearing by $T_{n-1}$ to itself with $t_n$ appended. This is not exactly a bijection because the single-element sequence $t_n$ is a new subsequence in $T_n$ even though the empty set is not counted as a subsequence in $T_{n-1}$. Therefore, the number of new subsequences is the sum of the number of subsequences which have appeared previously, plus one.
\end{proof}

Just like in the previous section, we are interested in the expected new weight of $S_n$. As before, we find it useful to refer to a tree $B$, but in this case it is a $d$-ary tree where the root is labelled with the empty string, and the $j\textsuperscript{th}$ child of a node is labelled with the parent's label with $j$ appended. The following figure shows rows 0-2 and part of row 3 of $B$ when $d=3$.

\begin{center}
\begin{tikzpicture}[every tree node/.style={draw=black!0,circle},sibling distance=.25cm]
\matrix{
\Tree
 [ .$()$
    [ .3
    	[ .33 333 332 331 ]
	[ .32 323 322 321 ]
	[ .31 ]
   ]
    [ .2 23 22 21 ]
    [ .1 13 12 11 ]
  ]

\\};
\end{tikzpicture}
\end{center}

Again like in the previous section, we will also use the tree $B'$ where each node $T_n$ of $B$ has been replaced by $\nu(T_n)$.

\begin{center}
\begin{tikzpicture}[every tree node/.style={draw=black!0,circle},sibling distance=.25cm]
\matrix{
\Tree
 [ .0
    [ .1
    	[ .1 1 3 3 ]
	[ .2 3 2 4 ]
	[ .2 ]
   ]
    [ .1 2 1 2 ]
    [ .1 2 2 1 ]
  ]

\\};
\end{tikzpicture}
\end{center}

We now need to generalize Lemmas \ref{joint} and \ref{single}.

\begin{defn} A $(j,k)$-grandchild is a string whose final two letters are $j$ and $k$; equivalently, a $(j,k)$-grandchild is a string which is formed by appending $jk$ to its grandparent.
\end{defn}

\begin{lemma}\label{genjoint} Suppose $n \ge 2$ and $T_n$ is a $(j,k)$-grandchild with $j \neq k$ whose grandparent is $T_{n-2}$; then $\nu(T_n)=\nu(T_{n-2} j)+\nu(T_{n-2} k). $\end{lemma}

\begin{proof}As in Lemma \ref{genERW}, let $l_j$ and $l_k$ be the greatest numbers less than or equal to $n-2$ with $t_{l_j}=j$ and $t_{l_k}=k$ (or 0 if no such $t$ exist). Suppose that $l_k \neq 0$. By Lemma \ref{genERW}, we have that
\[\nu(T_n)=\sum_{i=l_k}^{n-1} \nu(T_i) = \nu(T_{n-2}j) + \sum_{i=l_k}^{n-2} = \nu(T_{n-2}j) + \nu(T_{n-2}k).\] Otherwise, $l_k = 0$ and by Lemma 3.1, we have that
\[\nu(T_n)=\sum_{i=1}^{n-1} \nu(T_i) + 1 = \nu(T_{n-2}j) + \sum_{i=1}^{n-2} \nu(T_i) + 1 = \nu(T_{n-2}j) + \nu(T_{n-2}k).\]
This completes the proof.\end{proof}

\begin{lemma}\label{gensingle} Suppose $n \ge 2$ and $T_n$ is a $(j,j)$-grandchild whose grandparent is $T_{n-2}$. Then, $\nu(T_n) = \nu(T_{n-2}j)$.\end{lemma}
\begin{proof}Since $T_n=T_{n-2}jj$ and $T_{n-1}=T_{n-2}j$, the statement follows immediately from Lemma \ref{genERW}.
\end{proof}

We want to be able to calculate the total new weight in each row of the tree $B'$. As in Section \ref{main} it will be convenient to break up that new weight by the final letter of the string it comes from. For each $n \in \mathbb{Z}^+$ and $j \in [d]$, let $a_{j,n}$ be the total new weight of the length-$n$ strings ending in $j$. Using Lemmas \ref{genjoint} and \ref{gensingle} we find that a typical element $T_{n-2}j$ contributes its weight times $\alpha_k$ to $T_{n-2}jk$ (for all $k \in [d]$) and also contributes its weight times $\alpha_k$ to $T_{n-2}kj$ for all $k \in [d] \setminus \{j\}$. Therefore, we obtain the recurrences
\[a_{j,n}=\sum_{k=1}^d \alpha_j a_{k,n-1} + \sum_{k \neq j} \alpha_k a_{j,n-1} = a_{j,n-1} + \sum_{k \neq j} \alpha_j a_{k,n-1}.\]

Using these $d$ recursions and the fact that the $a_{j,1}=\alpha_j$ for all $j$, we find that the vector $[a_{1,n},a_{2,n},...,a_{d,n}]^T$ is given by the matrix equation:
\[\begin{bmatrix}
a_{1,n}
\\
a_{2,n}
\\
a_{3,n}
\\
\vdots
\\
a_{d,n}
\end{bmatrix}
=
\begin{bmatrix}
1 & \alpha_1 & \alpha_1 & \dots & \alpha_1
\\
\alpha_2 & 1 & \alpha_2 & \dots & \alpha_2
\\
\alpha_3 & \alpha_3 & 1 & \dots & a_3
\\
 & & & \ddots
\\
\alpha_d & \alpha_d & \alpha_d & \dots & 1
\end{bmatrix}^{n-1}
\begin{bmatrix}
\alpha_1
\\
\alpha_2
\\
\alpha_3
\\
\vdots
\\
\alpha_d
\end{bmatrix},\]
and therefore the total new weight in row $n$ is
\[\begin{bmatrix}
1 & 1 & 1 & \dots & 1
\end{bmatrix}
\begin{bmatrix}
1 & \alpha_1 & \alpha_1 & \dots & \alpha_1
\\
\alpha_2 & 1 & \alpha_2 & \dots & \alpha_2
\\
\alpha_3 & \alpha_3 & 1 & \dots & a_3
\\
 & & & \ddots
\\
\alpha_d & \alpha_d & \alpha_d & \dots & 1
\end{bmatrix}^{n-1}
\begin{bmatrix}
\alpha_1
\\
\alpha_2
\\
\alpha_3
\\
\vdots
\\
\alpha_d
\end{bmatrix}.\]
Therefore, we have a way to compute the expected value of $\phi(S_n)$ in this general alphabet case, as expressed in the following theorem.
\begin{thm} Let $S_n$ be a random length-$n$ string on the alphabet $[d]$ where Pr$[s_i=j]=\alpha_j$ for all $i,j$. Then,
\[E[\phi(S_n)]= \begin{bmatrix}
1 & 1 & 1 & \dots & 1
\end{bmatrix}
\left(\sum_{i=0}^{n-1}
\begin{bmatrix}
1 & \alpha_1 & \alpha_1 & \dots & \alpha_1
\\
\alpha_2 & 1 & \alpha_2 & \dots & \alpha_2
\\
\alpha_3 & \alpha_3 & 1 & \dots & a_3
\\
 & & & \ddots
\\
\alpha_d & \alpha_d & \alpha_d & \dots & 1
\end{bmatrix}^{i}
\right)
\begin{bmatrix}
\alpha_1
\\
\alpha_2
\\
\alpha_3
\\
\vdots
\\
\alpha_d
\end{bmatrix}.
\]
\end{thm}

\subsection{Strings from Markov Processes}
We now return to binary strings, but now the probability of seeing a particular letter will depend on the letter before (we assume that strings are generated from left to right). In the random string $S_n$, Pr$[s_i=1 | s_{i-1}=1] = \alpha$ and Pr$[s_i = 1 | s_{i-1}=0]= \beta$. Of course, we will need some other rule for Pr$[s_1=1]$; one logical choice is to take Pr$[s_1=1]=\gamma$ where $\gamma$ is the steady-state probability of a 1 occurring, which in this case gives $\gamma=\frac{\beta}{1+\beta-\alpha}$. Unlike in the previous subsection, we don't need any new lemmas to discuss this case. Instead, the key will be to categorize the new weight in each row by the last \emph{two} letters of the strings which contribute it, rather than just by the last single letter.

To that end, let $a_n$ be the total new weight of $n$-letter strings ending in 11, let $b_n$ be the total new weight of $n$-letter strings ending in 10, let $c_n$ be the total new weight of $n$ letter strings ending in 01, and let $d_n$ be the total new weight of $n$-letter strings ending in 00. We apply Lemmas \ref{joint} and \ref{single} in much the same manner that we did in Section \ref{main} to find the recurrences:
\[a_{n+1}=\alpha(a_n+c_n);\]
\[b_{n+1}=(1-\alpha)(a_n+c_n)+\alpha b_n +\frac{\beta(1-\alpha)}{1-\beta} d_n;\]
\[c_{n+1}=\beta(b_n+d_n)+(1-\beta)c_n+\frac{(1-\alpha)\beta}{\alpha} a_n;\]
\[d_{n+1}=(1-\beta)(b_n+d_n).\]
Again, these recurrences lead to a matrix equations
\[\begin{bmatrix}
a_n
\\
b_n
\\
c_n
\\
d_n
\end{bmatrix}
=
\begin{bmatrix}
\alpha & 0 & \alpha & 0
\\
1-\alpha & \alpha & 1-\alpha & \frac{\beta(1-\alpha)}{1-\beta}
\\
\frac{(1-\alpha)\beta}{\alpha} & \beta & 1-\beta & \beta
\\
0 & 1-\beta & 0 & 1- \beta
\end{bmatrix}^{n-1}
\begin{bmatrix}
a_1
\\
b_1
\\
c_1
\\
d_1
\end{bmatrix},
\] and

\[E[\phi(S_n)]= \begin{bmatrix}
1 & 1 & 1 & \dots & 1
\end{bmatrix}
\left(\sum_{i=0}^{n-1}
\begin{bmatrix}
\alpha & 0 & \alpha & 0
\\
1-\alpha & \alpha & 1-\alpha & \frac{\beta(1-\alpha)}{1-\beta}
\\
\frac{(1-\alpha)\beta}{\alpha} & \beta & 1-\beta & \beta
\\
0 & 1-\beta & 0 & 1- \beta
\end{bmatrix}^{i-1}
\right)
\begin{bmatrix}
a_1
\\
b_1
\\
c_1
\\
d_1
\end{bmatrix}.
\]
While we could define Pr$[s_1=1]=\gamma$ (recalling that $\gamma = \frac{\beta}{1+\beta-\alpha}$) it will make our formula work out more nicely if we pretend that there exists a letter $s_0$ which does not add to any subsequences but which determines Pr$[s_1=1]$. If we take Pr$[s_0 = 1]=\gamma$, then we have $a_1=\gamma\alpha, b_1 = \gamma(1-\alpha), c_1 = (1-\gamma)\beta, d_1 = (1-\gamma)(1-\beta)$, and so the definition of the formula is complete.
\subsection{Exponential Growth via Fekete's Lemma}  In this subsection, we exhibit the fact that in the case of general alphabets, the expected number of distinct sequences is ``around" $c^n$, mirroring  the result in Corollary 2.10.  This fact is hardly surprising, but raises other questions, namely as to whether the ``true" numbers contain, additionally, polynomial factors as do several Stanley-Wilf limits in the theory of pattern avoidance (note that there are no polynomial factors in Corollary 2.10).

 Also, in general the existence of limits is not automatic, as seen by the following example:  Assume that $n$ balls are independently thrown into an infinite array of boxes so that box $j$ is hit with probability $1/2^j$ for $j=1,2,\ldots$.  Let $\pi_n$ be the probability that the largest occupied box has a single ball in it.  Then, as seen in \cite{athreya}, $\lim_{n\to\infty} \pi_n$ does not exist, and $\lim\sup_{n\to\infty}\pi_n$ and $\lim\inf_{n\to\infty}\pi_n$ differ in the fourth decimal place! Such behavior does not however occur in our context, as we prove next.
\begin{thm}  Let $s_1,s_2,\ldots $ be a sequence of independent and identically distributed random variables with $Pr(s_1=j)=\alpha_j, j=1,2,\ldots,d$, and $\sum_j\alpha_j=1$.  Set $\alpha=(\alpha_1,\ldots,\alpha_d)$.  Let $\phi(S_n)$ and $\phi(S_{n+1,n+m})$ be the number of distinct subsequences in $S_n=(s_1,\ldots,s_n)$ and $(s_{n+1},\ldots,s_{n+m})$.  Let $\psi(n)=E(\phi(S_n))$.  Then there exists $c=c_{d,\alpha}\ge 1$ such that
\[\psi(n)^{1/n}\to c; n\to\infty,\] where $c=1$ iff $d\ge 1$ and $\max_j \alpha_j=1$.
\end{thm}
\begin{proof} As in Arratia's paper \cite{arratia} on the existence of Stanley-Wilf limits, we employ subadditivity arguments and Fekete's lemma.  Assume without loss of generality that $m\le n$.  Let $\eta$ be a distinct subsequence of $S_{m+n}$, and consider the first lexicographic occurrence of $\eta$, say $\eta_f$.  Then $\eta_f\vert_{S_n}=\eta_{f_1}$ and $\eta_f\vert_{(s_{n+1},\ldots,s_{n+m})}=\eta_{f_2}$ are a pair of subsequences of $(s_1,\ldots,s_n)$ and $(s_{n+1},\ldots,s_{n+m})$.  Moreover, the map
\[\eta_f\longrightarrow(\eta_{f_1},\eta_{f_2})\] is one-to-one (note that one of the components $\eta_{f_1},\eta_{f_2}$ may be empty).  Thus
\[S_{n+m}\le S_nS_{n+1,n+m},\]
and thus, by independence we get
\[\psi(n+m)\le\psi(n)\psi(n+1,n+m).\]Since $m\le n$, we conclude that
\[\psi(n+m)\le\psi(n)\psi(m).\]
In other words, $\xi(n)=\log \psi(n)$ satisfies the subadditivity condition
\[\xi(n+m)\le \xi(n)+\xi(m),\] and Fekete's lemma yields the conclusion that
\[\frac{\xi(n)}{n}\to \ell=\inf_{n\ge1}\frac{\xi(n)}{n}.\]
Clearly $\ell\in[0,\log d]$.
We thus get
\[\frac{\log \psi(n)}{n}=\log [\psi(n)]^{1/n}\to \ell,\]
and so
\[\psi(n)^{1/n}\to e^\ell:=c,\]
where $c\in[1,d]$.  Clearly $c=1$ for any $d$ if $\alpha_1=1$.  We need to show that this is the only case when this occurs.  By Theorem 2.9, we know that $c>1$ if $d=2$ and $\max(\alpha_1,\alpha_2)\ne1$.  Using a monotonicity argument (for larger size alphabets, we replace all the letters $2,3,\ldots,d$ by 2), it is easy to see that $c>1$ if $d\ge3$ and $\max_j(\alpha_j)<1$.  This concludes the proof.
\end{proof}
\section{Discussion and Open Questions}  In this section we list and briefly discuss some questions that seem to be quite non-trivial.

(a) One of the central questions in the Permutation Patterns community is that of packing patterns and words in larger ensembles; see, e.g., \cite{burstein}.  In a similar vein, we have the question of superpatterns, i.e., strings that contain all the patterns or words of a smaller size; see, e.g., \cite{yonah}.  A distinguished question in this area is the one posed by Alon, who conjectured (see \cite{yonah}) that a random permutation on $[n]=\left[\frac{k^2}{4}(1+o(1))\right]$ contains all the permutations of length $k$ with probability asymptotic to 1 as $n\to\infty$.  In the present context, a similar question might be:  What is the largest $k$ so that each element of $\{0,1\}^k$ appears as a subsequence of a binary random string with high probability?

(b) The basic question studied in this paper appears to not have been considered in the context of permutations; i.e., one might ask: What is the expected number of distinct patterns present in a random permutation on $[n]$?

(c) Computation of the rates of exponential growth in Theorem 3.6 would, of course, be of interest as would be, alternatively, a solution of the recurrences in Sections 3.1 and 3.2.  Also, estimation of the width of the intervals of concentration of the number of distinct subsequences, around their expected values, would add significantly to our understanding of the situation.

(d) An intriguing question (which leads to a wide area for further investigation) is the following.  In the baseline case of binary equiprobable letter generation, we have that
$E(\phi(S_n))\sim2(1.5)^n$, which implies that the {\it average} number of occurrence of a subsequence is $\frac{1}{2}{2^n}/{(1.5)^n}=\frac{1}{2}(4/3)^n$.  Now a subsequence such as $1$ occurs ``just" around $n/2$ times, and the sequence $11\ldots1$ with $n/2$ ones occurs an average of ${{n}\choose{n/2}}\cdot\frac{1}{2^{n/2}}$ times, which simplifies, via Stirling's formula, to around $\sqrt{2}^n$, ignoring constants and polynomial factors.  The same is true of any sequence of length $n/2$;  it is, on average, over-represented.  We might ask, however, what length sequences occur more-or-less an average number $(1.33)^n$ of times.  We can parametrize by setting $k=xn$ and equating the expected number of occurrences of a $k$-long sequence to $(1.33)^n$.  We seek, in other words, the solution to the equation
\[{{n}\choose{xn}}\frac{1}{2^{xn}}=(1.33)^n.\]
Ignoring non-exponential terms and employing Stirling's approximation, the above reduces to
\[2^xx^x(1-x)^{1-x}=0.75,\] which, via Wolfram Alpha, yields the solutions $x=.123\ldots$ and $x=.570\ldots$!   In a similar fashion we see that the expected number of occurrences of a sequence of length $(0.7729\ldots)n$ or longer is smaller than one.  Does this suggest that the solution to the Alon-like question stated in (a) above might be $k=(0.7729\ldots)(1+o(1))n$?

\nocite{*}

\bibliographystyle{alpha}


The Randic index and the diameter of graphs

Abstract: The {\it Randić index} $R(G)$ of a graph $G$ is defined as the sum of 1/\sqrt{d_ud_v} over all edges $uv$ of $G$, where $d_u$ and $d_v$ are the degrees of vertices $u$ and $v,$ respectively. Let $D(G)$ be the diameter of $G$ when $G$ is connected. Aouchiche-Hansen-Zheng conjectured that among all connected graphs $G$ on $n$ vertices the path $P_n$ achieves the minimum values for both $R(G)/D(G)$ and $R(G)- D(G)$. We prove this conjecture completely. In fact, we prove a stronger theorem: If $G$ is a connected graph, then $R(G)-(1/2)D(G)\geq \sqrt{2}-1$, with equality if and only if $G$ is a path with at least three vertices.

\section{Introduction}

In 1975, the chemist Milan Randi\'c \cite{Randic} proposed a
topological index $R$ under the name "branching index", suitable
for measuring the extent of branching of the carbon-atom skeleton
of saturated hydrocarbons. The branching index was renamed the
molecular connectivity index and is often referred to as the Randi\'c
index.

There is a good correlation between the Randi\'c index and several
physico-chemical properties of alkanes: boiling points, enthalpies
of formation,  chromatographic retention times, etc \cite{Hall, Kier1, Kier2}.

The {\it Randi\'c index} $R(G)$ of a graph $G=(V,E)$ is defined as
follows:
$$R(G)=\sum_{uv\in E} \frac{1}{\sqrt{d_u d_v}}.$$
Here $d_u$ and $d_v$ are the degrees of vertices $u$ and $v$, respectively.

From a mathematical point of view, the first question to be asked
is what are the minimum and maximum values of Randi\'c index in  various
classes of graphs, and which graphs in these classes of
graphs have an extremal (minimum or maximum) Randi\'c index.
Erd\H{o}s and Bollob\'as \cite{Bollobas} first considered such
problems. They proved that the star minimizes the  Randi\' c
index among all the graphs without isolated vertices on fixed
number of vertices. After that a lot of extremal results on the
Randi\'c index were published.

It turns out that the Randi\'c index is also related to some typical
graph parameters such as:  diameter, radius, average distance,
girth, chromatic number, and eigenvalues of the adjacent matrices
 \cite{Aroujo1,Aroujo2,Li1}. Some conjectures on them are still
open \cite{Fajtlowicz, Aouchiche, Li2}.

Aouchiche-Hansen-Zheng \cite{Aouchiche} posed the following conjecture
on the diameter and the Randi\'c index.

\begin{conjecture}\label{cj}
If $G$ is a connected graph  of order $n\geq 3$,
then  the Randi\'c index $R(G)$ and the diameter $D(G)$ satisfy
$$R(G)-D(G)\geq \sqrt{2}-\frac{n+1}{2}$$ and
$$\frac{R(G)}{D(G)}\geq \frac{n-3+2\sqrt{2}}{2n-2},$$
with equalities if and only if $G \cong P_n.$
\end{conjecture}

Li and Shi \cite{lishi} proved this conjecture in  some special cases.
Namely, if $G$ is  a connected graph of order $n$ with minimum
degree at least $5$, then $$R(G)-D(G)\geq  \sqrt{2}-\frac{n+1}{2}.$$
If $\delta(G)\geq \frac{n}{5}$, then $$\frac{R(G)}{D(G)}\geq \frac{n-3+2\sqrt{2}}{2n-2}.$$

In this paper we settle the conjecture completely.
In fact, we prove the following stronger theorem.

\begin{theorem}\label{main}
 If $G$ is a connected graph with at least three vertices,
then we have
$$R(G)-\frac{1}{2}D(G)\geq \sqrt{2}-1.$$
Equality holds if and only if $G\cong P_n$ for $n\geq 3$.
\end{theorem}

\begin{corollary}
If $G$ is a connected graph  of order $n\geq 3$,
then  the Randi\'c index $R(G)$ and the diameter $D(G)$ satisfy
$$R(G)-D(G)\geq \sqrt{2}-\frac{n+1}{2}$$ and
$$\frac{R(G)}{D(G)}\geq \frac{n-3+2\sqrt{2}}{2n-2},$$
with equalities if and only if $G \cong P_n.$
\end{corollary}
\noindent
{\bf Proof.}
Noticing that $D(G)\leq n-1$, we have

$$R(G)-D(G)=R(G)-\frac{D(G)}{2}-\frac{D(G)}{2} \geq
\sqrt{2}-1-\frac{n-1}{2}=\sqrt{2}-\frac{n+1}{2}$$

and

$$R(G)-\frac{D(G)}{2}\geq \sqrt{2}-1 \Rightarrow
\frac{R(G)}{D(G)}\geq \frac{1}{2}+\frac{\sqrt{2}-1}{D(G)}\geq
\frac{n-3+2\sqrt{2}}{2n-2}.$$

\hfill $\square$

The paper is organized as follows. In section 2, we prove several
useful lemmas. Our main idea is to capture the change of
the Randi\'c index when we simplify a graph.
The proof of the main theorem is presented in section 3.

\section{Lemmas on vertex deletion and edge deletion}

For any vertex $v$, let $\Gamma(v)$ denote the set of all neighbors of $v$ and
$\Gamma^*(v)$ denote the set of all  non-leaf neighbors of $v,$
i. e.,
$$\Gamma(v)=\{u \colon uv\in E(G)\}\ \  \mbox{and}\ \  \Gamma^*(v)=\{u \colon uv\in E(G)\ \mbox{ and }\  d_u\geq 2\}.$$
We also let $N(v)=\Gamma(v)\cup\{v\}$ and $N^*(v)= \Gamma^*(v)\cup \{v\}$.
Throughout $d_u$ will be degree with respect to $G$, unless other
graphs are considered.

We have the following Lemma.
\begin{lemma}\label{l0}
  If $G$ is a connected graph on the vertex set $ \{1,2,\ldots, n\}$, then we have
$$R(G)\geq \frac{\sum_{i=1}^n \sqrt{d_i}}{2 \sqrt{\Delta}}.$$
Here $d_1,\dots, d_n$ are degrees of $G$ and $\Delta$ is the maximum degree.
\end{lemma}
{\bf Proof:} We have
\begin{eqnarray*}
R(G)&=&\sum_{ij \in E(G)}\frac{1}{\sqrt{d_id_j}}\\
&=&\frac{1}{2}\sum_{i=1}^n\sum_{j \in \Gamma(i)}\frac{1}{\sqrt{d_id_j}}\\
&\geq& \frac{1}{2}\sum_{i=1}^n\sum_{j \in \Gamma(i)}\frac{1}{\sqrt{d_i\Delta}}\\
&\geq& \frac{1}{2}\sum_{i=1}^n\frac{d_i}{\sqrt{d_i\Delta}}\\
&=&\frac{\sum_{i=1}^n \sqrt{d_i}}{2 \sqrt{\Delta}}.
\end{eqnarray*}
The proof of this lemma is finished. \hfill $\square$

Let $G - v$ be the induced subgraph obtained by
deleting the vertex $v$ from $G$. Let $G - uv$ be the
spanning subgraph obtained by deleting the edge $uv$ from $G$.

If $G$ is connected, then $D(G)$ is the diameter of $G$ as defined early.
We extend the function $D(G)$ to disconnected graphs as follows.
If $G$ is disconnected, then $D(G)$ is defined to be the
maximum among diameters of all the connected components of $G$.
A vertex $v$ is said to be {\it essential} (to $D(G)$) if $D(G - v)<
D(G)$; it is not essential otherwise. Thus a vertex $v$ is
essential if and only if every shortest path between any two vertices at
distance $D(G)$ passes through $v$.

An edge is {\it essential} if its two
endpoints are essential. A path is {\it essential} if all edges of
this path are essential.

In general, $\Gamma(v)$ is not an independent set. Let
$G|_{\Gamma(v)}$ be the induced subgraph of $G$ on $\Gamma(v).$ We
have the following lemma.

\begin{lemma}\label{l3}
Given an orientation of the edges of $G|_{\Gamma(v)}$, for any two
vertices $u$ and $x$ in $G$,
we define
\[\epsilon^u_x=\left\{
  \begin{array}{cc}
    1, & \mbox{ if $\overrightarrow{ux}$ is a directed edge of $G|_{\Gamma(v)}$;}\\
    0, & \mbox{ otherwise.}
  \end{array}
\right.
\]
If for any $u\in\Gamma^*(v),$
\begin{equation}
  \label{eq:1}
 \frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x-\epsilon^u_x}} \leq \frac{2}{\sqrt{d_v}},
\end{equation}
then we have
$$R(G)> R(G - v).$$
\end{lemma}
{\bf Proof:} When the vertex $v$ is deleted, all edges incident
to $v$ are also deleted.  For any vertex $u$, if $u\in \Gamma(v)$, the
degree of $u$ decreases by one; if $u\not\in N(v)$,
the degree of $u$ remains the same.

Let us consider $R(G)-R(G - v)$. For most edges $xy$ in $G$, the
contribution of $\frac{1}{\sqrt{d_xd_y}}$ to $R(G)-R(G - v)$ is
canceled out unless one of $x$ and $y$ is in $N(v)$. There are
three types of edges.

\noindent
{\bf Type I:}  $x=v$ and $y=u\in \Gamma(v)$. The contribution of this type of edge
 to $R(G)-R(G - v)$ is
$$\sum_{u\in\Gamma(v)}\frac{1}{\sqrt{d_vd_u}}\geq \sum_{u\in\Gamma^*(v)}\frac{1}{\sqrt{d_vd_u}} .$$

\noindent {\bf Type II:}  $y=u\in \Gamma^*(v)$ and $x\in \Gamma(u)\setminus N(v)$.
The contribution of this type of edge
 to $R(G)-R(G - v)$ is
 \begin{eqnarray*}
&&\hspace*{-1cm}\sum_{u\in\Gamma^*(v)}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)
\sum_{x\in \Gamma(u)\setminus N(v)}
\frac{1}{\sqrt{d_x}} \\
&=& \sum_{u\in\Gamma^*(v)}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)
\sum_{x\in \Gamma(u)\setminus N(v)}
\frac{1}{\sqrt{d_x-\epsilon_x^u}}
    \end{eqnarray*}
since $\epsilon_x^u=0$ in this case.

\noindent
{\bf Type III:}  $y=u\in \Gamma^*(v)$, $x\in  \Gamma^*(v)$, and
$\overrightarrow{ux}$ is a directed edge of $G|_{\Gamma(v)}$.
Note that
\begin{eqnarray*}
&&\hspace*{-1cm}
\frac{1}{\sqrt{d_ud_x}}-\frac{1}{\sqrt{(d_u-1)(d_x-1)}} \\
&=&
\frac{1}{\sqrt{d_u}}\left(\frac{1}{\sqrt{d_x}}-\frac{1}{\sqrt{d_x-1}}\right)
+
\frac{1}{\sqrt{d_x-1}}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)\\
&=&
\frac{1}{\sqrt{d_u-\epsilon_u^x}}\left(\frac{1}{\sqrt{d_x}}-\frac{1}{\sqrt{d_x-1}}\right)
+
\frac{1}{\sqrt{d_x-\epsilon_x^u}}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right),
\end{eqnarray*}
since $\epsilon_u^x=0$ and $\epsilon_x^u=1$. The above expression is symmetric
with respect to $u$ and $x$. Thus, the contribution of this type of edge
 to $R(G)-R(G - v)$ is
 \begin{eqnarray*}
&&\hspace*{-1cm}\frac{1}{2} \sum_{u\in \Gamma^*(v), x\in \Gamma(u)\cap \Gamma(v)}
\frac{1}{\sqrt{d_u-\epsilon_u^x}}\left(\frac{1}{\sqrt{d_x}}-\frac{1}{\sqrt{d_x-1}}\right)
+
\frac{1}{\sqrt{d_x-\epsilon_x^u}}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)\\
&=&\sum_{u\in \Gamma^*(v), x\in \Gamma(u)\cap \Gamma(v)}\frac{1}{\sqrt{d_x-\epsilon_x^u}}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)\\
&=&\sum_{u\in \Gamma^*(v)}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)
\sum_{ x\in \Gamma(u)\cap \Gamma(v)} \frac{1}{\sqrt{d_x-\epsilon_x^u}}.
 \end{eqnarray*}

Summing up the contribution of three types of edges,
we have
\begin{eqnarray*}
  R(G)-R(G - v)&\geq&\sum_{u\in\Gamma^*(v)}\frac{1}{\sqrt{d_vd_u}} + \sum_{u\in\Gamma^*(v)}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)
\sum_{x\in \Gamma(u)\setminus N(v)}
\frac{1}{\sqrt{d_x-\epsilon_x^u}}\\
&&+\sum_{u\in \Gamma^*(v)}\left(\frac{1}{\sqrt{d_u}}-\frac{1}{\sqrt{d_u-1}}\right)
\sum_{ x\in \Gamma(u)\cap \Gamma(v)} \frac{1}{\sqrt{d_x-\epsilon_x^u}}.\\
&=& \sum_{u\in\Gamma^*(v)}\left[\frac{1}{\sqrt{d_vd_u}}
-\left( \frac{1}{\sqrt{d_u-1}}
-\frac{1}{\sqrt{d_u}}\right)\sum_{x\in\Gamma(u)\setminus\{v\}}\frac{1}{\sqrt{d_x-\epsilon_x^u}}\right].
\end{eqnarray*}
Now we apply the assumption (\ref{eq:1}).
\begin{eqnarray*}
  R(G)-R(G - v)
&\geq& \sum_{u\in \Gamma^{*}(v)} \left[ \frac{1}{\sqrt{d_vd_u}}-
\left( \frac{1}{\sqrt{d_u-1}}
-\frac{1}{\sqrt{d_u}}\right) \frac{2(d_u-1)}{\sqrt{d_v}}
\right] \\
&=&\sum_{u\in \Gamma^{*}(v)}\frac{1}{\sqrt{d_vd_u}} \left(1-
\frac{2\sqrt{d_u-1}}{\sqrt{d_u}+\sqrt{d_u-1}}
\right) \\
&=&\sum_{u\in \Gamma^{*}(v)}\frac{(\sqrt{d_u}-\sqrt{d_u-1})^2}{\sqrt{d_vd_u}}\\
&>&0. \hspace*{3in} \square
\end{eqnarray*}

Inequality (\ref{eq:1}) is called the {\it deletion condition} for the
vertex $v$. To check the deletion condition, we need to specify
an orientation of  the edges of $G\mid_{\Gamma(v)}$. We can
relax this condition as follows.

Let $d^*_x=d_x-1$ if $d_x\geq 2$ and $d^*_x=d_x$ if $d_x=1$.
Note for any orientation of the edges of $G\mid_{\Gamma(v)}$
$$d_x-\epsilon_x^u\geq d^*_x.$$
We have the following corollary.
\begin{corollary} \label{cor2}
If for any $u\in \Gamma^*(v)$,
\begin{equation}
  \label{eq:2}
 \frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus \{v\}}\frac{1}{\sqrt{d_x^*}} \leq
\frac{2}{\sqrt{d_v}},
\end{equation}
then we have $$R(G)> R(G - v).$$
\end{corollary}

Inequality (\ref{eq:2}) is called the {\it weak deletion condition} for the
vertex $v$.

\begin{corollary} \label{cor3}
  If $d_v\leq 4$,  then we have
$$R(G)>R(G - v).$$
\end{corollary}
{\bf Proof:} It suffices to show that $v$
satisfies the weak deletion condition.  If $\Gamma^*(v)=\emptyset$, then the
weak deletion condition is satisfied automatically.
If $u\in \Gamma^*(v)$ and $x\in \Gamma(u)\setminus\{v\}$,  then we have
$$d_x^*\geq 1.$$
Thus,
 \[\frac{1}{d_u-1}
\sum_{x\in \Gamma^*(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x^*}}\leq
\frac{1}{d_u-1}\sum_{x\in \Gamma^*(u)\setminus \{v\}}1\leq 1
\leq\frac{2}{\sqrt{d_v}}.\]
Applying Corollary \ref{cor2}, we get
$$R(G)> R(G - v).$$
\hfill $\square$

\begin{lemma}\label{l4}
If $G$ is a connected graph,  then there exists an induced connected subgraph $G'$
satisfying the following conditions.
  \begin{enumerate}
  \item $R(G)\geq R(G')$.
  \item $D(G)\leq D(G')$.
  \item Every non-essential vertex in $G'$ has degree at least $9$.
  \item $R(G')=R(G)$ holds if and only if $G'=G$ and every non-essential vertex
in $G$ has degree at least $9$.
  \end{enumerate}

\end{lemma}
{\bf Proof:} Suppose that $G$ contains a vertex $v$ with $d_v\leq 4$.
If $v$ is not essential, then we can remove $v$ from $G$ and consider
$G - v$ instead (by Corollary \ref{cor3}). Repeatedly find a non-essential vertex $v$ with degree at most $4$
and delete it until no such $v$ is found.

From now on, we assume every non-essential vertex has degree at
least $5$. Let $v$ be a non-essential vertex with minimum degree
$\delta\leq 8$. We claim $$R(G)> R(G - v).$$ There are five cases.

\noindent
{\bf Case I:}  The vertex $v$ has one neighbor $u_1$ with degree $1$, and $u_1$ is
essential. Any path containing $u_1$ contains $v$. This contradicts with the assumption that $v$ is not essential.

\noindent
{\bf Case II:} The vertex
 $v$ has two neighbors $u_1$ and $u_2$ with degrees  $2$, and
both $u_1$ and $u_2$ are essential vertices. Since $v$ is not
essential, there exists a shortest path $P$ (of length $D(G)$)
which  does not contain $v$.
The path $P$ passes through $u_1$ and $u_2$. The degrees of $u_1$ and $u_2$
in $P$ are at most $1$. So $u_1$ and $u_2$ must be the two endpoints
of $P$. In this case, we must have $D(G)=d(u_1,u_2)\leq 2$.

If $D(G)=1$, then $G$ is a complete graph. We have
$R(G)=R(G - v)+\frac{1}{2}>R(G - v)$.

Now assume $D(G)=2$. Since $d_v=\delta\geq 5$,
 $\Gamma(v)$ contains  a vertex $u$ which is not on the path $P$.
We have $d(u, u_i)=2$ for $i=1,2$. We can delete $u_1$ or $u_2$ without
decreasing $D(G)$. Contradiction!

\noindent
{\bf Case III:}  Every neighbor of $v$ has degree at least $3$, and no leaf
lies within the distance $2$ from $v$. For any $u\in \Gamma(v)$
with degree at least $3$ and $x\in \Gamma(u)\setminus \{v\}$, we
have
$$d_x^*\geq 2.$$
We have
 \[\frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus \{v\}}\frac{1}{\sqrt{d_x^*}} \leq
\frac{1}{\sqrt{2}} \leq\frac{2}{\sqrt{d_v}},\] which holds for
$d_v\leq 8$. The weak deletion condition (\ref{eq:2}) is satisfied. By
Corollary \ref{cor2}, we have
$$R(G)> R(G - v).$$

\noindent
{\bf Case IV:}
All neighbors of $v$ except $u_1$  have degree at least $3$ while $u_1$ has degree $2$;
 no leaf lies within the distance $2$ from $v$. In this case, we verify
 the deletion condition (\ref{eq:1}).
Orient the edges of $G|_{\Gamma^*(v)}$ so that the edge incidents
to $u_1$ leave $u_1$. For any $u\in \Gamma(v)$ and $x\in
\Gamma^*(u)\setminus \{v\}$, it is clear that
$$d_x-\epsilon^u_x\geq 2.$$ Similarly, the condition (\ref{eq:1})
is satisfied. By Lemma \ref{l3}, we have
$$R(G)> R(G - v).$$

\noindent
{\bf Case V:}
 There is a leaf $x$ with $d(v,x)=2$,  and $x$ is essential. Let
$u$ be the only neighbor of $x$. Clearly, $u\in \Gamma^*(v)$. Since $x$ is
essential, then $u$ must be essential as well. We verify the weak deletion
condition (\ref{eq:2}) for $u$.

If $d_u=2$, then $v$ is also essential. Contradiction!
Suppose that $u$ has a neighbor $w$ with $d_w<\delta$ ( $w\not=x$).
The vertex $w$ must be essential. Since $d_v=\delta>d_w$, there
is a vertex $y\in \Gamma(v)\setminus \Gamma(w)$. Suppose that $P$ is a shortest path of length $D(G)$
containing $x, u, w$. Replace the segment $x-u-w$ by the shortest path from
$y$ to $w$. Call this path $P'$. The path $P'$ is also a shortest path with
length at least $D(G)$, and $P'$ dose not  contain  $x$. This contradicts with the assumption that $x$ is essential.

Suppose $d_u\geq 3$, and every neighbor $w$ of $u$ other than $x$
satisfies $d_w\geq \delta$.
We have
\begin{eqnarray*}
&& \hspace*{-2cm} \frac{1}{d_u-1} \sum_{x\in \Gamma^*(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x^*}}\\
&\leq&  \frac{1}{d_u-1} \left(1 + (d_u-2)\frac{1}{\sqrt{\delta-1}}\right)\\
&=& \frac{1}{\sqrt{\delta-1}} + \frac{1}{d_u-1}\left(1-\frac{1}{\sqrt{\delta-1}}\right)\\
&\leq& \frac{1}{\sqrt{\delta-1}} + \frac{1}{2}\left(1-\frac{1}{\sqrt{\delta-1}}\right)\\
&\leq& \frac{1}{2}\left(1+\frac{1}{\sqrt{\delta-1}}\right)\\
&<& \frac{2}{\sqrt{\delta}}.
\end{eqnarray*}
The last inequality holds for $\delta\leq 8$. Thus $R(G)\geq R(G - v)$.

For all five cases, we can delete a non-essential vertex $v$ with $d_v\leq 8$
 such that
$$R(G)> R(G - v).$$
Repeat this process until every non-essential vertex has degree
at least $9$.
\hfill $\square$

A vertex $v$ is  a {\em local-minimum-vertex} if the following two conditions
are satisfied.
\begin{enumerate}
\item The vertex $v$ is not essential for $G$.
\item If $u$ is a  non-essential vertex with $d(u,v)\leq 2$, then $d_u\geq d_v$.
\end{enumerate}

\begin{lemma}\label{local}
Suppose $v$ is a local-minimum-vertex with degree $d_v\geq 3$. If
$R(G)\leq R(G - v)$, then there exist two vertices $w$ and $y$
satisfying
\begin{enumerate}
\item  $vw$ and $wy$ are edges of $G$.
\item  $d_w<d_v$ and $d_y<d_v$. Consequently, $wy$ is
an essential edge of $G$.
\end{enumerate}
\end{lemma}
{\bf Proof:} For any $u\in \Gamma(v)$ with $d_u\geq d_v$,
we claim that $\Gamma(u)$ can contain at most two essential vertices.

Otherwise, say that $\Gamma(u)$ contains three essential
vertices $x$, $y$, and $z$. Choose a shortest path $P$ connecting
two vertices of distance $D(G)$. By the definition of essential vertices,
all $x$, $y$, and $z$ are on the path $P$. Since $x$, $y$, $z\in \Gamma(u)$,
 $x$, $y$, and $z$ must be
adjacent on $P$. Without loss of generality, we assume $d(x,z)=2$.
We can replace $y$ by $u$ and obtain a new path $P'$ from $P$.
This contradicts with the assumption that $y$ is also essential.

Since $R(G)\leq R(G - v)$, the weak deletion condition (\ref{eq:2})
is violated for some $u$. There are three cases.

\noindent
{\bf Case I:} For any $x\in \Gamma(u)\setminus \{v\}$, $d_x\geq d_v$.
In this case, we have
$$d^*_x=d_x-1\geq d_v-1.$$
Thus,
\begin{eqnarray*}
 \frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus \{v\}}\frac{1}{\sqrt{d_x^*}}
&\leq&  \frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus \{v\}} \frac{1}{\sqrt{d_v-1}}\\
&\leq&  \frac{1}{\sqrt{d_v-1}}\\
&<& \frac{2}{\sqrt{d_v}},
\end{eqnarray*}
where the lase step holds for $d_v\geq 2$.  The weak deletion condition
(\ref{eq:2}) is satisfied. Contradiction!

\noindent
{\bf Case II:}  $d_u<d_v$. By Case I, we have a vertex
$x\in \Gamma(u)\setminus \{v\}$, $d_x< d_v$.
Choose $w=u$ and $y=x$. We are done.

\noindent
{\bf Case III:}
$d_u\geq d_v$. Note that $\Gamma(u)$ can contain at most $2$
  essential vertices. Let $y_1$ and $y_2$ be the possible two
  essential vertices. If $x\in \Gamma(u)\setminus \{v,y_1,y_2\}$,
   then by the definition of local-minimum-vertex, we have
$$d^*_x=d_x-1\geq d_v-1.$$
We  bound $d^*_{y_1}$ and $d^*_{y_1}$  by $2$.
We get
\begin{eqnarray*}
 \frac{1}{d_u-1}
\sum_{x\in \Gamma(u)\setminus \{v\}}\frac{1}{\sqrt{d_x^*}}
&\leq&  \frac{1}{d_u-1}\left[ 2 + \frac{d_u-3}{\sqrt{d_v-1}}\right]
\\
&\leq&  \frac{1}{\sqrt{d_v-1}} +\frac{2-\frac{2}{\sqrt{d_v-1}}}{d_u-1}  \\
&\leq&  \frac{1}{\sqrt{d_v-1}} +\frac{2-\frac{2}{\sqrt{d_v-1}}}{d_v-1}  \\
&<& \frac{2}{\sqrt{d_v}},
\end{eqnarray*}
where the lase step holds for $d_v\geq 3$. Contradiction!

Only Case II is possible. There are two essential vertices $y$ and
$w$ satisfying all the conditions.  \hfill $\square$

\begin{lemma}\label{cut}
If $uv$ is a non-leaf edge, then we have
$$R(G)> R(G - uv)-\frac{1}{2}.$$
\end{lemma}
{\bf Proof:} We have
\begin{eqnarray*}
  R(G)-R(G - uv) &=& \frac{1}{\sqrt{d_ud_v}} -
 \sum_{x\in \Gamma(u)\setminus \{v\}}\frac{1}{\sqrt{d_x}}
\left(\frac{1}{\sqrt{d_u-1}}-\frac{1}{\sqrt{d_u}}\right)\\
&\ & - \sum_{y\in \Gamma(v)\setminus \{u\}}\frac{1}{\sqrt{d_y}}
\left(\frac{1}{\sqrt{d_v-1}}-\frac{1}{\sqrt{d_v}}\right)\\
&\geq& \frac{1}{\sqrt{d_ud_v}} -
(d_u-1)\left(\frac{1}{\sqrt{d_u-1}}-\frac{1}{\sqrt{d_u}}\right)\\
&\ &-(d_v-1)\left(\frac{1}{\sqrt{d_v-1}}-\frac{1}{\sqrt{d_v}}\right)\\
&=& \frac{1}{\sqrt{d_ud_v}} - \frac{\sqrt{d_u-1}}{\sqrt{d_u}(\sqrt{d_u}+\sqrt{d_u-1})}
-\frac{\sqrt{d_v-1}}{\sqrt{d_v}(\sqrt{d_v}+\sqrt{d_v-1})}\\
&>& \frac{1}{\sqrt{d_ud_v}}-\frac{1}{2\sqrt{d_u}}-\frac{1}{2\sqrt{d_v}}\\
&=& \frac{1}{\sqrt{2d_ud_v}} +
\frac{1}{2}\left( 1-\frac{1}{\sqrt{d_u}}\right)\left( 1-\frac{1}{\sqrt{d_v}}\right) -\frac{1}{2}\\
&>&-\frac{1}{2}.
\end{eqnarray*}
\hfill $\square$

\begin{corollary}\label{cut1}
  Suppose that  $uv$ is not a cut edge of $G$. If both $u$ and $v$ are essential, then
$$R(G)-\frac{1}{2}D(G)>R(G - uv)-\frac{1}{2}D(G - uv).$$
\end{corollary}

\begin{lemma}\label{attach}
Let $u$ be a cut vertex of $G$. Suppose that $G$ has a decomposition $G=G_1\cup G_2$
satisfying $G_1\cap G_2=\{u\}$,  $|G_2|\geq 8$, and  $|\Gamma_u\cap V(G_1)|=2$
(see Figure \ref{fig:decomp}).  If $u$ reaches the minimum degree in $G_2$, then
we have
$$R(G)> R(G_1).$$
\end{lemma}

\begin{center}
\begin{figure}[hbt]

\begin{picture}(290,100)
\put(20,45){\circle{20}}

\put(15,44){$\ldots$}

\put(30,45){\line(1,0){40}}

\put(50,45){\circle*{3}}

\put(48,48){$u$}

\put(80,45){\circle{20}}

\put(75,44){$\ldots$}

\put(48,80){$G_1$}

\put(110,40){$\cup$}

\put(140,80){$G_2$}

\put(140,10){\circle{25}}

\put(135,9){$\ldots$}

\put(140,60){\circle*{3}}

\put(140,63){$u$}

\put(140,60){\line(1,-5){7.9}}

\put(140,60){\line(-1,-5){7.9}}

\put(135,25){$\ldots$}

\put(165,40){$\Rightarrow$}

\put(205,45){\circle{30}}

\put(200,44){$\ldots$}

\put(220,45){\line(1,0){40}}

\put(240,80){$G$}

\put(240,48){$u$}

\put(240,45){\circle*{3}}

\put(240,45){\line(1,-3){8.5}}

\put(240,45){\line(-1,-3){8.5}}

\put(240,10){\circle{25}}

\put(235,25){$\ldots$}

\put(235,9){$\ldots$}

\put(275,45){\circle{30}}

\put(270,44){$\ldots$}

\end{picture}
\caption{$G=G_1\cup G_2$}
\label{fig:decomp}
\end{figure}
\end{center}

{\bf Proof:} Let $u_1$ and $u_2$ be the two adjacent vertices of $u$ in $G_1$
and $v_1,\ldots, v_k$ be the adjacent vertices of $u$ in $G_2.$
Let $N(v_i)$ be the set of neighbors of $v_i$ in $G_2$.  We
have
\begin{align*}
R(G)&\geq
R(G_1)+R(G_2)-\left(\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{k+2}}\right)\left(\frac{1}{\sqrt{d_{u_1}}}+\frac{1}{\sqrt{d_{u_2}}}\right)\\
&\
-\sum_{i=1}^{k}\left(\frac{1}{\sqrt{d_{v_i}}}-\frac{1}{\sqrt{d_{v_i}+1}}\right)\sum_{x\in
N(v_i)}\frac{1}{\sqrt{d_x}}\\
&\geq
R(G_1)+R(G_2)-\frac{1}{\sqrt{2}}\left(\frac{1}{\sqrt{d_{u_1}}}+\frac{1}{\sqrt{d_{u_2}}}\right)\\
&\
-\sum_{i=1}^k\frac{1}{(\sqrt{d_{v_i}}+\sqrt{d_{v_i}+1})\sqrt{d_{v_i}}\sqrt{d_{v_i}+1}}\cdot \frac{d_{v_i}}{\sqrt{k}}\\
& >R(G_1)+R(G_2)-\frac{1}{\sqrt{2}}\left(\frac{1}{\sqrt{d_{u_1}}}+\frac{1}{\sqrt{d_{u_2}}}\right)
-\sum_{i=1}^{k}\frac{1}{2\sqrt{k}\sqrt{d_{v_i}}}\\
&\geq
R(G_1)+R(G_2)-\frac{1}{\sqrt{2}}\left(\frac{1}{\sqrt{1}}+\frac{1}{\sqrt{1}}\right)-\frac{k}{2\sqrt{k}\sqrt{k}}\\
&\geq R(G_1)+R(G_2)-\sqrt{2}-\frac{1}{2}>R(G_1),
\end{align*}
where the last inequality hold for $R(G_2)\geq \sqrt{|G_2|-1}\geq
\sqrt{7}.$

\hfill $\square$

\begin{lemma}\label{subdivision}
 For any edge $uv$ of $G$, let $G_{u\cdot v}$ be the graph obtained by
subdividing the edge $uv$, (i.e., by replacing the edge $uv$ by a path
of length $2$.) We have the following statements.
\begin{enumerate}
\item If $d_u=2$ or $d_v=2$, then $R(G_{u\cdot v})=R(G)+\frac{1}{2}$.
\item If $d_u>2$ and $d_v>2$, then $R(G_{u\cdot v})<R(G)+\frac{1}{2}$.
\item If $d_u=1$ and $d_v>2$, then  $R(G_{u\cdot v})>R(G)+\frac{1}{2}$.
\item If $d_u>2$ and $d_v=1$, then  $R(G_{u\cdot v})>R(G)+\frac{1}{2}$.
\end{enumerate}
\end{lemma}
{\bf Proof:}
We have
\begin{eqnarray*}
 R(G_{u\cdot v})-R(G)&=& \frac{1}{\sqrt{2d_u}}+ \frac{1}{\sqrt{2d_v}}
-\frac{1}{\sqrt{d_ud_v}} \\
&=& \frac{1}{2} - \left(\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{d_u}}\right)
\left(\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{d_v}}\right).
\end{eqnarray*}
It is easy to verify all cases. \hfill $\square$

\section{Proof of  main theorem}

{\bf Proof of Theorem \ref{main}:} For any graph $G$, we define
$f(G)=R(G)-\frac{D(G)}{2}$.  Note that $f(P_n)=\sqrt{2}-1$ for
$n\geq 3$. We need show that
\begin{equation}\label{minequlity}
f(G)> \sqrt{2}-1
\end{equation}
for any connected graph $G\not=P_n$ ($n\geq 3$).

Suppose that there is such a  graph $G$ ($\not=P_n$) satisfying
$$f(G)\leq\sqrt{2}-1.$$
Let $G$ be such a graph with the smallest number of vertices.
(If there are several such graphs with the same number of vertices,
pick the one with minimum number of edges.)
It is easy to check that $G$ is connected and has at least 3 vertices.

By Lemma \ref{l4}, every non-essential vertex of $G$ has degree at
least 9. By Corollary \ref{cut1}, every essential edge is an
edge-cut of $G$. By Lemma \ref{attach}, if there are two essential
edges $uv$ and $vw$, then $d_v=2$. Therefore $G$ is the graph
consists of several blocks which are linked by essential paths
(see Figure \ref{figure2}). A {\em block} $B$ is an induced
connected subgraph of $G$ which contains no essential edges of
$G$. By Lemma \ref{subdivision}, the length of each essential path
is either $1$ or $2$.

\begin{center}
  \begin{figure}[hbt]
    \centering
\begin{picture}(360, 100)

\put(10,40){\line(1,0){30}}

\put(10,60){\line(1,0){30}}

\put(10,40){\line(0,1){20}}

\put(40,40){\line(0,1){20}}

\put(40,50){\line(1,0){20}}

\put(80,50){\line(1,0){20}}

\put(100,30){\line(0,1){40}}

\put(260,30){\line(0,1){40}}

\put(100,30){\line(1,0){160}}

\put(179,15){$B$}

\put(100,70){\line(1,0){160}}

\put(260,50){\line(1,0){20}}

\put(300,50){\line(1,0){20}}

\put(320,40){\line(0,1){20}}

\put(320,40){\line(1,0){30}}

\put(350,40){\line(0,1){20}}

\put(320,60){\line(1,0){30}}

\put(100,50){\line(2,1){20}}

\put(100,50){\line(2,-1){20}}

\put(140,50){\line(-2,1){20}}

\put(140,50){\line(-2,-1){20}}

\put(140,50){\line(2,1){20}}

\put(140,50){\line(2,-1){20}}

\put(180,50){\line(-2,1){20}}

\put(180,50){\line(-2,-1){20}}

\put(220,50){\line(2,1){20}}

\put(220,50){\line(2,-1){20}}

\put(260,50){\line(-2,1){20}}

\put(260,50){\line(-2,-1){20}}

\put(65,49){$\ldots$}

\put(285,49){$\ldots$}

\put(195,49){$\ldots$}

\put(40,50){\circle*{3}}

\put(60,50){\circle*{3}}

\put(80,50){\circle*{3}}

\put(100,50){\circle*{3}}

\put(180,50){\circle*{3}}

\put(140,50){\circle*{3}}

\put(220,50){\circle*{3}}

\put(260,50){\circle*{3}}

\put(280,50){\circle*{3}}

\put(300,50){\circle*{3}}

\put(320,50){\circle*{3}}
  \end{picture}
\caption{The structure of $G$}
\label{figure2}

\end{figure}

\end{center}

We classify $G$ according to the number of blocks.
If there is no block in $G$, then $G=P_n$. Contradiction!

Suppose that there are at least two blocks in $G$. In this case, take an
essential path which links two blocks. If this essential path has
length $1$, we consider $G'$ obtained by subdividing this
essential edge. If this essential path has length $2$, let $G'=G$.
Let $u-v-w$ be this essential path. Let $G_1$ and $G_2$ be two
induced subgraphs of $G$ so that $G=G_1\cup G_2$ and $G_1\cap
G_2=v$. Note that each block contains at least one non-essential
vertex, which has degree at least $9$.  We have
$$|G_1|\geq 9 \mbox{ and } |G_2|\geq 9.$$
Since $|G_1|+|G_2|=|G'|+1\leq |G|+2$, we have
$$|G_1|< |G| \mbox{ and } |G_2|< |G|.$$
By the minimality of $G$, we have for $i=1,2$,
$$f(G_i)>\sqrt{2}-1.$$
Note $D(G')\leq D(G_1) +D(G_2)$.
\begin{eqnarray*}
  R(G')-R(G_1)-R(G_2) &=& \frac{1}{\sqrt{2d_u}} + \frac{1}{\sqrt{2d_w}}
-\frac{1}{\sqrt{d_u}} - \frac{1}{\sqrt{d_w}}\\
&=& -(1-\frac{1}{\sqrt{2}}) (\frac{1}{\sqrt{d_u}}+\frac{1}{\sqrt{d_w}}) \\
&>&  -(1-\frac{1}{\sqrt{2}}) (\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}) \\
&=& 1-\sqrt{2}.
\end{eqnarray*}
By Lemma \ref{subdivision}, we have
\begin{eqnarray*}
  f(G) &\geq & f(G')\\
       &=&   R(G')-\frac{1}{2}D(G')\\
       &=& f(G_1) + f(G_2)+ R(G')-R(G_1)-R(G_2)\\
       &>&  f(G_1) + f(G_2)+ 1-\sqrt{2}\\
       &>& \sqrt{2}-1 + \sqrt{2}-1 +  1-\sqrt{2}\\
       &=& \sqrt{2}-1.
\end{eqnarray*}
Contradiction!

Now we consider the remaining case: there is exactly one block in $G$
with possible essential edges attached at one or both ends. (See Figure
\ref{figure3}.)

\begin{figure}[hbt]
  \centering
  \begin{picture}(360, 100)

\put(80,50){\line(1,0){20}}

\put(100,30){\line(0,1){40}}

\put(260,30){\line(0,1){40}}

\put(100,30){\line(1,0){160}}

\put(179,15){$B$}

\put(100,70){\line(1,0){160}}

\put(260,50){\line(1,0){20}}

\put(100,50){\line(2,1){20}}

\put(100,50){\line(2,-1){20}}

\put(140,50){\line(-2,1){20}}

\put(140,50){\line(-2,-1){20}}

\put(140,50){\line(2,1){20}}

\put(140,50){\line(2,-1){20}}

\put(180,50){\line(-2,1){20}}

\put(180,50){\line(-2,-1){20}}

\put(220,50){\line(2,1){20}}

\put(220,50){\line(2,-1){20}}

\put(260,50){\line(-2,1){20}}

\put(260,50){\line(-2,-1){20}}

 \put(80,50){\circle*{3}}

\put(100,50){\circle*{3}}

\put(180,50){\circle*{3}}

\put(140,50){\circle*{3}}

\put(220,50){\circle*{3}}

 \put(190,49){$\ldots$}

\put(260,50){\circle*{3}}

\put(280,50){\circle*{3}}

\put(90,40){$z$}

\end{picture}
  \caption{$G$ contains exactly one block with optional
essential edges attached at the end.}
  \label{figure3}
\end{figure}

Assume the maximum degree $\Delta$ is achieved at  vertex $v$.
Note that the neighborhood of $v$ can contain at most two essential vertices.
An essential vertex has degree  at least 2 while a non-essiential vertex has degree
at least $9$. Applying Lemma \ref{l0}, we have
\begin{eqnarray*}
  R(G)&\geq& \frac{\sum_{i=1}^n \sqrt{d_i}}{2 \sqrt{\Delta}}\\
&\geq& \frac{\sqrt{d_v}+ \sum_{u\in \Gamma(v)}\sqrt{d_u}}{2 \sqrt{\Delta}}\\
&\geq& \frac{1}{2} + \frac{(\Delta-2) \sqrt{9} + 2 \sqrt{2}}{2 \sqrt{\Delta}}\\
&=& \frac{3}{2}\sqrt{\Delta} -\frac{3-\sqrt{2}}{\sqrt{\Delta}} + \frac{1}{2}.
\end{eqnarray*}

Let $h(x)= \frac{3}{2}\sqrt{x} -\frac{3-\sqrt{2}}{\sqrt{x}} + \frac{1}{2}$.
Note that $h(x)$ is an increasing function on $(0,\infty)$.
Since $G$ contains at least one non-essential vertex, we have $\Delta\geq 9$.

If $D(G)\leq 8$, then we have
$$R(G)\geq h(9) = 4+ \frac{\sqrt{2}}{3}> \frac{D(G)}{2}+\sqrt{2}-1.$$

It remains to show the case $D(G)\geq 9$. In fact, we show the
maximum degree $\Delta$ grows exponentially as a function of $D(G)$.

Pick any path $Q$ (in $G$) of length $D(G)$. Any optional
essential edge(s) is located at the end(s) of $Q$. Let $P$ be the
remaining path after deleting essential edges from $Q$. Let $k$ be
the length of $P$, which is called the length of the block $B$.
Since $D(G)\geq 9$, we have $$k\geq D(G)-2\geq 7.$$

Let $z$ be  an end vertex of $P$.
For $0\leq i\leq k$, let
$A_i$ be the set of vertices in $B$ of distance $i$ to the
vertex $z$ (see Figure \ref{figure3}).
Let $a_i$ be the minimum degree of
nonessential vertices in $A_i$. If $A_i$ is a single essential
vertex, then define $a_i$ to be infinity.
We have the following two claims.

\noindent
{\bf Claim A:} If $3\leq i\leq k-3$, then we have
\begin{equation}\label{recurrence}
 a_i\geq 2.9(\min\{a_{i-2}, a_{i-1}, a_{i+1}, a_{i+2}\}-1).
\end{equation}

\noindent {\bf Claim B:}  We have $\Delta \geq 1.5+7.4\cdot 2.9^{\lceil (k-6)/4\rceil}$
for $k\geq 7$.

The proofs of these two claims are quite long. We leave these proofs
at the end of this section. Now we use these claims to prove $f(G)>\sqrt{2}-1$.
For $k\geq 7$, we have
\begin{eqnarray*}
f(G)&=& R(G)-\frac{D(G)}{2}\\
&\geq&  h(\Delta) -\frac{k+2}{2}\\
&\geq&  h(1.5+7.4\cdot 2.9^{\lceil (k-6)/4\rceil}) -\frac{k+2}{2}\\
&>& \sqrt{2}-1.
\end{eqnarray*}
The inequality in last step can be easily verified by Calculus.

The proof of theorem is finished. \hfill $\square$

It remains to prove the two claims.

{\bf Proof of Claim A:} Obviously, (\ref{recurrence}) holds if $a_i$ is
infinity. Suppose there exists  $i$  such that
$$a_i< 2.9(\min\{a_{i-2},
a_{i-1}, a_{i+1}, a_{i+2}\}-1).$$

Let $v$ be the non-essential vertex with degree $a_i$ in $A_i.$
Let $\delta=\min\{a_{i-2}, a_{i-1},$ $ a_{i+1}, a_{i+2}\}.$ The
above inequality implies
\begin{equation}
  \label{eq:5}
d_v<2.9(\delta-1).
\end{equation}

We need show $R(G)>R(G - v)$ to derive the contradiction. It suffices to show that for any
$u\in \Gamma^*(v)$ the weak deletion condition holds.

If $u$ is essential, then $u$ is not connected with any other
essential vertex. We have

\begin{eqnarray*}
&& \hspace*{-1cm} \frac{1}{d_u-1}\sum_{x\in \Gamma(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x^*}}\\
 &\leq& \frac{1}{d_u-1}\sum_{x\in \Gamma(u)\setminus
 \{v\}}\frac{1}{\sqrt{\delta_v-1}} \\
&=& \frac{1}{\sqrt{\delta_v-1}}\\
&<&\frac{2}{\sqrt{d_v}}.
\end{eqnarray*}
At the last step, we applied inequality (\ref{eq:5}).

Otherwise, $u$ can only be adjacent to at most two essential
vertices. Since no two essential vertices are connected, each
non-leaf essential vertex has a degree at least $3$.
Let $y_1$ and $y_2$ be two possible essential vertices.
Noticing that essential vertices are not adjacent, we can orient
the edges of $G\mid_{\Gamma(u)}$ such that directed edges always
leave essential vertices. For  $i\in \{1,2\}$, we have
$$d_{y_i}-\epsilon_{y_i}^u=d_{y_i}\geq 3.$$
For $x\in \Gamma(u)\setminus \{v,y_1,y_2\}$, we apply the bound
$$d_x-\epsilon_{x}^u\geq d_x-1\geq \delta-1.$$
We have
$$\frac{1}{d_u-1}\sum_{x\in \Gamma(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x-\epsilon_x^u}}\leq
\frac{1}{\sqrt{\delta-1}}+\frac{2}{\delta-1}(\frac{1}{\sqrt{3}}-\frac{1}{\sqrt{\delta-1}}).$$

Let
$f(x)=\frac{1}{\sqrt{x}}+\frac{2}{x}(\frac{1}{\sqrt{3}}-\frac{1}{\sqrt{x}})$. Note
that $f(x)$ is decreasing on $(2.5,\infty)$.
Since $d_v\geq 9$, we have $2.5<\frac{d_v}{2.9}<\delta-1$.
Thus, $f(\delta-1)\leq
f(\frac{d_v}{2.9})$. We have
\begin{eqnarray*}
&&\hspace*{-2cm}\frac{1}{d_u-1}\sum_{x\in \Gamma(u)\setminus
\{v\}}\frac{1}{\sqrt{d_x-\epsilon_x^u}}\\
 &\leq& f(\delta-1)\\
&<& f\left(\frac{d_v}{2.9}\right)\\
&<& \frac{2}{\sqrt{d_v}}.
\end{eqnarray*}
The last step can be easily verified by Calculus. \hfill $\square$

{ \bf Proof of Claim B:}
 Let $\{b_i\}$ be the sequence such that $b_i=2.9(b_{i-1}-1)$ and $b_0=9.$
Solving the recurrence equation of the sequence $\{b_i\}$, we have
 \begin{eqnarray*}
 b_i&=& \frac{29}{19}+ \frac{142}{19}\cdot 2.9^i\\
&>& 1.5+7.4\cdot 2.9^i.
\end{eqnarray*}
Since $a_i\geq 9= b_0$ for $0\leq i \leq k$, we get $a_i\geq  b_1$ for $3\leq i\leq k-3$
by applying inequality (\ref{recurrence}).  Applying inequality (\ref{recurrence}) again,
we obtain $a_i\geq  b_2$ for $5\leq i\leq k-5$. Repeatedly apply inequality
(\ref{recurrence}). For each $j$ in $\{1,2,\ldots,\lceil (k-6)/4\rceil  \}$
and each $i$ satisfying $2j+1\leq i \leq k-2j-1$, we have $a_i> b_j$.
Let $j_0=\lceil (k-6)/4\rceil $. Note  $k-4j_0-2\geq 1$. Thus,
both $a_{2j_0+1}$ and $a_{2j_0+2}$ are greater than or equal to $b_{j_0}$.
Note that there is no  essential edge in the block $B$.   We have
$$\Delta\geq \min\{a_{2j_0+1}, a_{2j_0+2}\}\geq b_{j_0}>1.5+7.4\cdot 2.9^{\lceil (k-6/)4\rceil  }.$$
\hfill $\square$