1 Introduction

The phenomenon of random sequences has connection to certain fields of mathematics, including dynamical systems and ergodic theory. The expression random Fibonacci sequence (or random Fibonacci numbers) has more interpretations. Hence, the subject must be always clarified before speaking or writing about that.

As usual, let the Fibonacci sequence \(\{F_n\}\) be defined by the initial values \(F_0=0\), \(F_1=1\), and for \(n\ge 2\) by the recursion \(F_n=F_{n-1}+F_{n-2}\).

One of the first papers on the probabilistic version of Fibonacci sequence is due to Heyde [1]. He investigated the random variables \(X_i\) satisfy \(X_n=X_{n-1}+X_{n-2}+\varepsilon _n\), where the stochastic perturbations \(\{\varepsilon _n\}\) are the sequence of martingale differences implied by \(E(X_n\mid X_{n-1},\dots ,X_0)=X_{n-1}+X_{n-2}\).

Dawson et al. [2] examined the following problem. Fix the positive integers p and q, and values \(\phi _1,\phi _2,\dots , \phi _p\). Let \(y_i=\phi _i\) with probability 1 for \(i\le p\), and put

$$\begin{aligned} y_{n+1}=\sum _{i=1}^qy_{k_i}\qquad \textrm{for}\;n>p, \end{aligned}$$

where the values of \(k_i\) are randomly chosen (either with our without replacement) from the set \(\{1,2,\dots ,n\}\). The authors found the sequence of the first and second moments of \(\{y_n\}\), respectively. They devoted one section to the ranges of the sequences.

In their excellent paper, Embree and Trefethen [3] investigated the behavior of the randomly generalized Fibonacci sequence

$$\begin{aligned} x_n=x_{n-1}\pm \beta x_{n-2}, \end{aligned}$$

where \(0<\beta <1\) is fixed in advance. They asked how the growth rate of solutions \(\mid \!\! x_n\!\!\mid \) depends on \(\beta \). Article [3] is an extension of the paper of Viswanath [4], who considered the random Fibonacci sequence given by \(x_0=x_1=1\) and

$$\begin{aligned} x_n=\pm x_{n-1}\pm x_{n-2}, \end{aligned}$$

where the signs are chosen independently and with equal probabilities. For more details of the last theme, see also [5, 6].

In this paper, we deal with another problem. Let \(a<b\) be two arbitrary real numbers. Suppose that the terms \(w_{n}=w_n(a,b)\) (\(n\ge 0\)) of a random sequence \(\{w_n\}\) are provided by tossing a coin, and take value a with probability \(p\in [0;1]\) (if the outcome is head), and do b with probability \(q=1-p\) (in case of tail). In this paper, we study the random inhomogeneous Fibonacci recurrence

$$\begin{aligned} G_{n}=G_{n-1}+G_{n-2}+w_{n-2}(a,b)\qquad (n\ge 2) \end{aligned}$$
(1)

with initial values \(G_0=0\), \(G_1=1\).

Clearly, if \(p=1\), then we always have \(G_{n}=G_{n-1}+G_{n-2}+a\), while in case of \(p=0\), formula \(G_{n}=G_{n-1}+G_{n-2}+b\) holds.

The main interest is to describe the process, and the discrete probability distribution of the values of \(G_n\) (\(n\ge 0\)). At the end of the paper, we could give the expected value and the standard deviation. With fixed n, the distribution possesses fractal property. We found a connection to binomial distributions, and in this sense, a variation of Pascal’s triangle is discovered. First, we construct a binary tree which will be converted to a connected planar digraph. Then, we show that the most important properties of the tree can be transmitted to the graph, which enable us to determine basic features of the probability distribution.

We also made random trials to approximate the expected frequencies (and distributions) experimentally. The frequency bar chart in Fig. 1 illustrates the result of such a random \(N=100000\) trials with probability \(p=0.66\) if \(n=12\).

Fig. 1
figure 1

Frequency bar chart with parameters \(n=12\), \(a=0\), \(b=1\), \(p=0.66\), and the number of trials is \(N=100000\)

There are several possible generalizations of our problem. We mention only two ones, but we emphasize that this paper studies only the sequence given in (1). One extension is when sequence \(\{w_n\}\) has values \(a_1,a_2,\dots ,a_\ell \) with probability \(p_1,p_2,\dots ,p_\ell \), such that \(\sum _i^\ell p_i=1\). In an other generalization, we may use not the Fibonacci sequence but an other linear recurrence \(\{{{\mathcal {G}}}_n\}\) of order \(k\ge 2\) (or \(k>2\)).

The paper is organized as follows. In Sect. 2, we derive a binary tree associated with (1), and we describe certain properties of the tree. Section 3 plays a principal role in this paper, and it is devoted to construct a connected planar digraph, which makes it possible to introduce a discrete distribution connected to (1). In Sect. 4, we determine the probability distribution more precisely, and then calculate the expected value and standard deviation. The last section gives some other information, and provides experimental results.

Before starting the program sketched above, we discuss the cases \(p=0\) and \(p=1\), respectively. Under any of these two restrictions, (1) becomes deterministic, and the corresponding inhomogeneous binary recurrence can be considered equivalently as a homogenous ternary recurrence. Then, using the standard method, one can have an explicit formula for \(G_n\). In the forthcoming subsection, we vary from this way and use a more general approach, which provides a powerful tool applicable in general for linear recurrences, too.

1.1 Cases \(p=0\) and \(p=1\), and a Powerful Tool

The process is deterministic if \(p=0\) or \(p=1\), when \(\{w_n\}=\{w_n(a,b)\}\) is not a random sequence longer. To solve the problem first, we present a general approach.

Given a positive integer k and complex numbers \(f_0,f_1,\dots ,f_{k-1}\). Introduce the linear homogenous recurrence

$$\begin{aligned} f_n=A_1f_{n-1}+A_2f_{n-2}+\cdots +A_kf_{n-k}\qquad (n\ge k), \end{aligned}$$
(2)

where the coefficients \(A_1,\dots ,A_{k-1},A_k\ne 0\) are fixed complex numbers. Moreover, suppose that \(\{w_n\}\in \mathbb {C}^\infty \) is an arbitrary sequence. Using equal coefficients to that appear in (2), we construct the linear recurrence

$$\begin{aligned} G_n=A_1G_{n-1}+A_2G_{n-2}+\cdots +A_kG_{n-k}+w_{n-k}\qquad (n\ge k), \end{aligned}$$
(3)

assuming that the complex initial values \(G_0,\dots ,G_{k-1}\) are also given. Note that formulae (2) and (3) essentially differ only in the sequence \(\{w_n\}\).

Theorem 1 of [7] has the following corollary (see Corollary 2, [7]).

Lemma 1

Let \(k=2\), \(f_0=0\), \(f_1=1\). Then, for \(n\ge 2\), we have

$$\begin{aligned} G_{n}=G_1f_{n}+G_0A_2f_{n-1}+\sum _{j=0}^{n-1}f_{n-1-j}w_j. \end{aligned}$$

If sequence \(\{w_n\}\) is deterministic, then the application of Lemma 1 provides an opportunity to gain formula for \(G_n\). We illustrate it as follows. Let \(w_n=a\in \mathbb {C}\) for all n. Thus, \(G_n=G_{n-1}+G_{n-2}+a\). Now, \(G_0=0\), \(G_1=1\), and \(A_2=1\). Hence

$$\begin{aligned} G_{n}=F_{n}+\sum _{j=0}^{n-1}F_{n-1-j}a. \end{aligned}$$

The last sum is \(a(F_{n+1}-1)\) implied by the Fibonacci identity \(\sum _{j=0}^{n-1}F_j=F_{n+1}-1\). Finally, we obtain

$$\begin{aligned} G_n=aF_{n+1}+F_n-a. \end{aligned}$$

Similarly, we have \(G_n=bF_{n+1}+F_n-b\) for the constant sequence \(w_n=b\).

2 Description of the Tree

In accordance with (1), \(G_n\) (\(n\ge 2\)) may take two possible values: either \(G_{n}=G_{n-1}+G_{n-2}+a\) or \(G_{n}=G_{n-1}+G_{n-2}+b\). This situation can be exactly figured with a binary tree. Figure 2 illustrates the first few levels of the tree when \(a=-1\) and \(b=1\).

Fig. 2
figure 2

Binary tree linked to (1) with parameters \(a=-1\) and \(b=1\)

In this section, using the binary tree denoted by \(({\mathcal {T}}_{n,k})\), where \(n\ge 0\) means the row number (or level) and \(k\ge 0\) is the entry position in row n, we describe the values what the term \(G_n\) can take, and we study some useful properties of the tree. Here, we disregard the probability questions, and we will call them in later, only in Sect. 4.

The first theorem, preparing other observations, determines the values of the nth row of the binary tree with arbitrary \(a<b\). The initial values \(G_0=0\) and \(G_1=1\) are located in the level 0 and 1 of the tree, respectively. Then, the number of entries is duplicated row by row, and hence, in row n, there are exactly \(2^{n-1}\) entries. It follows from Sect. 1.1 of Introduction that the leftmost element of row n is \(m_a(n):=\min _k\{{\mathcal {T}}_{n,k}\}=aF_{n+1}+F_n-a\), while the rightmost one is \(m_b(n):=\max _k\{{{\mathcal {T}}}_{n,k}\}=bF_{n+1}+F_n-b\).

Theorem 1

Let \(n\ge 2\) and \(0\le k\le 2^{n-1}-1\). Assume that the binary representation of k is \(k=\varepsilon _{n-2}\varepsilon _{n-3}\dots \varepsilon _{1}\varepsilon _{0}^{[2]} \) (\(\varepsilon _i\in \{0,1\}\)). The entry \({{\mathcal {T}}}_{n,k}\) of the kth element of row n is given by

$$\begin{aligned} {{\mathcal {T}}}_{n,k}=m_a(n)+\left( b-a\right) \sum _{j=0}^{n-2}\varepsilon _jF_{j+1}. \end{aligned}$$
(4)

Proof

First let \(n=2\). Then, for \(k=0\), we have \({\mathcal {T}}_{2,0}=aF_3+F_2-a=a+1\), while \(k=1\) yields \({\mathcal {T}}_{2,1}=aF_3+F_2-a+(b-a)F_1=b+1\). Now, let \(n=3\). We have four cases \(k=0,1,2,3\). For example, if \(k=2=10^{[2]} \), then

$$\begin{aligned} {{\mathcal {T}}}_{3,2}=aF_4+F_3-a+(b-a)F_2=a+b+2. \end{aligned}$$

The other three entries of row 3 can be obtained similarly, and we have \({{\mathcal {T}}}_{3,0}=2a+2\), \({{\mathcal {T}}}_{3,1}=a+b+2\), and \({\mathcal {T}}_{3,3}=2b+2\).

Assume that the statement is true for \(2,3,\dots ,n-1\) \((n\ge 4)\). Put \(k_1=\lfloor k/2\rfloor \) and \(k_2=\lfloor k_1/2\rfloor \). Observe that formula

$$\begin{aligned} {{\mathcal {T}}}_{n,k}={{\mathcal {T}}}_{n-1,k_1}+{{\mathcal {T}}}_{n-2,k_2}+\left( (b-a)\varepsilon _0+a\right) \end{aligned}$$
(5)

describes the derivation rule of the tree. Clearly, \((b-a)\varepsilon _0+a\) is equal to a if \(\varepsilon _0=0\), and b otherwise.

Apply this, which together with the induction hypothesis and the definition of the Fibonacci sequence provides

$$\begin{aligned} {{\mathcal {T}}}_{n,k}= & {} (aF_n+F_{n-1}-a)+(b-a)\sum _{j=1}^{n-2}\varepsilon _jF_{j}\\{} & {} +(aF_{n-1}+F_{n-2}-a)+(b-a)\sum _{j=2}^{n-2}\varepsilon _jF_{j-1}+(b-a)\varepsilon _0+a\\= & {} (aF_{n+1}+F_{n}-a)+(b-a)\sum _{j=2}^{n-2}\varepsilon _jF_{j+1}+(b-a)\varepsilon _1F_1+(b-a)\varepsilon _0\\= & {} (aF_{n+1}+F_{n}-a)+(b-a)\sum _{j=0}^{n-2}\varepsilon _jF_{j+1}\\{} & {} \qquad \qquad \qquad -(b-a)(\varepsilon _0F_1+\varepsilon _1F_2)+(b-a)\varepsilon _1F_1+(b-a)\varepsilon _0. \end{aligned}$$

One can easily verify that the expression in the last row vanishes, and the proof is complete. \(\square \)

We proceed with three useful corollaries of Theorem 1, the proofs are easy exercises, so we omit the details. The first one gives (4) in a shorter form; in addition, it is transmissible for the case when we will consider the random term \(w_{n-2}(a_1,a_2,\dots ,a_\ell )\) instead of \(w_{n-2}(a,b)=w_{n-2}(a_1,a_2)\) in (1).

Corollary 1

Introducing the new notation \(a_0=a\) and \(a_1=b\), formula (4) simplifies to

$$\begin{aligned} {{\mathcal {T}}}_{n,k}=F_n+\sum _{j=0}^{n-2}a_{\varepsilon _j}F_{j+1}. \end{aligned}$$

The proof relies only on the identity \(F_{n+1}-1=\sum _{j=0}^{n-1}F_j\), and on the observation \(a_0+(a_1-a_0)\varepsilon _j=a_{\varepsilon _j}\).

Corollary 2

Taking row \(n\ge 2\) of the tree, as k goes through the range \(0,1,\dots ,2^{n-1}-1\), formula (4) gives a map onto the set

$$\begin{aligned} \left\{ m_a(n),\,m_a(n)+(b-a),\,\dots ,\,m_a(n)+j(b-a),\,\dots ,\, m_b(n)\right\} . \end{aligned}$$

One can justify this statement by induction. The cardinality of the set (the number of distinct elements of the row n in the tree) is \(F_{n+1}\).

Corollary 3

If \(n\ge 2\) and \(0\le k\le 2^{n-2}-1\), \(K=k+2^{n-2}\), then

$$\begin{aligned} {{\mathcal {T}}}_{n,K}={{\mathcal {T}}}_{n,k}+(b-a)F_{n-1}. \end{aligned}$$

Clearly, this corollary describes the connection between the first and second half of row n in the tree. The next theorem slightly modifies equality (5) by giving a direct relation between two neighbor rows of \(({{\mathcal {T}}}_{n,k})\).

Theorem 2

If \(n\ge 2\) and \(0\le k\le 2^{n-2}-1\), then

$$\begin{aligned} {{\mathcal {T}}}_{n,k}={{\mathcal {T}}}_{n-1,k} +(aF_{n-1}+F_{n-2}). \end{aligned}$$

Proof

The statement is trivially true for \(n=2\), and for \(n=3\). Assume now \(n\ge 4\). Since \(\varepsilon _{n-2}=0\), then Theorem 1 implies

$$\begin{aligned} {{\mathcal {T}}}_{n,k}= & {} \left( aF_{n+1}+F_n-a\right) +\left( b-a\right) \sum _{j=0}^{n-3}\varepsilon _jF_{j+1}\\= & {} \left( aF_{n}+F_{n-1}-a\right) +\left( b-a\right) \sum _{j=0}^{n-3}\varepsilon _jF_{j+1} +a(F_{n+1}-F_{n})+(F_n-F_{n-1}), \end{aligned}$$

which proves Theorem 2. \(\square \)

Combining Theorem 2 and Corollary 3, we have the following.

Corollary 4

If \(n\ge 2\) and \(0\le k\le 2^{n-2}-1\), \(K=k+2^{n-2}\), then

$$\begin{aligned} {{\mathcal {T}}}_{n,K}={{\mathcal {T}}}_{n-1,k}+(bF_{n-1}+F_{n-2}). \end{aligned}$$

Theorem 2 and Corollaries 3, 4 are illustrated in Fig. 3.

Fig. 3
figure 3

Connections between row \((n-1)\) and row n of the tree

The content of this figure will play an important role in the next section.

3 Graph Transformation

In general, the entries \({{\mathcal {T}}}_{n,k}\) of a given row n in the tree are not monotone increasing (reading from left to right); see for example row 5, and 6 in Fig. 2. Now, we order the vertices of each row into a strictly monotone increasing sequence by their values, such that we merge the vertices having equal value, and at the same time, we register the frequency of each element in the sequence we obtain.

First, we concentrate on a suitable graph transformation which converts the tree \(({{\mathcal {T}}}_{n,k})\) into a connected planar digraph \(({{\mathcal {F}}})=({{\mathcal {F}}}(a,b))\), where the rows are corresponding to the rows of the tree, and the values of the vertices in the rows of \(({{\mathcal {F}}})\) form a strictly monotone increasing sequences. Each vertex has a frequency in according to fusing of equal valued vertices of the row.

The graph transformation consists of the following hints.

  1. 1.

    We move on down from row 3 in tree \(({{\mathcal {T}}}_{k,n})\) row by row.

  2. 2.

    Keeping the incoming and outgoing arcs, in the current row we move the vertices left or right, such that their values form a monotone increasing sequence.

  3. 3.

    Then, two or more neighbor vertices possessing the same value are fused. The frequency of the “new” vertex is the number of the (two or more) “old” vertices that were fused.

Obviously, the last hint provides a strictly monotone increasing row sequence. The second point ensures that all arcs will be stored in the new graph \(({{\mathcal {F}}})\). However, the question arises naturally: if two arcs become one (because we fuse the corresponding two vertices), how this unified arc keeps the rule \(G_n=G_{n-1}+G_{n-2}+w_{n-2}\)? We will find a satisfactory answer to this question soon.

Figure 4 shows the first few rows of \(({{\mathcal {F}}})\) with arbitrary \(a<b\). Here, we also indicate the frequencies of the values in grey circles; this phenomenon will also be studied later.

Fig. 4
figure 4

Entries and their frequencies in row \(1,2,\dots ,5\) of \(({{\mathcal {F}}}(a,b))\)

Corollary 2 implies that the cardinality of elements in row n of \(({{\mathcal {F}}})\) is \(F_{n+1}\), and the values of the vertices form an arithmetic progression with difference \(b-a\). Now, we set out some useful properties of \(({{\mathcal {F}}})\), and the justification will be presented after the list. Assume \(n\ge 3\).

Properties

  1. 1.

    If a vertex (with value \(v_3\)) is a descendant of a descendant (with value \(v_2\)) of a given vertex (with value \(v_1\)), then the values \(v_1,v_2,v_3\) satisfy the rule \(v_3=v_1+v_2+w\), where \(w=a\) or \(w=b\) depending upon the location of the vertices. (It means that we keep the rule which was used in the construction of the tree \(({{\mathcal {T}}}_{k,n})\).) There is one more situation (an exception) which is clarified after the points of the present list.

  2. 2.

    Every vertex has indegree 1 or 2, and outdegree 2 or 3, respectively. The leftmost and rightmost vertices have indegree 1 and outdegree 2, one of the 2 outgoing arcs goes to a left- or rightmost vertex of the next row on the same side.

  3. 3.

    Any two neighbor vertices in row n have a unique common descendant in row \((n+1)\).

  4. 4.

    If a vertex has indegree 2 in row n, then between the two outgoing arcs given in the previous point, there is a third arc going to an intermediate (third) descendant belonging to row \((n+1)\).

  5. 5.

    \(({{\mathcal {F}}})\) is a planar digraph.

Let us walk round the situation of point 4 of the list of properties, which is also connected to the exception mentioned in point 1. At the same time, we answer the question was posed after the hints of graph conversion. See Fig. 4, and look at the second vertex \(v_2=3+3a+b\) of row 4. The two antecedents of \(v_2\) (in row 3) are \(v_1=2+2a\) and \(v_1^\prime =2+a+b\). The middle descendant’s value \(v_3=5+5a+2b\) (in row 5) can be obtained by two different manners: \(v_1+v_2+b=(2+2a)+(3+3a+b)+b\) or \(v_1^\prime +v_2+a=(2+a+b)+(3+3a+b)+a\). For each of the other two descendants of vertex \(v_2\) (these are \(5+6a+b\) and \(5+4a+3b\)), there is a unique way via \(v_2\) to get the value \(v_4=v_1+v_2+a=5+6a+b\), and \(v_5=v_1^\prime +v_2+b=5+4a+3b\), respectively. We emphasize that \(v_4\) is not resulted from \(v_1^\prime \) and \(v_2\), and similarly, \(v_5\) does not come from \(v_1\) and \(v_2\). This feature is valid in general, and explains the exception mentioned in point 1.

In the last part of this section, we prove the properties listed above.

3.1 Proof of the Properties

We prove the properties by induction. One can easily check Properties 1–5 in rows 3–5 of Fig. 4. The role of the leftmost and rightmost vertices is clear, so in the sequel, we deal with vertices differ them. Assume that every property holds prior to row n, and consider row \((n+1)\). We distinguish \(1+3\) cases grouped into two classes.

Class 1. Suppose first that a vertex in row n has indegree 1. Figure 5 illustrates the situation.

Fig. 5
figure 5

Situation of Class 1

The “base” vertex has value \(v_3=x+y+b\), and it has one antecedent with value \(v_2=y\), which has two antecedents with values \(v_1=x\) and \(v_1^\prime =x+b-a\). The left neighbor vertex of \(v_3\) is \(v_4=v_3-(b-a)=x+y+a\), while the right neighbor owns \(v_5=v_3+(b-a)=x+y+2b-a\). Obviously, this is not the extreme situation with \(v_2\) and \(v_3\). Consequently

$$\begin{aligned} v_6=x+2y+a+b= & {} v_2+v_4+b=v_2+v_3+a,\\ v_7=x+2y+2b= & {} v_2+v_3+b=v_2+v_5+a \end{aligned}$$

are the only two descendants of \(v_3\), and both \(v_6\) and \(v_7\) are obtained in two distinct ways. There is no vertex between \(v_6\) and \(v_7\), since \(v_7-v_6=b-a\). It remains to show only the planarity, i.e., there is no arc between rows n and \((n+1)\) which intersects the four arcs indicated in Fig. 5 between rows n and \((n+1)\). It guarantees that \({{\mathcal {F}}}\) is planar (in this situation). We prove first that if we take one vertex left of \(v_2\) in row \((n-1)\), and an other vertex in row n not right of \(v_4\), then they determine vertices in row \((n+1)\) with values less than \(v_6\). Indeed, it follows from:

$$\begin{aligned} (y-(b-a))+(x+y+a)+b=x+2y+2a<x+2y+a+b=v_6. \end{aligned}$$

In the chiral symmetry situation, similar argument follows for the right of \(v_2\) and for the vertex not left of \(v_5\), namely

$$\begin{aligned} (y+(b-a))+(x+y+2b-a)+a=x+2y+3b-a>x+2y+2b=v_7. \end{aligned}$$

Class 2. Suppose that a vertex in row n has indegree 2. Actually, it means three cases; the last two ones form a symmetric pair. Figure 6 illustrates the two essentially distinct structures.

Fig. 6
figure 6

Two available situations of three in Class 2

Note that the difference between the two subfigures appears in the antecedents (in row \((n-2)\)) of the vertex having value \(v_3=x+y+b\) in row n.

The method of this class is analogous to that we used in the investigation of Class 1 earlier, so we omit the details.

3.2 Number of Vertices of the Two Types

In accordance with the properties above, two types of vertices appear in the digraph \(({{\mathcal {F}}})\), vertices with 1 incoming arc, and vertices with 2 incoming arcs. Denote the number of their occurrence in row n by \(a_n\) and \(b_n\), respectively. Clearly, \(a_n+b_n=F_{n+1}\) (see Corollary 2).

Now, we derive a formula for \(a_n\), and for \(b_n\). It follows from the Properties 1–5 immediately that:

$$\begin{aligned} a_{n+1}= & {} b_n+2, \\ b_{n+1}= & {} a_n+b_n-1. \end{aligned}$$

Thus, \(b_n=F_n-1\), and then, \(a_n=F_{n-1}+1\).

4 Distribution

In the previous section, we gave a way how to transform the tree \(({{\mathcal {T}}}_{n,k})\) into the planar graph \(({{\mathcal {F}}})\), and we described the properties of the new graph. During the process vertices are fused at times, and we keep a record of fusions by introducing the notion of frequency. Figure 4 shows the frequencies of the vertices in grey circles. For example, the vertex \(5+4a+3b\) in row 5 has frequency 3, which means that the value \(5+4a+3b\) appears 3 times in row 5 of the tree (cf. Fig. 2, where \(a=-1\), \(b=1\), subsequently \(5+4a+3b=4\), and this value appears 3 times in row 5 of the tree, indeed).

Assume that the table

$$\begin{aligned} \Gamma _n=\; \left\{ \begin{array}{cccc} v_1 &{} v_2 &{} \dots &{} v_{F_{n+1}} \\ &{}&{}&{} \\ \gamma _1 &{} \gamma _2 &{} \dots &{} \gamma _{F_{n+1}} \\ &{}&{}&{} \\ p_1^{(n)} &{} p_2^{(n)} &{} \dots &{} p_{F_{n+1}}^{(n)} \end{array} \right\} \end{aligned}$$
(6)

gives the values \(v_i\) of row n of \(({{\mathcal {F}}})\) with frequencies \(\gamma _i\), and with probabilities \(p_i^{(n)}\), respectively. In case of probability \(p_i^{(n)}\) of \(v_i\), we indicated the row number n as well, but not at \(v_i\) and \(\gamma _i\). For them, we will use the same upper subscript if it will be necessary. Recall that \(v_i=v_i^{(n)}=aF_{n+1}+F_n-a+(b-a)(i-1)\) (\(i=1,2,\dots ,F_{n+1}\)), see Corollary 2. Recall even that the random term \(w_n\) takes value a with probability p, and takes b with probability \(q=1-p\) (see Introduction).

Observation 1. Theorem 2 and Corollaries  3, 4 are summarized in Fig. 4. Under the graph transformation \(({{\mathcal {T}}}_{n,k})\longrightarrow ({{\mathcal {F}}})\), the scheme of Fig. 4 is slightly changed. Figure 7 shows the modification, and the first and second parts of row n in \(({{\mathcal {F}}})\) are overlapped (since we only reordered the vertices of the rows of the tree, and fused the vertices if equality held in their values). However, the difference of any of the two parts of row n and row \((n-1)n\) is still \(aF_{n-1}+F_{n-2}\) or \(bF_{n-1}+F_{n-2}\). It is easy to see that the width of the left (and right) not overlapped single part of row n is \(F_{n+1}-F_n=F_{n-1}\). Hence, the overlapped part contains \(F_{n+1}-2F_{n-1}=F_{n-2}\) vertices. (Everything is Fibonacci, admirable!)

Fig. 7
figure 7

Connections between row \((n-1)\) and row n in \(({{\mathcal {F}}})\)

Now, we turn our attention to describe the frequencies and probabilities belonging to the vertices of row n. Define the frequency polynomials as

$$\begin{aligned} Q_n(x)=\gamma _1+\gamma _2x+\cdots +\gamma _{F_{n+1}}x^{F_{n+1}-1}. \end{aligned}$$

The first few ones are \(Q_1(x)=1\), \(Q_2(x)=1+x\), \(Q_3(x)=1+2x+x^2=(1+x)^2\). We have the following.

Theorem 3

Polynomials \(Q_{n-1}(x)\) and \(Q_n(x)\) satisfy the equality

$$\begin{aligned} Q_n(x)=Q_{n-1}(x)(1+x^{F_{n-1}}). \end{aligned}$$

Proof

The entries of row \((n-1)\) are given by \(v_i=aF_{n}+F_{n-1}-a+(b-a)(i-1)\) with frequencies \(\gamma _i\) (\(i=1,2,\dots ,F_{n}\))

$$\begin{aligned} \tilde{\Gamma }_{n-1}=\; \left\{ \begin{array}{cccc} v_1^{(n-1)} &{} v_2^{(n-1)} &{} \dots &{} v_{F_{n}}^{(n-1)} \\ &{}&{}&{} \\ \gamma _1^{(n-1)} &{} \gamma _2^{(n-1)} &{} \dots &{} \gamma _{F_{n}}^{(n-1)} \end{array} \right\} . \end{aligned}$$

Observation 1 together with Fig. 7 implies the values of row n as follows.

First, \(v_i^{(n)}=v_{i}^{(n-1)}+(aF_{n-1}+F_{n-2})\) for \(i=1,\dots ,F_{n-1}\). On the other hand, \(v_i^{(n)}=v_{i}^{(n-1)}+(bF_{n-1}+F_{n-2})\) for \(i=F_{n}+1,\dots ,F_{n+1}\). The middle (overlapping) terms \(v_i^{(n)}\) are associated with \(i=F_{n-1}+1,\dots ,F_n\). For the frequencies, we see that

$$\begin{aligned} \gamma _i^{(n)}= {\left\{ \begin{array}{ll} \gamma _i^{(n-1)}, &{} \text { if } 1\le i\le F_{n-1},\\ &{} \\ \gamma _i^{(n-1)}+\gamma _{i-F_{n-1}}^{(n-1)}, &{} \text { if } F_{n-1}+1\le i\le F_{n},\\ &{} \\ \gamma _{i-F_n}^{(n-1)}, &{} \text { if } F_{n}+1\le i\le F_{n+1}. \end{array}\right. } \end{aligned}$$
(7)

Using polynomial \(Q_{n-1}(x)\) and \(Q_n(x)\) description (7) becomes easier by

$$\begin{aligned} Q_n(x)=Q_{n-1}(x)+x^{F_{n-1}}Q_{n-1}(x), \end{aligned}$$

and the proof is complete. \(\square \)

A direct consequence of the facts above is

Theorem 4

$$\begin{aligned} Q_n(x)=\prod _{k=1}^{n-1}(1+x^{F_k}). \end{aligned}$$
(8)

Here, in Fig. 8, we show the coefficients of \(Q_{12}(x)\) in a bar diagram. Interestingly, it admits a fractal-like structure.

Fig. 8
figure 8

Coefficients of \(Q_{12}(x)\)

Remark 1

It is known that the binomial distribution with parameter \(p=1/2\) is related to Pascal’s triangle. The replacement of (8) by \(\widehat{Q}_{n-1}=\prod _{k=1}^{n-1}(1+x)=(1+x)^{n-1}\) returns the generating function of binomial coefficients with fixed upper index. In this sense, polynomials \(Q_n(x)\) provide a variation of Pascal’s triangle.

The entries of row n in \(({\mathcal {F}})\), together with the probabilities belonging to them, generate a probability distribution. First, we compute the probabilities here. Put

$$\begin{aligned} P_n(x)=p_1^{(n)}+p_2^{(n)}x+\cdots +p_{F_{n+1}}^{(n)}x^{F_{n+1}-1}. \end{aligned}$$

It is called probability polynomial, which can be considered as a generating function of a suitable random variable.

Theorem 5

For \(i\in \{1,2,\dots ,F_{n+1}\}\), we have

$$\begin{aligned}p_i^{(n)}= {\left\{ \begin{array}{ll} p\cdot p_i^{(n-1)}, &{} \text { if } 1\le i\le F_{n-1},\\ &{} \\ p\cdot p_i^{(n-1)}+q\cdot p_{i-F_{n-1}}^{(n-1)}, &{} \text { if } F_{n-1}+1\le i\le F_{n},\\ &{} \\ q\cdot p_{i-F_{n-1}}^{(n-1)}, &{} \text { if } F_{n}+1\le i\le F_{n+1}. \end{array}\right. } \end{aligned}$$

Proof

The same idea works that we used in the proof of Theorem 3. The only difference is that now we consider the probabilities \(p_i^{(n)}\) instead of the frequencies \(\gamma _i^{(n)}\). \(\square \)

We can easily conclude the next theorem as a consequence of the arguments above.

Theorem 6

Assume that the probabilities \(p_i^{(n)}\) of row n (\(i\in \{1,2,\dots ,F_{n+1}\}\)) determine the generating function \(P_n(x)\) of the random variable \(\xi \) (and its distribution) that takes the values \(0,1,\dots , F_{n+1}-1\). Then

$$\begin{aligned} P_n(x)=\sum _{j=0}^{F_{n+1}-1}p_{j+1}^{(n)}x^j=\prod _{k=1}^{n-1}(p+qx^{F_k}). \end{aligned}$$

Proof

It follows from the definition of \(P_n(x)\) and \(\xi \), and from Theorem 5\(\square \)

Theorem 7

The expected value of \(\xi \) is \(E(\xi )=q(F_{n+1}-1)\).

Proof

We use the formula \(E(\xi )=P^\prime _n(1)\). Observe first that \(P_n(1)=1\). We have

$$\begin{aligned} P^\prime _n(x)=\sum _{j=1}^{n-1}P_n(x)\cdot \frac{qF_jx^{F_j-1}}{p+qx^{F_j}}=P_n(x)\sum _{j=1}^{n-1}\frac{qF_jx^{F_j-1}}{p+qx^{F_j}}. \end{aligned}$$

Let m(x) denote the last sum above. Hence, \(P_n^\prime (x)=P_n(x)m(x)\). Now, we have

$$\begin{aligned} P^\prime _n(1)=P_n(1)m(1)=m(1)= \sum _{j=1}^{n-1}\frac{qF_j}{p+q}=q\sum _{j=1}^{n-1}F_j= q(F_{n+1}-1), \end{aligned}$$

where we used that \(p+q=1\), and the identity \(F_{n+1}-1=\sum _{j=1}^{n-1}F_j\). \(\square \)

Let \(\eta =(b-a)\xi +a(F_{n+1}-1)+F_n\). This random variable is a linear function of \(\xi \), and exactly describe the situation given in the first and third rows of the table \(\Gamma _n\) [see (6)]. Thus, a direct consequence of Theorem 7 is

Corollary 5

$$\begin{aligned} E(\eta )=(ap+bq)(F_{n+1}-1)+F_n. \end{aligned}$$

Theorem 8

The variance of \(\xi \) is

$$\begin{aligned} D^2(\xi )=E(\xi )(E(\xi )-1)+qF_{n-1}F_n. \end{aligned}$$

Proof

We work with the formula \(D^2(\xi )=P^\prime _n(1)+P^{\prime \prime }_n(1)-(P^\prime _n(1))^2\). Actually, here \(D^2(\xi )=P^{\prime \prime }_n(1)\), because \(P^\prime _n(1)=1\). Clearly,

$$\begin{aligned} P^{\prime \prime }_n(x)=P_n(x)\left( m^2(x)+m^\prime (x)\right) . \end{aligned}$$

Then, a few straightforward simplifications amounts to

$$\begin{aligned} m^\prime (x)=\sum _{j=1}^{n-1}\frac{pq(F_j^2-F_j)x^{F_j-2}-q^2F_jx^{2F_j-2}}{(p+qx^{F_j})^2}. \end{aligned}$$

Thus

$$\begin{aligned} m^\prime (1)= & {} \sum _{j=1}^{n-1} \frac{pq(F_j^2-F_j)-q^2F_j}{(p+q)^2} =pq\sum _{j=1}^{n-1}F_j^2-q(p+q)\sum _{j=1}^{n-1}F_j\\= & {} pqF_{n-1}F_n-q(F_{n+1}-1). \end{aligned}$$

Finally, we have

$$\begin{aligned} D^2(\xi )= & {} P^{\prime \prime }_n(1)=P_n(1)\left( m^2(1)+m^\prime (1)\right) \\= & {} q^2\left( F_{n+1}-1\right) ^2+pqF_{n-1}F_n-q(F_{n+1}-1)\\= & {} E(\xi )(E(\xi )-1)+pqF_{n-1}F_n. \end{aligned}$$

\(\square \)

Now, a consequence for the random variable \(\eta \) is given by

Corollary 6

We have \(D^2(\eta )=(b-a)^2D^2(\xi )=(b-a)^2(E(\xi )(E(\xi )-1)+qF_{n-1}F_n)\).

4.1 Random Trials

For simplicity assume that \(p=q=1/2\). In this case, \(P_n(x)=Q_n(x)/2^{n-1}\), so the bar diagrams of the coefficients of \(P_n(x)\) and \(Q_n(x)\) have the same shape, the differ only in a magnification factor. Here, we exhibit Fig. 9 with \(N=500000\) random trials to approximate the shape of \(P_{12}(x)\) if \(a=0\) and \(b=1\).

Fig. 9
figure 9

Random trials with \(n=12\)

It approximates well the theoretical distribution associated with \(P_{12}(x)\), see Fig. 8. An other example for random trials is given in Fig. 1, where \(p=0.66\) (now, \(N=100000\)).