# Looking for a function $g(x)$ such that $g(2x+2) = g(x) + 2x+2$

So recently I got bored in maths class (I'm in tenth grade) and made up a little equation that looked something like this:
$$g(f(x)) = g(x) + f(x)$$ My original goal was to find different $g(x)$ to fulfill this equation for $f(x) = 2x, 2x+1$ and $2x+2$. I found solutions for the first two cases, but the third one keeps hiding its secrets from me and it's slowly taking my sleep.
So if anyone of you guys out there who have some actual knowledge about the topic (I tried and asked my maths teacher and he didn't even know an answer for $f(x) = 2x+1$) could sort out how to find a fitting $g(x)$, please tell me. (There might be a general way to solve for any given f$(x)$?)
I tried proving that a polynomial of some sort could solve the equation, but I stopped at third degree because it simply was too much work to write down all the formulas and I don't know how to handle all those terribly professional math programs like Octave etc. (I'm 15)

Looking forward to some informative replies.

Edit: I've already gained some really helpful insights here, but I still don't know why my original solution for $f(x)=2x+1$ wasn't correct. So, if anybody could give me a hint, that would be very appreciated. Here is how I got there:
I assumed that the function looked like $f(x)=$ $(ax^2+bx+c) \over (x+1)$ because I found out that $g(x)$ had no value at $x=-1$. By just putting this function into our initial equation, we get $${a(2x+1)^2+b(2x+1)+c \over x+1}={ax^2+bx+c \over x+1}+2x+1,$$ after simplifying $$3ax^2+4ax+a+bx+b=2x^2+3x+1$$ We can now see that $a$ and $b$ have to be solutions to the following three equations in order to be valid parameters for our function $g$: $$1: 3a = 2$$ $$2: 4a+b = 3$$ $$3: a+b = 1$$
When working out the solutions, one will easily find $a$ to be $2 \over 3$ and $b$ to be $1 \over 3$, thus our function $g(x)$ is defined as ${{2 \over 3}x^2+{1 \over 3}x}\over x+1$.
For the test, we just put this function into our starting problem again: $${{2 \over 3}(2x+1)^2+{1 \over 3}(2x+1) \over x+1} = {{2 \over 3}x^2+{1 \over 3}x \over x+1} + 2x+1.$$ Multiplying with $x+1$ (but still keeping in mind that $x=-1$ may never hold), we get: $${2 \over 3}(2x+1)^2+{1 \over 3}(2x+1) = {2 \over 3}x^2+{1 \over 3}x + (2x+1)(x+1)$$ $${2 \over 3}(4x^2+4x+1)+{1 \over 3}(2x+1) = {2 \over 3}x^2+{1 \over 3}x + 2x^2+3x+1$$ $${8 \over 3}x^2+{8 \over 3}x+{2 \over 3}+{2 \over 3}x+{1 \over 3} = {2 \over 3}x^2+{1 \over 3}x+2x^2+3x+1$$ $${8 \over 3}x^2+{10 \over 3}x+1 = {8 \over 3}x^2+{10 \over 3}x+1,$$ which holds for all $x \in \Bbb R \ | \ x \neq -1$.
I really don't know where my error is, and I am very grateful for every piece of help.

• What are your solutions for $2x$ and $2x+1$, and how did you find them? – Jendrik Stelzner Jan 12 '16 at 19:55
• Just plug in $x=-2$, you will get $g(-2)=g(-2) - 2$, what is a contradiction. So there is no such function. – Stefan Gyürki Jan 12 '16 at 19:55
• @Stefan by the same reasoning there cannot be a solution for $g(2x+1)=g(x)+2x+1$ (take $x=-1$). – Justpassingby Jan 12 '16 at 19:57
• @Stefan But doesnt't that only mean that the function just holds no value at -2 (or -1, in Justpassingby's case)? Hang on, I'm gonna go through my calculations again. – Durr Jan 12 '16 at 20:01
• @Durr It can happen, but in that case please tell us where the function $g$ should be defined. I automatically assumed that it is a real function (which is a usual assumption, when there is no restriction in the text). – Stefan Gyürki Jan 12 '16 at 20:07

So, let's start off with $g(2x+2)=g(x)+2x+2$. I suspect that the reason that the $f(x)=2x$ case came more easily was because the arguments of each of the $g$ terms were similar - let's see if we can do the same thing here, by tweaking the $x$ to $x+a$ and comparing:

$$g(2x+2a+2)=g(x+a)+2x+2a+2$$

If we choose $a=-2$, this solves $2a+2=a$, which means that the $g$ terms will be $g(2x-2)$ and $g(x-2)$ respectively. This is good news, because we've pushed the terms of the equation to look a bit more similar to one another. Indeed, if we introduce the notation $h(x)=g(x-2)$ into our equation, we get:

$$h(2x)=h(x)+2x-2$$

and this is a bit more like the first case you solved. Now, with recurrence equations in general (where functions are defined in terms of other values of the function, broadly speaking), one common way of approaching is to try to push your recurrence into the form $F(x+1)=F(x)+h(x)$, for some $F$ and $h$. The reason this is so popular is because it allows us to make use of telescoping sums, which facilitate viewing recursions similarly to sums. For now, let's try to get our recurrence into a form involving only $x$ and $x+1$ as inputs.

Now, as things stand, the arguments of (inputs to) $g$ are $x,2x$, which means that instead of adding $1$ between steps of computing, we're multiplying by $2$. This might hint at us to consider the powers of 2. Indeed, replacing $x$ by $2^x$ in our recurrence for $h$, we obtain:

$$h(2^{x+1})=h(2^x)+2^{x+1}-2$$

Now, this is better! We see an $x+1$ on one side, and an $x$ on the other, which is what we were shooting for. Let's call $j(x)=h(2^x)$ to take charge of this, and we land at:

$$j(x+1)=j(x)+2^{x+1}-2$$

This is good, because it lets us move from $x$ to $x+1$, which means that if we know 1 value of $j$, we know an infinity of them! Observe:

$$j(x+2)=j(x+1)+(2^{x+2}-2)=j(x)+(2^{x+1}-2)+(2^{x+2}-2)$$

If we keep proceeding with this, we arrive at (for integer $n$), that:

$$j(x+n)=(2^{x+1}-2)+(2^{x+2}-2)+...+(2^{x+n}-2)+j(x)$$

If you've come across geometric series, you'll realise that we can collapse each of these sums:

$$2^{x+1}+2^{x+2}+...+2^{x+n}=2^{x+n+1}-2^{x+1}$$

$$(-2)+(-2)+...+(-2)=-2n$$

So, we have the recurrence that $j(x+n)=j(x)+(2^{x+n+1}-2^{x+1})-2n$. Writing $y=x+n$, this gives that for any $x,y$, that $j(y)=j(x)+2^{y+1}-2^{x+1}-2(y-x)$, provided that the difference between $x,y$ is an integer.

This is good, because each of the variables only appears in unmixed terms - that is, there's no $xy,x/y$ terms or anything like that. So we can isolate them as:

$$j(y)-2^{y+1}+2y=j(x)-2^{x+1}+2x$$

The key here is that this holds whenever the difference between $x,y$ is anything, so we can say that it is constant.

[n.b. technically it says that it's a constant + a 1-periodic function, but we'll gloss over this for now]

So, we might now say that $j(x)=2^{x+1}-2x+C$, where $C$ is a constant. Let's now make the long journey back to $g(x)$:

$j(x)=2^{x+1}-2x+C \implies h(2^x)=2^{x+1}-2x+C \implies h(x)=2x-2\log_2{x}+C$

$$h(x)=2x-2\log_2{x}+C \implies g(x-2)=2x-2\log_2{x}+C$$

$$\implies g(x)=2x+4-2\log_2(x+2)+C=2x-2\log_2(x+2)+C'$$

noting that $C$ could have been any constant, whence $C+4=C'$ is just any constant.

[for those keeping track, our full solution is $g(x)=2x-2\log_2(x+2)+p(\log_2(x+2))$, where $p$ is any 1-periodic function]

So, we have a general solution! It does come with the downside that, due to the nature of logarithms, we need to specify our domain as $\{x \vert x>-1\}$, so that anything we take the logarithm of is positive. But otherwise, we have a nice, continuous function which satisfies the functional equation we'd like it to. Hopefully this also hints at how you could approach the general case of $f(x)=2x+b$, or even $f(x)=ax+b$.

• thank you very much for your informative and understandable reply. Two things I did not get - Why exactly can you "collapse" those geometric series? (I tried to read the Wikipedia article you suggested, but it was too complicated, a short explanation would be neat). The other question is: Could you please recheck my initial post? I've edited it and added how I came to my original solution for $f(x)=2x+1$ and I don't get what I did wrong there. Thanks in advance and +1. – Durr Jan 13 '16 at 18:10
• The initial solution for $f(x)=2x+1$ fails because you didn't replace the denominator with $(2x+1)+1$. The geometric series works here because you can write $2^x=2^{x+1}-2^{x}$, so $2^{x+1}+2^{x+2}+...+2^{x+n}=(2^{x+1}-2^{x})+(2^{x+2}-2^{x+1})+...+(2^{x+n+1}- 2^{x+n} )=2^{x+n+1}-2^x$, as all the powers in between cancel out (one + term, one - term). – πr8 Jan 14 '16 at 3:36

With $h(x)=g(x-n)$,

$$g(2x+n)=g(x)+2x+n$$ becomes $$h(2(x+n))=h(x+n)+2x+n.$$

Setting $x+n=:2^t$ this gives

$$h(2^{t+1})=h(2^t)+2^{t+1}-n,$$

which is an ordinary recurrence

$$l(t+1)=l(t)+2^{t+1}-n.$$

By summation, a general solution is

$$l(t)=2^{t+1}-nt+C,$$ corresponding to $$h(x+n)=2(x+n)-n\log_2(x+n)+C=g(x).$$

As one can check,

$$g(2x+n)=4(x+n)-n\log_2(2(x+n))+C=\\ g(x)+2x+n=2(x+n)-n\log_2(x+n)+C+2x+n.$$

And we have

\begin{align}0\to& g(x)=2x+C\\ 1\to& g(x)=2(x+1)-\log_2(x+1)+C\\ 2\to& g(x)=2(x+2)-2\log_2(x+2)+C.\end{align}

Actually, as the recurrence relates values of $t$ one unit apart, $C$ can be defined to be any function over $t\in(0,1]$, i.e. $x\in(1-n,2-n]$.

• This answer seems to suggest that the solution for $f(x)=2x+1$ is inevitably of the form shown; yet the solution provided by the OP is valid on the same domain? – Justpassingby Jan 12 '16 at 20:56
• You mean there is a periodic function $C(x)$ such that $2(x+1)-\log_2(x+1)+C$ is a rational function? – Justpassingby Jan 12 '16 at 21:13
• Re: the initial question from @Justpassingby, I think that the actual answer is that OP's solution just isn't correct: see here – πr8 Jan 12 '16 at 21:19
• @πr8: indeed. I checked this expression at least twice and didn't see the flaw ! – Yves Daoust Jan 12 '16 at 21:25
• @πr8: yep, the OP's expression is asymptotically $2x/3$, and this doesn't match the equation (must be asymptotically $2x$). – Yves Daoust Jan 12 '16 at 21:31