Certain Types of Total Irregularities of Graphs and Digraphs

Abstract: The total irregularity of a simple undirected graph $G$ is denoted by $irr_t(G)$ and is defined as $irr_t(G) = \frac{1}{2}\sum\limits_{u,v \in V(G)}|d(u) - d(v)|$. In this paper, the concept called edge-transformation in relation to total irregularity of simple undirected graphs with at least one cut edge is introduced. We also introduce the concept of an edge-joint between two simple undirected graphs. We also introduce the concept of total irregularity in respect of in-degree and out-degree in simple directed graphs. These invariants are called total in-irregularity and total out-irregularity respectively. In this paper, we initiate a study on these parameters of given simple undirected graphs and simple digraphs.

\section{Introduction}

For general notations and concepts in graph theory, we refer to \cite{BM1}, \cite{FH} and \cite{DBW} and for digraph theory, we further refer to \cite{CL1} and \cite{JG1}. All graphs mentioned in this paper are simple, connected and finite graphs, unless mentioned otherwise. Also, except for Section \ref{Sec-4}, all the graphs mentioned here are undirected graphs.

A graph $G$ is said to be \textit{regular} if the degree of all vertices are equal. A graph that is not regular is called an \textit{irregular graph}. The total irregularity of a given simple connected graph is defined in \cite{MOA} as follows.

\begin{definition}{\rm
\cite{MOA} The \textit{imbalance} of an edge $e=uv$ in a given graph $G$ is defined as $|d(u)-d(v)|$. The \textit{total irregularity} of a graph $G$,  denoted by $irr_t(G)$, is defined as $irr_t(G) =\frac{1}{2}\sum \limits_{u,v \in V(G)}|d(u)-d(v)|$. }
\end{definition}

If the vertices of a graph $G$ on $n$ vertices are labelled as $v_i, i = 1, 2, 3, \ldots, n$, then the definition may be $irr_t(G) = \frac{1}{2}\sum \limits_{i=1}^{n} \sum \limits_{j=1}^{n}|d(v_i) - d(v_j)| = \sum \limits_{i=1}^{n} \sum \limits_{j=i+1}^{n}|d(v_i) - d(v_j)|$ or $\sum \limits_{i=1}^{n-1} \sum \limits_{j=i+1}^{n}|d(v_i) - d(v_j)|$. For a graph on a singular vertex (\emph{1-null} graph or $K_1$), we define $irr_t(G) = 0$.
 Clearly, $irr_t(G) = 0$ if and only if $G$ is regular.

The notion of \textit{branch-transformation} of a graph has been introduced in \cite{ZYY} as follows.

\begin{definition}{\rm
\cite{ZYY} Let $G$ be a graph with at least two pendent vertices. Without loss of generality, let $u$ be a vertex of $G$ with $d_G(u)\ge 3$, $T$ be a hanging tree of $G$ connecting to $u$ with $|V(T)|\ge 1$ and $v$ be a pendant vertex of $G$ with $v\notin T$. Let $G'$ be the graph obtained from $G$ by deleting $T$ from vertex $u$ and attaching it to vertex $v$. We call the transformation from $G$ to $G'$ a \textit{branch-transformation} on $G$ from vertex $u$ to vertex $v$.}
\end{definition}

Certain studies on irregularities and total irregularities of given graphs and the properties graphs related to these irregularities have been studied in \cite{ABD,ACD,AD,MOA,DS1,HR} and \cite{ZYY}. Motivated from these studies, in this paper, we initiate a study on certain types of total irregularities of given graphs and directed graphs. We introduce the notion of edge-transformation in relation to total irregularity of simple graphs with at least one cut edge as well as an edge-joint between two graphs. We also introduce the notion of total irregularity with respect to in-degree and out-degree in directed graphs.

\section{Total Irregularity Resulting from Edge-Joints}

Consider a graph $G$ on $n$ vertices with two connected components $G_1$ and $G_2$. Therefore, $G = G_1 \cup G_2$.  Hence, the total irregularity of $G$ is given by $irr_t(G) = irr_t(G_1) + irr_t(G_2) + \sum\limits_{i=1}^{r}\sum\limits_{j=1}^{s}|d(u_i)- d(v_j)|$, where $u_i \in V(G_1)$, $v_j \in V(G_2)$ and $r=|V(G_1)|$ and $s=|V(G_2)|$.

The concept of an edge-joint between two simple undirected graphs $G$ and $H$ is defined below.

\begin{definition}{\em
The \textit{edge-joint} of two graphs $G$ and $H$ is the graph obtained by adding one edge, say $uv$, where $u \in V(G), v \in V(H)$, and is denoted by $G\rightsquigarrow_{uv}H$.}
\end{definition}

\begin{remark}
It is to be noted that $G\rightsquigarrow_{uv}H = G \cup H + uv$ and $G\rightsquigarrow_{uv}H \simeq H\rightsquigarrow_{vu}G$.
\end{remark}

\ni Now, we make the following standard definitions and notation.

\begin{definition}\label{D-VSS1}{\rm
Let $G$ be a graph on $n$ vertices with two connected components $G_1$ and $G_2$ whose vertex sets are $V(G_1) = \{u_i: 1 \leq i \leq r\}$ and $V(G_2) = \{v_j: 1 \leq j \leq s\}$. We fix the vertices $u_1$ from $G_1$ and $v_1$ from $G_2$. Now, we define the vertex subsets $V_1 = \{u_x: d_{G_1}(u_x) \le d_{G_1}(u_1), x\ne 1\}$; $V_2 = \{u_y: d_{G_1}(u_y) > d_{G_1}(u_1)\}$ and let $|V_1|=a$ and  $|V_2|=b$. Then, choose $V_3 = \{v_x:d_{G_2}(v_x) \le d_{G_1}(u_1)\}$ and $V_4 = \{v_y: d_{G_2}(v_y) > d_{G_1}(u_1)\}$, where $|V_3| = a^{\ast}$ and $|V_4| = b^{\ast}$. Similarly, let $V_5 = \{v_z: d_{G_2}(v_z) \le d_{G_2}(v_1),~z \ne 1\}$ and $V_6 = \{v_w: d_{G_2}(v_w) > d_{G_2}(v_1)\}$ where $|V_5| = c$ and $|V_6| = d$ and choose $V_7= \{u_z: d_{G_1}(u_z) \le d_{G_2}(v_1)\}$ and $V_8 = \{u_w: d_{G_1}(u_w) > d_{G_2}(v_1)\}$ where $|V_7| = c^{\ast}$ and $|V_8| = d^{\ast}$.}
\end{definition}

In view of the above definition, we have the relation between the cardinalities of the the above mentioned vertex subsets of $V(G_1)$ and $V(G_2)$ as follows.

\begin{remark}\label{Rem-2.3}{\rm
With regard to definition \ref{D-VSS1}, define the variables $b=r-a$, $d=s-c=n-r-c$, $b^{\ast} = r-a^{\ast}$ and $d^{\ast} = s-c^{\ast} = n-r-c^{\ast}$.}
\end{remark}

\begin{theorem}\label{Thm-2.1}
Let $G$ be a graph on $n$ vertices with two connected components $G_1$ and $G_2$, where $V(G_1) =\{u_i: 1\le i \le r\}$ and $V(G_2) =\{v_j: 1\le j\le s\}$ . Also, let $G' = G_1\rightsquigarrow_{u_1v_1}G_2$. Then, we have
$irr_t(G') = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + 2n-2(b + b^{\ast}+d+d^{\ast})-2$  or
$irr_t(G') = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + 2(a + a^{\ast} + c + c^{\ast}) -2n + 2$.
\end{theorem}
\begin{proof}
Clearly, for the graph $G = G_1 \cup G_2$, we have $irr_t(G) = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)|$ with $|V(G_1)| = r$ and $|V(G_2)| = s$.

By increasing $d_{G_1}(u_1)$ by 1 we increase the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_1}}^{a}|d_{G_1}(u_1) - d_{G_1}(w_j)|$ by exactly $(a - 1)$. It also reduces the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_2}}^{b}|d_{G_1}(u_1) - d_{G_1}(w_j)|$ by exactly $b$. It also increases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_3}}^{a^{\ast}}|d_{G_1}(u_1) - d_{G_2}(w_j)|$ by exactly $a^{\ast}$ and decreases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_4}}^{b^{\ast}}|d_{G_1}(u_1) - d_{G_2}(w_j)|$ by exactly $b^{\ast}$. Furthermore, by increasing $d_{G_2}(v_1)$ by 1, we increase the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_5}}^{c}|d_{G_2}(v_1) - d_{G_2}(w_j)|$ by exactly $(c - 1)$. It also reduces the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_6}}^{d}|d_{G_1}(u_1) - d_{G_2}(w_j)|$ by exactly $d$. It also increases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_7}}^{c^{\ast}}|d_{G_1}(u_1) - d_{G_1}(w_j)|$ by exactly $c^{\ast}$ and decreases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_8}}^{d^{\ast}}|d_{G_1}(u_1) - d_{G_1}(w_j)|$ by exactly $d^{\ast}$.

Hence, we have an interim result as follows.

$irr_t(G') = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_k{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + (a - 1) - b + a^{\ast} - b^{\ast} + (c - 1)-d + c^{\ast} - d^{\ast}\\  =  irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + (a-b) + (a^{\ast}- b^{\ast}) + (c - d) + (c^{\ast} - d^{\ast}) - 2$.

By substituting the variables $b, d, b^{\ast}$, and $d^{\ast}$ as defined in Definition \ref{D-VSS1} the final result is as follows.

$irr_t(G') = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + 2n - 2(b + b^{\ast} + d + d^{\ast}) - 2$, or;
$irr_t(G') = irr_t(G_1) + irr_t(G_2) + \sum \limits_{i=1}^{r} \sum\limits_{j=1}^{s}|d_{G_1}(u_i)- d_{G_2}(v_j)| + 2(a + a^{\ast} + c + c^{\ast}) -2n + 2$, follows.
\end{proof}

\ni Clearly $irr_t(G')$ is edge dependent in general but we have the following Corollary.

\begin{corollary}\label{Cor-2.6}
Let the degree sequence of graphs $G_1$ and $G_2$ be $(d_{G_1}(u_1) \leq d_{G_1}(u_2) \leq d_{G_1}(u_3) \leq \ldots\leq d_{G_1}(u_n))$ and $(d_{G_2}(v_1) \leq d_{G_2}(v_2) \leq d_{G_2}(v_3) \leq \ldots\ldots \leq d_{G_2}(v_m))$ respectively. If $d_{G_1}(u_i) = d_{G_2}(v_j)$ for some $i,j$ and $d_{G_1}(u_k) = d_{G_2}(v_l)$ for some $k,l$ and $G' = G_1\rightsquigarrow_{u_iv_l}G_2$ and $G'' = G_1\rightsquigarrow_{u_kv_j}G_2$ then, $irr_t(G') = irr_t(G'')$.
\end{corollary}
\begin{proof}
Begin the proof by choosing any vertex degree value $t_1$ in the degree sequence of $G_1$ and identify largest vertex index say, $i$ for which $d_{G_1}(u_i) = t_1$. Similarly, choose any vertex degree value $t_2$ in the degree sequence of $G_2$ and identify largest vertex index say, $l$ for which $d_{G_2}(v_l) = t_2$. Here, we have to consider the following cases.

\ni{\em Case 1:} With respect to $G' = G_1\rightsquigarrow_{u_iv_l}G_2$, using definition \ref{D-VSS1}, set the values as follows.

\begin{enumerate}\itemsep0mm
\item[(i)] $|V_1| = a = i-1$,
\item[(ii)] $|V_2| = b = n-i$,
\item[(iii)] $|V_3| = a^{\ast} = j$,
\item[(iv)] $|V_4| = b^{\ast} = m-j$
\item[(v)] $|V_5| = c = l - 1$,
\item[(vi)] $|V_6| = d = m- l$,
\item[(vii)] $|v_7| = c^{\ast} = k$,
\item[(viii)] $|V_8| = d^{\ast} = n-k$.
\end{enumerate}

Therefore, we have $2(n+m) -2((n-i) + (m-j) +(m- l) + (n-k)) -2 = 2(i+j+k+l -(n+m)) - 2$.

\ni{\em Case 2:} In respect of $G'' = G_1\rightsquigarrow_{u_kv_j}G_2$ and using definition \ref{D-VSS1}, set the values as follows.

\begin{enumerate}\itemsep0mm
\item[(i)] $|V_1| = a = k-1$,
\item[(ii)] $|V_2| = b = n- k$,
\item[(iii)] $|V_3| = a^{\ast} = l$,
\item[(iv)] $|V_4| = b^{\ast} = m-l$
\item[(v)] $|V_5| = c = j - 1$,
\item[(vi)] $|V_6| = d = m- j$,
\item[(vii)] $|v_7| = c^{\ast} = i$,
\item[(viii)] $|V_8| = d^{\ast} = n- i$.
\end{enumerate}

Therefore, here we have $2(n+m)-2((n-k)+(m-l)+(m-j)+(n-i))-2=2(k+l+j+i-(n+m))-2$.

Since Case 1 and Case 2 yields the same result, the result $irr_t(G') = irr_t(G'')$ follows from \ref{Thm-2.1}.
\end{proof}

An immediate consequence of Corollary \ref{Cor-2.6} is that for regular graphs $G_1$ and $G_2$ we have $irr_t(G_1\rightsquigarrow_{vu}G_2)_{\substack{u \in V(G_1)\\ v \in V(G_2)}}$ is a constant. This result is proved in the following proposition.

\begin{proposition}
For the regular graphs $G_1, G_2$ on $n, m$ vertices respectively with $d_{G_1}(u) \geq d_{G_2}(v)$ we have
\begin{equation*}
irr_t(G_1\rightsquigarrow_{uv}G_2)=
\begin{cases}
2(n+m) - 2, & \text {if $d_{G_1}(u) = d_{G_2}(v)$,}\\
n\cdot m|d_{G_1}(u)- d_{G_2}(v)| + 2(n-1), & \text {if $d_{G_1}(u) > d_{G_2}(v)$.}
\end{cases}
\end{equation*}
\end{proposition}
\begin{proof}
The proof follows immediately from definitions \ref{D-VSS1}, Remark \ref{Rem-2.3} and Corollary \ref{Cor-2.6}.
\end{proof}

We note that if $G_1$ and $G_2$ are of equal $k$-regularity, then $irr_t(G_1\rightsquigarrow_{uv}G_2)$ is independent of the \textit{$k$- degree} of the vertices.

\section{Total Irregularity Due to Edge-Transformation}

Consider a graph $G$ on $n = l_1 + l_2$ vertices and a cut edge $u_1v_1$. Let $G = (G_1 \cup G_2) + u_1v_1$, $u_1 \in V(G_1) = \{u_i: 1 \leq i \leq l_1\}$ and $v_1 \in V(G_2) = \{v_i: 1 \leq i \leq l_2\}$. Edge-transformation with respect to $u_1$ will be the graph $G^{u_iv_1}$ obtained by deleting the edge $u_1v_1$ and adding the edge $u_iv_1$ for any $i \neq 1$. We call $G_1$ the {\em master graph} and $G_2$ the {\em slave graph}.

\vspace{0.2cm}

Let us now introduce the notion of edge-transformation partitioning of a vertex set of a given graph as follows.

\begin{definition}\label{D-VSS2a}{\rm
The \textit{edge-transformation partitioning} of the vertex set $V(G)$ of a graph $G$ on $n$ vertices with at least one cut edge say $u_1v_1$, is defined to be $V_h = \{u_i, v_k:d_{G_1}(u_i) = d_{G_1}(u_1) -1\}$ and $d_{G_2}(v_k) = d_{G_1}(u_1) -1\}\cup \{u_1\}, h= |V_h|$, and $V_s = \{ u_i, v_k: d_{G_1}(u_i) > d_{G_1}(u_1)-1\}$ and $d_{G_2}(v_k) > d_{G_1}(u_1)-1\}, s=|V_s|$ and $V_t = \{ u_i, v_k: d_{G_1}(u_i) < d_{G_1}(u_1)-1\}$ and $d_{G_2}(v_k) < d_{G_1}(u_1)-1\}, t=|V_t|$.}
\end{definition}

\ni Invoking Definition \ref{D-VSS2a}, we now define certain vertex sets in $G$ as given below.

\begin{definition}{\rm
We define the certain important sets as follows. Let $V_{s_1} = \{u_j, v_k: d_{G_1}(u_j) \leq d_{G_1}(u_i)$ and $d_{G_2}(v_k) \leq d_{G_1}(u_i)$ and $u_j, v_k \in V_s \}, m = |V_{s_1}|$, and $V_{s_2} = \{u_j, v_k: d_{G_1}(u_j) > d_{G_1}(u_i)$ and $d_{G_2}(v_k) > d_{G_1}(u_i)$ and $u_j, v_k \in V_s \}, l = |V_{s_2}|$, and $V_{t_1} = \{u_j, v_k: d_{G_1}(u_j) \leq d(u_i)$ and $d_{G_2}(v_k) \leq d_{G_1}(u_i)$ and $u_j, v_k \in V_t \}, m_1 = |V_{t_1}|$, and $V_{t_2} = \{u_j, v_k: d_{G_1}(u_j) > d_{G_1}(u_i)$ and $d_{G_2}(v_k) > d_{G_1}(u_i)$ and $u_j, v_k \in V_t \}, l_1 = |V_{t_2}|$.}
\end{definition}

\ni In view of the above definitions, we propose the following theorem

\begin{theorem}\label{Thm-3.3}
For a graph $G$ with a cut edge $u_1v_1$, let $G-u_1v_1 = G_1 \cup G_2$. After edge-transformation in respect of $v_1$ we have
\begin{equation*}
irr_t(G^{u_iv_1})=
\begin{cases}
irr_t(G), & \text{if} \quad d_{G_1}(u_i) = d_{G_1}(u_1) -1,\\
irr_t(G) + 2m, & \text{if}\quad d_{G_1}(u_i) > d_{G_1}(u_1)-1,\\
irr_t(G) - 2(h + l_1), & \text{if}\quad d_{G_1}(u_i) < d_{G_1}(u_1)-1.
\end{cases}
\end{equation*}
\end{theorem}
\begin{proof}
If $d_{G_1}(u_i) = d_{G_1}(u_1) -1$,  then reducing $d_{G_1}(u_1)$ by 1, reduces the partial sum
$\sum \limits_{\substack{j=1\\w_j \in V_h}}^{h}|d_{G_1}(u_1)-d(w_j)|$ by exactly $(h-1)$. It also increases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_s}}^{s}|d_{G_1}(u_1)-d(w_j)|$ by exactly $s$ and finally it reduces the the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{t}|d_{G_1}(u_1)-d(w_j)|$ by exactly $t$.

\ni {\em Case 1:} By increasing $d_{G_1}(u_i), u_i \in V_h$ by $1$, the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_h}}^{h}|d_{G_1}(u_i)-d(w_j)|$ increases by exactly $(h-1)$. It also decreases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_s}}^{s}|d_{G_1}(u_i)-d(w_j)|$ by exactly $s$ and finally it increases the the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{t}|d_{G_1}(u_i)-d(w_j)|$ by exactly $t$. Hence, the result, $irr_t(G^{u_iv_1})=irr_t(G)-(h -1)+s-t +((h-1)-s+t)=irr_t(G)$ follows.

\ni {\em Case 2:} By increasing $d_{G_1}(u_i), u_i \in V_s$ by 1, the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_h}}^{h}|d_{G_1}(u_i)-d(w_j)|$ increases by exactly $h$. It also changes the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_s}}^{s}|d_{G_1}(u_i) - d(w_j)|$ by exactly $(m-1)-l$ and finally it increases the the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{t}|d_{G_1}(u_i)-d(w_j)|$ by exactly $t$. Hence, the result, $irr_t(G^{u_iv_1}) = irr_t(G) - (h -1) + s - t + h + (m-1) - l + t =  irr_t(G) + 2m$ follows.

\ni {\em Case 3:} By increasing $d_{G_1}(u_i), v_i \in V_t$ by 1, the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{h}|d_{G_1}(u_i)-d(w_j)|$ decreases by exactly $h$. It also decreases the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{s}|d_{G_1}(u_i)-d(w_j)|$ by exactly $s$ and finally it changes the the partial sum $\sum \limits_{\substack{j=1\\w_j \in V_t}}^{t}|d_{G_1}(u_i)-d(w_j)|$ by exactly $(m_1-1)-l_1$.

Hence, the result $irr_t(G^{u_iv_1})=irr_t(G)-(h-1)+s-t-(h-1)-2-s+(m_1-1)-l_1=irr_t(G)-2(h+l_1)$ follows.
\end{proof}

It is to be noted Theorem \ref{Thm-3.3} provides an alternate proof for the following that lemma provided in \cite{ZYY}.

\begin{lemma}
{\rm \cite{ZYY}} Let $G'$ be the graph obtained from $G$ by branch-transformation from $u$ to $v$. Then $irr_t(G) > irr_t(G')$.
\end{lemma}

\ni Theorem \ref{Thm-3.3} can be extended to multi graphs also as explained in the following result.

\begin {corollary}
If multiple edges or loops are allowed in the graph or if edge-transformation is performed in a simple graph without a cut edge to give $G^{w_iv_1}_{w_i \in G}$ then, we have
\begin{equation*}
irr_t(G^{u_iv_1})=
\begin{cases}
irr_t(G), & \text{if} \quad d_{G_1}(u_i) = d_{G_1}(u_1) -1,\\
irr_t(G) + 2m, & \text{if}\quad d_{G_1}(u_i) > d_{G_1}(u_1)-1,\\
irr_t(G) - 2(h + l_1), & \text{if}\quad d_{G_1}(u_i) < d_{G_1}(u_1)-1.
\end{cases}
\end{equation*}
\end{corollary}
\begin{proof}
The proof of this theorem follows immediately as a consequence of Theorem \ref{Thm-3.3}.
\end{proof}

\section{Total Irregularities of Directed Graphs}\label{Sec-4}

In this section, we extend the concept of total irregularities of graphs mentioned in above sections to directed graphs. Since the edges of a digraph $D$ are directed edges and the vertices of $D$ has two types of degrees, in-degrees and out-degrees, we need to define two types of total irregularities for a digraph, which are called total in-degree irregularities and total out-degree irregularities.

\ni Let the vertices of a simple directed graph $D^\rightarrow$ on $n$ vertices be labelled as $v_i; i= 1,2,3,\ldots,n$ and let $d^+_{D^\rightarrow}(v_i)=d^+(v_i)$ and $d^-_{D^\rightarrow}(v_i)=d^-(v_i)$. Then, the notion of total in-irregularity of a given directed graph is introduced as follows.

\begin{definition}{\rm
The {\em total in-irregularity} of a directed graph $D$ with respect to the in-degree of all vertices of $D$, denoted by $irr_t^-(D^\rightarrow)$, is defined as $irr_t^-(D^\rightarrow)=\frac{1}{2}\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}|d^-(v_i)-d^-(v_j)| =\sum\limits_{i=1}^{n} \sum \limits_{j=i+1}^{n}|d^-(v_i) - d^-(v_j)|$ or $\sum \limits_{i=1}^{n-1} \sum \limits_{j=i+1}^{n}|d^-(v_i) - d^-(v_j)|$.}
\end{definition}

\ni Similarly, the total out-irregularity of a digraph can also be defined as follows.

\begin{definition}{\rm
The {\em total out-irregularity} of a directed graph $D$ with respect to the out-degree of all vertices of $D$, denoted by $irr_t^+(D^\rightarrow)$, is defined as $irr_t^+(G^\rightarrow)=\frac{1}{2}\sum\limits_{i=1}^{n} \sum \limits_{j=1}^{n}|d^+(v_i) - d^+(v_j)| = \sum \limits_{i=1}^{n} \sum \limits_{j=i+1}^{n}|d^+(v_i)-d^+(v_j)|$ or $\sum \limits_{i=1}^{n-1} \sum \limits_{j=i+1}^{n}|d^+(v_i)-d^+(v_j)|$. }
\end{definition}

Re-orientation of an arc or arc-transformation of an arc will find application in most classical applications of directed graphs like tournaments, transportation problems, flow analysis or alike.

\subsection{Total Irregularities of Directed Paths and Cycles}

The total in-irregularity and the total out-irregularity of a directed path are determined in the following proposition.

\begin{proposition}
For a directed path $P_n^\rightarrow$ which is consecutively directed from left to right for which vertices $v_1, v_n$ are called the \textit{start-vertex} and the \textit{end-vertex} respectively, we have
\begin{enumerate}\itemsep0mm
\item[(i)] $irr_t^-(P_n^\rightarrow) = irr_t^+(P_n^\rightarrow)=n-1$,
\item[(ii)]
\begin{equation*}
irr^-_t(P_n^{\rightarrow}) =
\begin{cases}
n-1, & \text{if the orientation of}~ (v_1, v_2) \text{is reversed}, \\
3n-5, & \text{if the orientation of}~ (v_i, v_{i+1}), 2 \leq i \leq (n-1) \\ & \text{is reversed}
\end{cases}
\end{equation*}
\item[(iii)] \begin{equation*}
irr^+_t(P_n^{\rightarrow}) =
\begin{cases}
n-1 , & \text {if the orientation of}~ (v_{n-1}, v_n) \text{is reversed},\\
3n-5, & \text {if the orientation of}~ (v_i,v_{i+1}), \leq i\leq n-2 \\ &   \text{is reversed}.
\end{cases}
\end{equation*}
\end{enumerate}
\end{proposition}
\begin{proof}
The proof is obvious from the definition of total in-irregularity and total out-irregularity of a given digraph.
\end{proof}

The total in-irregularity and the total out-irregularity of a directed cycle are determined in the following proposition.

\begin{proposition}
For a directed cycle $C_n^\rightarrow$ which is consecutively directed clockwise we have
\begin{enumerate}\itemsep0mm
\item[(i)] $irr_t^-(C_n^\rightarrow)=irr_t^+(C_n^\rightarrow)=0$,
\item[(ii)] $irr_t^-(C_n^\rightarrow)=irr_t^+(C_n^\rightarrow)=2(n-1)$, if we reverse the orientation of any arc.
\end{enumerate}
\end{proposition}
\begin{proof}
The proof is obvious from the definition of total in-irregularity and total out-irregularity of a given digraph.
\end{proof}

\ni Through a simple change of Definition \ref{D-VSS2a} the in-arc-transformation partitioning in respect of $v_1$ and the out-arc-transformation partitioning in respect of $v_1$ can be defined.

\begin{definition}\label{Def-4.3}{\rm
The \textit{in-arc-transformation partitioning} with respect to a vertex $v_i$ of the vertex set $V(G)$ of a simple connected directed graph $G^\rightarrow$ on $n$ vertices is defined to be $V_h = \{v_i:d^-(v_i) = (d^-(v_1) -1)\} \cup \{v_1\}, h= |V_h|$, and $V_s = \{ v_i: d^-(v_i) > (d^-(v_1)-1)\}, s=|V_s|$ and $V_t = \{ v_i: d^-(v_i) < (d^-(v_1)-1)\}, t=|V_t|$.}
\end{definition}

\ni In view of Definition \ref{Def-4.3}, we define the following sets

\begin{definition}\label{Def-4.4}{\rm
Invoking the above definition, some vertex sets of a given digraph are defined as follows. $V_{s_1} = \{v_j:| d^-(v_j) \leq d^-(v_i), v_j \in V_s\}, m = |V_{s_1}|$ and $V_{s_2} = \{v_j: d^-(v_j) > d^-(v_i), v_j \in V_s\}, l = |V_{s_2}|$ and $V_{t_1} = \{v_j: d^-(v_j) \leq d^-(v_i), v_j \in V_t \}, m_1 = |V_{t_1}|$ and $V_{t_2} = \{v_j: d^-(v_j) > d^-(v_i), v_j \in V_t\}, l_1 = |V_{t_2}|$.}
\end{definition}

\begin{definition}\label{Def-4.5} {\rm
The \textit{out-arc-transformation partitioning} with respect to a vertex $v_i$ of the vertex set $V(G^\rightarrow)$ of a simple connected directed graph $G^\rightarrow$ on n vertices is defined to be $V_{h^{\ast}} = \{v_i:d^+(v_i) = (d^+(v_1) -1)\} \cup \{v_1\}, h^{\ast}= |V_{h^{\ast}}|$, and $V_{s^{\ast}} = \{ v_i: d^+(v_i) > (d^+(v_1)-1)\}, s^{\ast}=|V_{s^{\ast}}|$ and $V_{t^{\ast}} = \{ v_i: d^+(v_i) < (d^+(v_1)-1)\}, t^{\ast}=|V_{t^{\ast}}|$.}
\end{definition}

\ni In view of Definition \ref{Def-4.5}, we define the following sets

\begin{definition}\label{Def-4.6}{\rm
Invoking the above definition, some vertex sets of a given digraph are defined as follows. $V_{s^{\ast}_1} = \{v_j: d^+(v_j) \leq d^+(v_i), v_j \in V_s\}, m^{\ast} = |V_{s^{\ast}_1}|$ and $V_{s^{\ast}_2} = \{v_j: d^+(v_j) > d^+(v_i), v_j \in V_s\}, l^{\ast} = |V_{s^{\ast}_2}|$ and $V_{t^{\ast}_1} = \{v_j: d^+(v_j) \leq d^+(v_i), v_j \in V_t \}, m^{\ast}_1 = |V_{t^{\ast}_1}|$ and $V_{t^{\ast}_2} = \{v_j: d^+(v_j) > d^+(v_i), v_j \in V_t\}, l^{\ast}_1 = |V_{t^{\ast}_2}|$. }
\end{definition}

\ni Analogous to Theorem \ref{Thm-3.3}, we propose the following result.

\begin{proposition}
Consider a simple connected directed graph $G$. After in-arc-transformation in respect of $v_1$ we have
\begin{enumerate}
\item[(i)]
\begin{equation*}
irr_t^-(G^{v_iu_1})=
\begin{cases}
irr_t^-(G) , & \text{if}\quad d^-(v_i) = d^-(v_1) -1\\
irr_t^-(G) + 2m, & \text{if}\quad d^-(v_i) > d^-(v_1)-1, \\
irr_t^-(G) - 2(h + l_1), & \text{if}\quad d^-(v_i) < d^-(v_1)-1
\end{cases}
\end{equation*}
and
\item[(ii)]
\begin{equation*}
irr_t^+(G^{v_iu_1})=
\begin{cases}
irr_t^+(G) , & \text {if}\quad d^+(v_i)=d^+(v_1)-1,\\
irr_t^+(G) + 2m^{\ast}, & \text {if}\quad d^+(v_i) > d^+(v_1)-1,\\
irr_t^+(G) - 2(h^{\ast} + l^{\ast}_1), & \text {if}\quad d^+(v_i) < d^+(v_1)-1.
\end{cases}
\end{equation*}
\end{enumerate}
\end{proposition}
\begin{proof}
The proof is similar to Theorem \ref{Thm-3.3}.
\end{proof}

\subsection{Total Irregularities of Directed Complete Graphs}

In this section, we initiate a study on the two types of irregularities of directed complete graphs. Consider a complete undirected graph $K_n$ and label the vertices $v_1, v_2, v_3, \ldots, v_n$. Assign direction the edges of $K_n$ to get a directed graph, with $K_n$ as its underlying graph, in such a way that the edge $v_iv_j$ becomes the  arc $(v_i,v_j)$ of this directed graph if $i<j$. We denote this directed graph by $K^\rightarrow_n$. The following lemma discusses the two types of irregularities of $K^\rightarrow_n$.

\begin{lemma}\label{Lem-4.8}
 For the directed complete graph $K^{\rightarrow}_n$, the total irregularities are given by $irr_t^+ (K^{\rightarrow}_n) = irr_t^- (K^\rightarrow_n)= \sum \limits_{i=1}^{n-1}\sum \limits_{j=1}^{i}j =\frac{1}{6}n(n^2-1)$.
\end{lemma}
\begin{proof}
The orientation results in an in-degree sequence $(0,1,2,\ldots,(n-1))$ and an out-degree sequence $(n-1,n-2,n-3,\ldots,0)$. Choose the $k$-th entry of the in-degree sequence. We know that the $k$-th term is given by $\sum\limits_{j=k+1}^{n} |d^-(v_k)-d^-(v_j)|=\sum \limits_{i=1}^{n-(k+1)}i$. Also, we have $irr_t^-=\sum \limits_{i=1}^{n-1} \sum \limits_{j=i+1}^{n}|d^-(v_i) - d^-(v_j)|$ and hence $irr_t^-(K^\rightarrow_n)=\sum\limits_{i=1}^{n-1}i+\sum \limits_{i=1}^{n-2}i+\ldots +\sum\limits_{i=1}^{n-(n-1)}i=\sum\limits_{i=1}^{n-1}\sum\limits_{j=1}^{i}j=\frac{1}{6}n(n^2-1)$. Furthermore, since the out-degree sequence is a mirror image of the in-degree sequence and $irr_t^+ = \sum \limits_{i=1}^{n-1} \sum \limits_{j=i+1}^{n}|d^+(v_i) - d^+(v_j)|$, the result follows similarly.
\end{proof}

\ni A general application this study can be the following.

Consider any connected undirected graph $G$ on $n$ vertices and label its vertices randomly by $v_1, v_2, v_3, \ldots, v_n$. Assign direction to the edges of the graph $G$ to be arcs according to the condition mentioned above and refer to the directed graph as the {\em root directed graph}, $G^\rightarrow_{root-graph}$. Then, calculate both $irr_t^+(G^\rightarrow_{root-graph})$ and $irr_t^-(G^\rightarrow_{root-graph})$. In a {\em derivative graph} $G^\rightarrow_{derivative}$ identify all arcs which were re-oriented or subjected to arc-transformation and apply the applicable results to recursively determine the total in-irregularity and total out-irregularity.

Consider the complete bipartite graph $K_{(m, n)}$ and call the $m$ vertices in the first bipartition by {\em left-side vertices} and the $n$ vertices in the second bipartition by {\em right-side vertices}. Assign directions to the edges of $K_{m,n}$ strictly from {\em left-side vertices} to \textit{right-side vertices} to obtain $K^{l \rightarrow r}_{m, n}$.

\begin{proposition}\label{Prop-4.9}
For the directed graph $K^{l \rightarrow r}_{m,n}$, we have $irr^-_t(K^{l \rightarrow r}_{m,n}) = m^2n$ and $irr^+_t(K^{l \rightarrow r}_{m,n}) = mn^2$.
\end{proposition}
\begin{proof}
The orientation of the directed complete bipartite graph $K^{l \rightarrow r}_{m,n}$ results in the in-degree sequence $(\underbrace{0, 0, \ldots, 0,}_{m-entries} \underbrace{m, m, \ldots, m}_{n-enties})$ and the out-degree sequence $( \underbrace{n,n,\ldots,n,}_{m-entries}\\ \underbrace{0, 0, \ldots, 0}_{n-enties})$. Here, we have the following cases.

\ni \textit{Case 1:} For the above mentioned in-degree sequence of $K^{l \rightarrow r}_{m,n}$, we have the sum $\sum\limits_{i=1}^{(m+n)-1}\sum\limits_{j=(i+1)}^{(m+n)}|d^-(v_i)-d^-(v_j)|$ results in the value $m$, ($mn$ times) and $0$, ($(m+n)-2$ times). Hence, $irr_t^-(K^{l \rightarrow r}_{(m,n)}) = m^2n$.

\ni \textit{Case 2:} For the above mentioned out-degree sequence of $K^{l \rightarrow r}_{m,n}$, we have the sum $\sum\limits_ {i=1}^{(m+n)-1}\sum\limits_{j= (i+1)}^{(m+n)}|d^+(v_i)-d^+(v_j)|$ results in the value $n$, ($mn$ times) and $0$, ($(m+n)-2$) times).  Hence, $irr_t^+(K^{l \rightarrow r}_{(1, n)}) = mn^2$. This completes the proof.
\end{proof}

Invoking from Proposition \ref{Prop-4.9}, we note that for the directed bipartite graph $K^{l \rightarrow r}_{1,n}$, we have $irr^-_t(K^{l \rightarrow r}_{1,n}) = n$ and $irr^+_t(K^{l \rightarrow r}_{(1, n)}) = n^2$ and $irr^-_t(K^{l \rightarrow r}_{m,1}) = m^2$ and $irr^+_t(K^{l\rightarrow r}_{m,1})=m$.

\ni The following is a challenging and interesting problem in this context.

\begin{problem}{\rm
Describe an efficient algorithm to determine $irr_t^- (G^\rightarrow_{derivative})$ and $irr_t^+(G^\rightarrow_{derivative})$  from $irr_t^-(G^\rightarrow_{root-graph})$ and $irr_t^+(G^\rightarrow_{root-graph})$.}
\end{problem}

\section{Conclusion}

In this paper, we have studied certain types of total irregularities of certain graphs and digraphs. More problems in this area still remain unsettled. More studies on different types of irregularities for different graph classes, graph operations, graph products and on certain associated graphs such as line graphs and total graphs of given graphs and digraphs remain open. All these facts indicates that there is a wide scope for further investigations in this area.


\section{\@startsection {section}{1}{\z@}
{-30pt \@plus -1ex \@minus -.2ex}
{2.3ex \@plus.2ex}
{\normalfont\normalsize\bfseries}}

\renewcommand\subsection{\@startsection{subsection}{2}{\z@}
{-3.25ex\@plus -1ex \@minus -.2ex}
{1.5ex \@plus .2ex}
{\normalfont\normalsize\bfseries}}

\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname. }

\makeatother

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}

\newtheorem{remark}[theorem]{Remark}
\newtheorem{example}[theorem]{Example}
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\begin{center}
\uppercase{\bf On the Stern sequence and its twisted version}
\vskip 20pt
{\bf J.-P. Allouche}\\
{\smallit CNRS, Institut de Math., \'Equipe Combinatoire et Optimisation \\
Universit\'e Pierre et Marie Curie, Case 247 \\
4 Place Jussieu \\
F-75252 Paris Cedex 05 \\
France \\
}
{\tt allouche@math.jussieu.fr}\\
\end{center}
\vskip 30pt

\centerline{\smallit Received: , Revised: , Accepted: , Published: }
\vskip 30pt

\centerline{\bf Abstract}

\noindent
In a recent preprint on ArXiv, Bacher introduced a twisted version of the Stern
sequence. His paper contains in particular three conjectures relating the generating series
for the Stern sequence and for the twisted Stern sequence. Soon afterwards Coons published
two papers in {\it Integers}: first he proved these conjectures, second he used his result
to obtain a correlation-type identity for the Stern sequence. We recall here a simple
result of Reznick and we state a similar result for the twisted Stern sequence.
We deduce an easy proof of Coons' identity, and a simple proof of Bacher's conjectures.
Furthermore we prove identities similar to Coons' for variations on the Stern sequence
that include Bacher's sequence.

\pagestyle{myheadings}
\markright{\smalltt INTEGERS: xx (XXXX)\hfill}
\thispagestyle{empty}
\baselineskip=12.875pt
\setcounter{page}{1}
\vskip 30pt

\section{Introduction}

The Stern sequence is a sequence of integers ${\mathbf s} = (s(n))_{n \geq 0}$
that can be defined inductively by $s(0) = 0$, $s(1) = 1$, and for all $n \geq 1$,
$s(2n) = s(n)$ and $s(2n+1) = s(n)+s(n+1)$. (Note that these two equalities are
actually true for all $n \geq 0$.) This is sequence~A002487 in \cite{oeis}.
Its first few terms are
$$
0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1 \ldots
$$
Several authors studied that sequence, see, e.g., \cite{Urbiha, Northshield} and the
references therein. (Note that some authors call Stern sequence the shifted sequence
$(s(n+1))_{n \geq 0}$.)

\medskip

Bacher introduced recently in \cite{Bacher} a twisted version of the Stern sequence
${\mathbf t} = (t_n)_{n \geq 0}$ defined inductively by $t(0) = 0$, $t(1) = 1$, and
for all $n \geq 1$, $t(2n) = -t(n)$, $t(2n+1)= -t(n) - t(n+1)$. He gave several
interesting properties of the sequences ${\mathbf s}$ and ${\mathbf t}$ and formulated
conjectural relations between the generating series $\sum s(n) X^n$, $\sum t(3.2^e + n) X^n$,
$\sum (s(2+n)-s(1+n))X^n$, and $\sum(t(2+n)+t(1+n))X^n$.

\medskip

In the recent paper \cite{Coons-conj} Coons proved Bacher's conjectures. He then used
in \cite{Coons} his results to prove the following identity for the Stern sequence:
if $e$ and $r$ are integers with $e \geq 0$, then for every integer $n \geq 0$
$$
s(r)s(2n+5) + s(2^e-r)s(2n+3) = s(2^e(n+2)+r) + s(2^e(n+1)+r).
$$

\medskip

We recall here (see Section~\ref{Rez}) a result of Reznick in \cite{Reznick}, and we
deduce an easy proof of Coons' identity. We also prove a result similar to Reznick's result
for the Bacher-Stern sequence which yields a short proof of Bacher's conjectures.
Furthermore we prove identities analogous to Reznick's and Coons' identities for sequences
satisfying recurrence relations similar to Stern's which include Bacher's sequence.

\section{Three auxiliary results}

We start with three propositions. The first one is \cite[Corollary~4]{Reznick} for
which Reznick gives a short proof.

\begin{proposition}{\rm \cite{Reznick}}\label{main}
Let $e$ and $r$ be integers with $e \geq 0$ and $0 \leq r \leq 2^e$.
Then, for every integer $n \geq 0$, we have
$$
s(2^e n + r) = s(r)s(n+1) + s(2^e - r)s(n).
$$
\end{proposition}

The next Proposition is similar to Proposition~\ref{main}.

\begin{proposition}\label{sim-main}
Let $e$ and $r$ be integers with $e \geq 0$ and $0 \leq r \leq 2^e$.
Then, for every integer $n \geq 1$, we have
$$
t(2^e n + r) = (-1)^e(s(r)t(n+1) + s(2^e - r)t(n)).
$$
\end{proposition}

\proof We prove by induction on $e \geq 0$ that, for every $r \in [0, 2^e]$, the identity
in the proposition holds. This is immediate for $e=0$ (thus $r \in \{0, 1\}$). If the result
is true for some $e$, then, using the definition of ${\mathbf t}$, the induction hypothesis,
and the definition of ${\mathbf s}$, we have

\begin{itemize}

\item if $2r \in [0, 2^{e+1}]$, then
$$
\begin{array}{ll}
t(2^{e+1} n + 2r) &= - t(2^e n + r) = (-1)^{e+1} (s(r)t(n+1) + s(2^e - r)t(n)) \\
&= (-1)^{e+1}(s(2r)t(n+1) + s(2^{e+1} - 2r)t(n)); \\
\end{array}
$$

\item if $2r+1 \in [0, 2^{e+1}]$, then
$$
\begin{array}{ll}
t(2^{e+1} n + 2r + 1) &= t(2(2^e n + r)+1) = - t(2^e n + r) - t(2^e n + r + 1) \\
&= \left\{
\begin{array}{ll}
        (-1)^{e+1}(s(r)t(n+1) + s(2^e - r)t(n)) \\
         \ \ + (-1)^{e+1}(s(r+1)t(n+1) + s(2^e - r - 1)t(n)) \\
\end{array}
\right. \\
&= \left\{
\begin{array}{ll}
        (-1)^{e+1} (s(r) + s(r+1))t(n+1) \\
         \ \ + (-1)^{e+1} (s(2^e - r) + s(2^e - r - 1))t(n) \\
\end{array}
\right. \\
&= (-1)^{e+1} (s(2r+1)t(n+1) + s(2(2^e - r - 1) + 1) \\
&= (-1)^{e+1} (s(2r+1)t(n+1) + s(2^{e+1} - 2r - 1)t(n).
\end{array}
$$

\end{itemize}

The last result we need is a consequence of Proposition~\ref{main}.

\begin{proposition}\label{sum-s}
Let $S(X) = \sum_{n \geq 0} s(N) X^n$. Then
$$
S(X) = S(X^{2^e}) \sum_{0 \leq r \leq 2^e-1} (s(2^e-r)X^r + s(r)X^{r-2^e}).
$$
\end{proposition}

\proof This is an easy consequence of Proposition~\ref{main}
(also recall that $s(0)=0$): we write
$$
\begin{array}{ll}
S(X) &= \displaystyle\sum_{n \geq 0} s(n) X^n =
\displaystyle\sum_{0 \leq r \leq 2^e-1} \sum_{k \geq 0} s(k.2^e + r) X^{k.2^e + r} \\
&= \displaystyle\sum_{0 \leq r \leq 2^e-1} X^r
     \sum_{k \geq 0}(s(r)s(k+1) + s(2^e - r)s(k)) X^{k.2^e} \\
&= \displaystyle\sum_{0 \leq r \leq 2^e-1} (s(r) X^{r-2^e} + s(2^e - r)X^r)
     \sum_{k \geq 0} s(k)X^{k.2^e} \\
&= S(X^{2^e}) \displaystyle\sum_{0 \leq r \leq 2^e-1} (s(r) X^{r-2^e} + s(2^e - r)X^r).
\end{array}
$$

\begin{remark}
{\rm Note that, as indicated by the referee, Proposition~\ref{sum-s} is essentially Lemma~8 of
\cite{Coons-conj} which states that for all $k \geq 0$
$$
X \prod_{0 \leq i \leq k-1} \left(1 + X^{2^i} + X^{2^{i+1}}\right)
= \sum_{1 \leq n \leq 2^k} s(n) X^n + \sum_{1 \leq n \leq 2^k-1} s(2^k-n) X^{n+2^k}.
$$
This can be deduced from the following property of the generating function for $(s(n))$
$$
S(X^2) = \left(\frac{X}{1+X+X^2}\right) S(X)
$$
(see the paper of Carlitz \cite[p.\ 19]{Carlitz}, where the shifted sequence
$(\Theta_0(n)) = (s(n+1))$ is studied).}
\end{remark}

\section{A direct proof of Coons' identity}\label{Rez}

Theorem~1 of \cite{Coons} is a straightforward corollary of Reznick's result
(Proposition~\ref{main} above).

\begin{corollary}\label{Coons}
Let $e$ and $r$ be integers with $e \geq 0$ and $0 \leq r \leq 2^e$.
Then, for every integer $n \geq 0$, we have
$$
s(r)s(2n+5) + s(2^e-r)s(2n+3) = s(2^e(n+2)+r) + s(2^e(n+1)+r).
$$
\end{corollary}

\proof Let $S(e,r,n) = s(2^e(n+2)+r) + s(2^e(n+1)+r)$. Applying Proposition~\ref{main}
with $n$ replaced by $n+2$ and $n+1$, and the definition of the sequence
${\mathbf s}$ yields
$$
\begin{array}{lll}
S(e,r,n)
&=& s(r)s(n+3) + s(2^e - r)s(n+2) + s(r)s(n+2) + s(2^e - r)s(n+1) \\
&=& s(r)(s(n+3)+s(n+2)) + s(2^e - r)(s(n+2)+s(n+1))\\
&=& s(r)s(2n+5) +  s(2^e - r)s(2n+3). \\
\end{array}
$$

\section{A simple proof of Bacher's conjectures}

We can now prove the three conjectures that Bacher proposed in \cite{Bacher} (Conjectures~1.3,
3.2~(i), and 3.2~(ii)) as Theorems~\ref{B-conj1}, \ref{B-conj2}, and \ref{B-conj3} below.

\begin{theorem}\label{B-conj1}
Let $S(X) = \sum_{n \geq 0} s(n) X^n$ and $T(X) = \sum_{n \geq 0} t(n) X^n$ be the
generating series of ${\mathbf s}$ and ${\mathbf t}$. Then, there exists a series
$U(X) = \sum_{n \geq 0} u(n) X^n$ with integral coefficients, such that
$$
\forall e \geq 0, \ \sum_{n \geq 0} t(3.2^e + n) X^n = (-1)^e U(X^{2^e}) S(X).
$$
\end{theorem}

\proof The series $U(X)$ must satisfy in particular
$\sum_{n \geq 0} t(3+n) X^n = U(X) S(X)$. This relation {\it defines} a series
$U(X)$ that clearly has integer coefficients ($s(1) = 1$, and $s(0)=0$).
Now, using Proposition~\ref{sim-main} above, the definition of $U(X)$, and
Proposition~\ref{sum-s}, we have
$$
\begin{array}{ll}
\displaystyle\sum_{n \geq 0} t(3.2^e + n) X^n &= \
\displaystyle\sum_{0 \leq r \leq 2^e-1} \sum_{k \geq 0} t(3.2^e + k.2^e + r) X^{k.2^e + r} \\
&= \displaystyle\sum_{0 \leq r \leq 2^e-1} X^r \sum_{k \geq 0} t(2^e(3+k) + r) X^{k.2^e} \\
&= \displaystyle\sum_{0 \leq r \leq 2^e-1} X^r \sum_{k \geq 0}
    (-1)^e(s(r)t(k+4) + s(2^e - r)t(k+3)) X^{k.2^e} \\
&= \displaystyle(-1)^e\sum_{0 \leq r \leq 2^e-1} (s(2^e-r)X^r + s(r)X^{r-2^e})
   \sum_{k \geq 0} t(3+k) X^{k.2^e} \\
&= \displaystyle(-1)^e\sum_{0 \leq r \leq 2^e-1} (s(2^e-r)X^r + s(r)X^{r-2^e})
   U(X^{2^e})S(X^{2^e}) \\
&= (-1)^e S(X) U(X^{2^e}). \\
\end{array}
$$

\begin{theorem}\label{B-conj2}
Let $A(X) = \displaystyle\frac{1}{S(X)} \sum_{n \geq 0} (s(2+n) - s(1+n)) X^n$.
Then
$$
\sum_{n \geq 0} (s(2^{e+1} + n) - s(2^e + n)) X^n = A(X^{2^e}) S(X).
$$
\end{theorem}

\proof Let $A_e(X) = \displaystyle\sum_{n \geq 0} (s(2^{e+1} + n) - s(2^e + n)) X^n$.
We write, using Proposition~\ref{main} and Proposition~\ref{sum-s} (recall that $s(2)-s(1)=0$),
$$
\begin{array}{ll}
A_e(X) &=
\displaystyle\sum_{0 \leq r \leq 2^e - 1}
\sum_{k \geq 0} (s(2^{e+1} + k.2^e + r) - s(2^e + k.2^e + r)) X^{k.2^e} \\
&= \displaystyle\sum_{0 \leq r \leq 2^e - 1} X^r
\sum_{k \geq 0} (s(2^e(k+2)+r) - s(2^e(k+1)+r)) X^{k.2^e}. \\
\end{array}
$$
Thus
$$
\begin{array}{ll}
A_e(X) &= \left\{
\begin{array}{ll}
\displaystyle\sum_{0 \leq r \leq 2^e - 1} X^r
\sum_{k \geq 0} ((s(r)s(k+3) + s(2^e-r)s(k+2)) X^{k.2^e} \\
- \displaystyle\sum_{0 \leq r \leq 2^e - 1} X^r (s(r)s(k+2) + s(2^e-r)s(k+1))X^{k.2^e} \\
\end{array}
\right. \\
&= \left\{
\begin{array}{ll}
\displaystyle\sum_{0 \leq r \leq 2^e - 1} s(r) X^r \sum_{k \geq 0} (s(k+3)-s(k+2)) X^{k.2^e} \\
+ \displaystyle\sum_{0 \leq r \leq 2^e - 1} s(2^e-r) X^r \sum_{k \geq 0} (s(k+2)-s(k+1))X^{k.2^e} \\
\end{array}
\right. \\
&=
\displaystyle\sum_{0 \leq r \leq 2^e - 1} (s(r) X^{r-2^e} + s(2^e-r)) X^r
\displaystyle\sum_{k \geq 0} (s(k+2)-s(k+1))X^{k.2^e} \\
&=
\displaystyle\frac{S(X)}{S(X^{2^e})} \sum_{k \geq 0} (s(k+2)-s(k+1))X^{k.2^e} = S(X) A(X^{2^e}). \\
\end{array}
$$

\begin{theorem}\label{B-conj3}
Let $B(X) = \displaystyle\frac{1}{S(X)} \sum_{n \geq 0} (t(2+n) + t(1+n)) X^n$.
Then
$$
(-1)^{e+1} \sum_{n \geq 0} (t(2^{e+1} + n) + t(2^e + n)) X^n = B(X^{2^e}) S(X).
$$
\end{theorem}

\proof The proof is the same as the proof of Theorem~\ref{B-conj2}, except that we use
Propositions~\ref{sim-main} and \ref{sum-s} instead of Propositions~\ref{main} and \ref{sum-s}.

\section{Similar sequences}

Proposition~\ref{sim-main} gives an expression of $t(2^e n + r)$ in terms of $t(n)$ and
$t(n+1)$ with coefficients in terms of ${\mathbf s}$. One might want to find relations
of the same kind but involving ${\mathbf t}$ only. In this section we give such a relation.
More generally we prove such relations for sequences satisfying recurrence relations similar
to the recurrences defining the Stern sequence.

\begin{theorem}\label{general}
Let ${\mathbf v} = (v(n))_{n \geq 0}$ be a sequence of real numbers satisfying
$$
\exists n_0 \geq 0, \ \exists (a, b, c) \in {\mathbb R}^3, \ \forall n \geq n_0 \
v(2n) = a v(n) \ \mbox{\rm and} \ v(2n+1) = bv(n) + cv(n+1).
$$
Then, for all integers $(e,r)$ with $e \geq 0$ and $r \in [0, 2^e]$, there exist
$A = A(e,r)$ and $B = B(e,r)$ such that for all $n \geq n_0$
$$
v(2^e n + r) = A(e,r) v(n) + B(e,r) v(n+1).
$$
\end{theorem}

\proof We prove by induction on $e$ that for all $r \in [0, 2^e]$, there exist
$A(e,r)$ and $B(e,r)$ satisfying the conditions in the theorem.
For $e=0$, hence $r \in \{0,1\}$ one gets from the definition of ${\mathbf v}$ that
$A(0,0) = 1$, $B(0,0) = 0$, $A(0,1) = 0$, and $B(0,1) = 1$. Going from $e$ to $e+1$
yields $A(e+1,2r) = a A(e,r)$, $B(e+1, 2r) = a B(e,r)$, if $0 \leq 2r \leq 2^{e+1}$,
and $A(e+1,2r+1) = bA(e,r) + cA(e,r+1)$, $B(e+1, 2r+1) = bB(e,r) + cB(e,r+1)$, if
$0 \leq 2r+1 \leq 2^{e+1}$.

\begin{corollary}\label{cor-general}
Let ${\mathbf v} = (v(n))_{n \geq 0}$ be a sequence of real numbers satisfying
$$
\exists n_0 \geq 0, \ \exists (a, b, c) \in {\mathbb R}^3, \ \forall n \geq n_0 \
v(2n) = a v(n) \ \mbox{\rm and} \ v(2n+1) = bv(n) + cv(n+1).
$$
Then, for all integers $(e,r)$ with $e \geq 0$ and $r \in [0, 2^e]$, there exist
$A = A(e,r)$ and $B = B(e,r)$ such that for all $n \geq n_0$
$$
A(e,r)v(2n+3) + B(e,r)v(2n+5) = cv(2^e(n+2)+r) + bv(2^e(n+1)+r).
$$
\end{corollary}

\proof Apply Theorem~\ref{general} with $n$ replaced by $n+2$ and $n+1$
to the left side of the identity to be proven.

\begin{remark}
{\rm The quantities $A(e,r)$ and $B(e,r)$ can of course be computed in terms of $e,r$
and of certain values of ${\mathbf v}$. For example if the sequence ${\mathbf v}$ is not
trivial, there exist two integers $x_0$ and $y_0$ with $x_0, y_0 \geq n_0$ such that
$
\left|
\begin{array}{cc}
v(x_0) & v(x_0+1) \\
v(y_0) & v(y_0+1) \\
\end{array}
\right| \neq 0.
$
Then
$$
\begin{array}{ll}
v(2^e x_0 + r) &= A(e,r) v(x_0) + B(e,r) v(x_0+1) \\
v(2^e y_0 + r) &= A(e,r) v(y_0) + B(e,r) v(y_0+1) \\
\end{array}
$$
yields
$$
A(e,r) = (v(y_0)v(x_0 +1) - v(x_0)v(y_0 +1))^{-1}
(v(x_0+1)v(2^e y_0+r) - v(y_0+1)v(2^e x_0+r))
$$
and
$$
B(e,r) = (v(x_0)v(y_0 +1) - v(y_0)v(x_0 +1))^{-1}
(v(x_0)v(2^e y_0+r) - v(y_0)v(2^e x_0+r)).
$$
}
\end{remark}

\section{Examples}

\subsection{The Stern sequence again}

One can apply Theorem~\ref{general} to the Stern sequence, for which
$n_0 = 0$, $a=b=c=1$. The values of $A$ and $B$ can be obtained by taking
$n=0$ and $n=1$ in the relation $s(2^e n + r) = A(e, r)s(n) + B(e, r)s(n + 1)$,
yielding $B(e,r) = s(r)$ and $A(e,r) = s(2^e n + r) - s(r)$. To obtain the result
of Proposition~\ref{main} and Corollary~\ref{Coons} this way, it remains to prove that
for all $e \geq 0$ and $r \in [0, 2^e]$ one has $s(2^e + r) - s(r) = s(2^e-r)$.
This last equality can be proven by induction on $e$, but this is also
Corollary~3.1 in \cite{DS} (see also \cite[Theorem~1.2]{Bacher} where the
author adds that this identity ``is probably well-known to the experts'').

\subsection{The case of Bacher's twisted Stern sequence}

The definition of Bacher's twisted Stern sequence ${\mathbf t} = (t(n))_{n \geq 0}$
recalled in the Introduction shows that ${\mathbf t}$ satisfies the hypotheses of
Theorem~\ref{general} with $a=b=c=-1$, and $n_0 = 1$. Note that the first few terms
of ${\mathbf t}$ are:
$$
0, 1, -1, 0, 1, 1, 0, -1, -1, -2, -1, -1, 0, 1, 1, 2, \ldots
$$
Applying Theorem~\ref{general} and Corollary~\ref{cor-general} we get
the following results.

\begin{theorem}\label{similar}
Let $e$ and $r$ be integers with $e \geq 0$ and $0 \leq r \leq 2^e$. Then, for every
integer $n \geq 1$, we have
$$
t(2^e n + r) = - t(2^{e+1} + r)t(n) - t(3.2^e - r)t(n+1).
$$
\end{theorem}

\proof From Theorem~\ref{general} we have the existence of $A'$ and $B'$ such that
$t(2^e n + r) = A'(e,r)t(n) + B'(e,r) t(n+1)$ for $n \geq 1$. Taking $n=2$ and using
that $t(2) = -1$ and $t(3) = 0$, we get $A'(e,r) = - t(2^{e+1}+r)$. Now taking $n=1$
yields $t(2^e + r) = A'(e,r) - B'(e,r)$. Hence $B'(e,r) = A'(e,r) - t(2^e + r)$, i.e.,
$B'(e,r) = - t(2^{e+1}+r) - t(2^e + r)$. An immediate induction on $e$ shows that for
$r \in [0, 2^e]$ one has $t(2^{e+1}+r) + t(2^e + r) = t(3.2^e - r)$. Hence the result.

\begin{corollary}
Let $e$ and $r$ be integers with $e \geq 0$ and $0 \leq r \leq 2^e$.
Then, for every integer $n \geq 0$, we have
$$
t(2^{e+1} + r)t(2n+3) + t(3.2^e-r)t(2n+5) = t(2^e(n+2)+r) + t(2^e(n+1)+r).
$$
\end{corollary}

\subsection{Other variations on Stern's sequence}

Let the three sequences $(z_1(n))_{n \geq 0}$, $(z_2(n))_{n \geq 0}$,
and $(z_3(n))_{n \geq 0}$ defined by (using the notation of \cite{oeis}):
for all $n \geq 0$, $z_1(n) = A005590(n)$, and for all $n \geq 1$,
$z_2(n) = A177219(n)$, and $z_3(n) = A049347(n)$ with $z_2(0) = z_3(0) = 0$.
These sequences satisfy respectively
$$
(z_1(0), z_1(1)) = (0, 1), \ \mbox{\rm and} \ \forall n \geq 1,
z_1(2n) = z_1(n), \ z_1(2n+1) = -z_1(n) + z_1(n+1),
$$
$$
(z_2(0), z_1(1)) = (0,1), \ \mbox{\rm and} \ \forall n \geq 1,
z_2(2n) = -z_2(n), \ z_2(2n+1) = -z_2(n) + z_2(n+1),
$$
$$
(z_3(0), z_3(1)) = (0,1), \ \mbox{\rm and} \ \forall n \geq 1,
z_3(2n) = -z_3(n), \ z_3(2n+1) = z_3(n) + z_3(n+1).
$$
Note that he last sequence $(z_3(n))_{n \geq 0}$ is the $3$-periodic sequence
with period $(0, 1, -1)$ (hint: prove by induction on $n$ that for all $j \leq n$
one has $(z_3(3j), z_3(3j+1),z_3(3j+2)) = (0, 1, -1)$). Also note that all relations
$z_i(2n) = \pm z_i(n)$ and $z_i(2n+1) = \pm z_i(n) + z_i(n+1)$, $i = 1, 2, 3$, are
actually valid for $n \geq 0$.

We know from Theorem~\ref{general} that, for all $e \geq 0$ and $r \in [0, 2^e]$,
there exist $A_i(e,r)$ and $B_i(e,r)$ such that for all $n \geq 0$ we have
$$
z_i(2^e n + r) = A_i(e,r) z_i(n) + B_i(e,r) z_i(n+1).
$$
Taking $n = 0$ yields $B_i(e,r) = z_i(r)$ (for $i = 1, 2, 3$). Taking $n = 2$, and
using that $z_1(2) = 1$, $z_3(2) = -1$, and $z_1(3) = z_3(3) = 0$, we get
$A_1(e,r) = z_1(2^{e+1} + r)$ and $A_3(e,r) = -z_3(2^{e+1} + r)$.
Now taking $n=1$ yields $A_2(e,r) = z_2(2^e + r) - z_2(r)$. An immediate induction
on $e$ proves that, for $r \in [0, 2^e]$, one has
$z_2(2^e + r) - z_2(r) = -z_2(5.2^e + r)$. Hence we can state the following theorem.

\begin{theorem}
Let $(z_1(n))_{n \geq 0}$, $(z_2(n))_{n \geq 0}$, $(z_3(n))_{n \geq 0}$ be the
sequences defined above. Let $e \geq 0$ and $r \in [0, 2^e]$. Then, for all
$n \geq 0$ we have
$$
\begin{array}{lll}
z_1(2^e n + r) &=& z_1(2^{e+1} + r) z_1(n) + z_1(r) z_1(n+1) \\
z_2(2^e n + r) &=& -z_2(5.2^e n + r) z_2(n) + z_2(r) z_2(n+1) \\
z_3(2^e n + r) &=& -z_3(2^{e+1} + r) z_3(n) + z_3(r) z_3(n+1) \\
\end{array}
$$
and
$$
z_1(2^{e+1}+r)z_1(2n+5) + z_1(r)z_1(2n+3) = -z_1(2^e(n+2)+r) + z_1(2^e(n+1)+r)
$$
$$
-z_2(5.2^e+r)z_2(2n+5) + z_2(r)z_2(2n+3) = -z_2(2^e(n+2)+r) + z_2(2^e(n+1)+r)
$$
$$
-z_3(2^{e+1}+r)z_3(2n+5) + z_3(r)z_3(2n+3) = z_3(2^e(n+2)+r) + z_3(2^e(n+1)+r).
$$
\end{theorem}

\subsection{Block-complexity of the Thue-Morse sequence}

Other sequences satisfy the hypotheses of Theorem~\ref{general}, e.g., sequence
A145865	in \cite{oeis}. An example that we would like to mention is the sequence
$(y(n))_{n \geq 0} = (A005942(n+1))_{n \geq 0}$ with the notation of \cite{oeis}.
The sequence $(A005942(n))_{n \geq 0}$ is the (block-)complexity of the Thue-Morse
sequence (the Thue-Morse sequence is the fixed point beginning with $0$ of the
morphism $0 \to 01$, $1 \to 10$, see, e.g., \cite{ubi}; its block-complexity is
the number of distinct factors (blocks) of each length occurring in that sequence).
It satisfies $A005942(2n)=A005942(n)+A005942(n+1)$, and $A005942(2n+1)=2A005942(n+1)$
if $n \geq 2$ (see \cite{Brlek, LucVar}). Hence the sequence $(y(n))_{n \geq 0}$
satisfies the hypotheses of Theorem~\ref{general} with $n_0 = 2$, $a=2$, $b=c=1$.
Note that $y(0) = 2$ and $y(1) = 4$.

\begin{remark}
{\rm The sequence $(A006165(n))_{n \geq 0}$ satisfies the same recurrence properties
as the sequence $(y(n))_{n \geq 0}$ above, but is equal to $1$ for $n=1$ and
$n=2$. As indicated in \cite{oeis} this sequence is related to the Josephus problem.
}
\end{remark}

\section{Final remarks}

For sequences $(z(n))_{n \geq 0}$ satisfying the hypotheses of Theorem~\ref{general},
any subsequence of the form $(z(2^e n + r))_{n \geq 0}$ with $e \geq 0$ and
$r \in [0, 2^e]$ is a linear expression in $(z(n))_{n \geq 0}$ and $(z(n+1))_{n \geq 0}$
for $n \geq n_0$ with coefficients depending on $r$ and $e$ only: this proves the
$2$-regularity of these sequences (see \cite{allsha}).

Also note that, as visible in the proof of Theorem~\ref{general} above, several
other relations can be found between the terms of sequences satisfying the hypotheses
of that theorem.

\section{Acknowledgments} We thank warmly R. Bacher for his comments on a previous version
of this paper.

Number Theory (math.NT); Combinatorics (math.CO)