# how to find $\int_{0}^{1}h_n(x)dx?$

I would appreciate if somebody could help me with the following problem: $$h(x)=\begin{cases} 2x&\left(0\leq x\leq \frac{1}{3}\right)\\ \frac{1}{2}x+\frac{1}{2} &\left(\frac{1}{3}<x\leq 1\right) \end{cases}$$ let $h_2(x)=h(h(x)), h_3(x)=h_2(h(x)),\cdots, h_{n+1}(x)=h_n(h(x))$

find $\int_{0}^{1}h_n(x)dx ?$

-
Have you tried to look at what you get for $h_2$, $h_3$ and prove by induction what $h_n$ is, say? – Pedro Tamaroff Mar 4 '13 at 2:22
I find $h_2,h_3$ but $h_n$ – Young Mar 4 '13 at 2:45
I think you should reconsider which answer you accepted for this question. The one given by Brian Silva is incorrect. – Antonio Vargas Mar 17 '13 at 3:17
This was linked on meta. At the time I wrote this comment, this question had 158 views, 1 up and 1 downvote on the accepted answer, 5 upvotes on the correct answer, and (except the very first comment under the question) a total of one vote on one comment. Based on the discussion at meta, it looks like nobody except the other answer author used votes to express any opinion about the wrong answer being wrong. Antonio Vargas made the point using comments. But it seems as though only about three users thought about the problem at all. – zyx Jul 2 '13 at 20:47

Playing around with the patterns of this recursion, I get the following:

$$h_n(x) = \begin{cases}\\ 2^n x, & 0 < x < \frac{1}{3 \cdot 2^{n-1}}\\2^{n-2 m} x + \left (1-\frac{1}{2^m}\right ),&\frac{1}{3 \cdot 2^{n-m}}<x<\frac{1}{3 \cdot 2^{n-m-1}} \\ \frac{1}{2^n} x +\left (1-\frac{1}{2^n}\right ),&\frac{1}{3}<x<1 \end{cases}$$

where $m \in \{1,2,\ldots,n-1\}$. You can verify this is true by induction, using $h_{n+1}(x) = h(h_n(x))$. (I leave this to the reader and OP.)

Once you have this definition set, doing the integral is a matter of careful bookkeeping:

\begin{align}\int_0^1 dx \: h_n(x) = \int_0^{1/(3 \cdot 2^{n-1})} dx \: 2^n x + \sum_{m=1}^{n-1} \int_{1/(3 \cdot 2^{n-m})}^{1/(3 \cdot 2^{n-m-1})} dx \left [(2^{n-2 m} x + \left (1-\frac{1}{2^m}\right )\right ]\\ + \int_{1/3}^1 dx \: \left [\frac{1}{2^n} x +\left (1-\frac{1}{2^n}\right )\right ] \\\end{align}

I again leave the algebra to the reader and OP; the result is

$$\int_0^1 dx \: h_n(x) = 1 - \frac{n+3}{6 \cdot 2^n}$$

You can verify that this result agrees with the $n=1$ case.

Here is a plot of the first few cases for $h_n$: