A sufficient condition for linearity?

If $f$ is a linear function (defined on $\mathbb{R}$), then for each $x$, $f(x) – xf’(x) = f(0)$. Is the converse true? That is, is it true that if $f$ is a differentiable function defined on $\mathbb{R}$ such that for each $x$, $f(x) – xf’(x) = f(0)$, then $f$ is linear?

-
I think you actually mean $f$ is an affine function, i.e. a function of the form $f(x)=a+bx$. Strictly speaking, such an $f$ is called linear only when $a=0$. – user1551 Aug 23 '11 at 5:30
@user1551: Well, yes, and no. The term "linear function" has two distinct, but related meanings, as explained in the Wikipedia article on "linear function". I'm using the meaning of "first degree polynomial", which is called a "linear function" because of its graph. But I appreciate your pointing out the ambiguity of the term, which I was unaware of. Anyway, here's the link to the Wikipedia article: en.wikipedia.org/wiki/Linear_function – Mike Jones Aug 23 '11 at 20:53

Let $g(x)=f(x)-f(0)$, then $g(x)=xg'(x)$ for all $x$. If $g(x)\neq0$, this means that $$\frac{\mathrm{d}}{\mathrm{d}x}\log(g(x))=\frac{1}{x}\tag{1}$$ Solving $(1)$ equation yields $$\log(g(x))=\log(k)+\log(x)\tag{2}$$ for some constant $k$ for either $x\in\mathbb{R}^+$ or $x\in\mathbb{R}^-$ (when $x<0$ or if $g(x)<0$ use $\log(-x)=\log(x)+\pi i$). Equation $(2)$ shows that if $g(x_0)\neq 0$ for some $x_0\neq0$, $g(x)\neq0$ for any $x$ with the same sign as $x_0$. Exponentiating equation $(2)$ and replacing $f$ yields $$f(x)-f(0)=kx\tag{3}$$ Thus, $f$ is linear on $\mathbb{R}^+$ and on $\mathbb{R}^-$. However, the slope of $f$ can be different on $\mathbb{R}^+$ than it is on $\mathbb{R}^-$.

Now that I think about it, since $f$ is differentiable at $0$, we have $$\lim_{x\to0+}\frac{f(x)-f(0)}{x}=f'(0)=\lim_{x\to0-}\frac{f(x)-f(0)}{x}\tag{4}$$ Thus, the slopes on $\mathbb{R}^+$ and $\mathbb{R}^-$ have to be the same.

As Andres Caicedo pointed out, and I have tried to account for, logs of negative numbers are problematic, as is $g(x)=0$. $g(x)=0$ is a solution, but then $f(x)=f(0)$ is still linear.

-
Bingo. THIS is the answer I was looking for. I have up-voted it and accepted it. I love MSE! – Mike Jones Aug 22 '11 at 22:41
robjohn, sorry for complaining again, but if the slopes are different on $\mathbb{R}^+$ and on $\mathbb{R}^-$ then your function isn't differentiable at zero. @Mike: when you say differentiable, then you usually imply differentiable everywhere. – t.b. Aug 22 '11 at 22:49
@Theo Buehler: thanks for keeping an eye on me :-) I was actually writing that up. – robjohn Aug 22 '11 at 22:51
Ah, very good :) [By the way: using @Theo would be sufficient for a notification (and I prefer to be addressed with my first name only), in fact, the first three letters of a user name are enough for a ping.] – t.b. Aug 22 '11 at 22:54
Well, $g(x)=0$ is still possible. (Again, this is all minor, as the approach can be rewritten to avoid using logarithms, or to avoid their use at those points, and to slightly detour through complex numbers if needed, etc, but as written here is problematic.) – Andrés E. Caicedo Aug 22 '11 at 23:15

If $f\in C^2$ (it is twice differentiable, and $f''$ is continuous), then the answer is yes; I don't know if it's necessarily true without this hypothesis.

If $f(x)-xf'(x)=f(0)$ for all $x$, then $$f(x)=xf'(x)+f(0),$$ so that $$f'(x)=f'(x)+xf''(x)$$ $$0=xf''(x)$$ This shows that $f''(x)=0$ for all $x\neq0$, but because $f''$ is continuous this forces $f''(x)=0$ everywhere. Thus $f'$ must be constant, and thus $f$ must be linear.

-
Nice, but since it strengthens the hypothesis, is only of ancillary interest. – Mike Jones Aug 22 '11 at 22:41
I believe that $f$ is linear on $\mathbb{R}$ if $f\in C^1$. – robjohn Aug 22 '11 at 22:42
On second thought, $C^1$ is not needed. – robjohn Aug 22 '11 at 22:52
No, $C^1$ is not needed. For $x\not=0$, the defining equation gives $f'(x)=(f(x)-f(0))/x$. Hence $f''(x)$ exists. Following the argument of Chonoles, we have $f''(x)=0$, so $f$ is affine on both $(0,\infty)$ and $(-\infty,0)$. Now the existence of $f'(0)$ implies that the two branches of $f$ must be collinear. – user1551 Aug 23 '11 at 6:25

Suppose $f$ is differentiable and satisfies your equation, $f(x)-xf'(x)=f(0)$.

[Edit: This is a revised answer. The previous one was terribly flawed.]

Note that $\displaystyle \frac{f(x)-f(0)}x=f'(x)$ for any $x\ne0$. This shows that $f'$ is differentiable, except perhaps at 0. Differentiating this equation, we obtain $f''(x)=\displaystyle \frac{xf'(x)-(f(x)-f(0))}{x^2}=0$.

If $f''$ is continuous (at 0) it follows that $f'$ is constant and therefore $f$ is linear.

In any case, the above shows that $f$ is linear in $(-\infty,0)$ and in $(0,\infty)$, and we are given that it is differentiable at 0.

But then $f$ is linear: Say that $f(x)=ax+b$ for $x<0$ and $f(x)=cx+d$ for $x>0$. Then $f'(x)=a$ for $x<0$ and $f'(x)=b$ for $x>0$ and $f'(0)$ exists. Since derivatives satisfy the intermediate value theorem (see for example Rudin "Principles of Mathematical Analysis" Theorem 5.12), it follows that we must have $a=f'(0)=b$. Since differentiability implies continuity, it follows that $\displaystyle b=\lim_{x\to 0^-}f(x)=f(0)=\lim_{x\to0^+}f(x)=d$.

-
I don't think this is enough. Applying the Mean Value Theorem, $\frac{f(x)-f(0)}{x}=f'(x)$ only tells us that for some $\xi\in(0,x)$, $f'(x)=f'(\xi)$. Simply because the limit as $x\to 0$ is $f'(0)$ doesn't mean that $f'(x)=f'(0)$ for all $x$. I think something more global is needed. – robjohn Aug 22 '11 at 22:26
Oh, you are right. That was sloppy. – Andrés E. Caicedo Aug 22 '11 at 22:34
Right. Before I posted this question to MSE, I considered exactly this argument, but saw the hole in it, just as robjohn pointed out. – Mike Jones Aug 22 '11 at 22:40
Hehe. Fixed now. @robjohn: Thanks for noticing the problem. – Andrés E. Caicedo Aug 22 '11 at 22:52

The following argument uses not much machinery.

Suppose that $f(0)=b$ and $f'(0)=m$. Let $g(x)=f(x)-(mx+b)$. Then $g(0)=0$ and $g'(0)=0$. Note that $$g(x)-xg'(x)=[f(x)-(mx+b)] -x(f'(x)-m)=0=g(0).$$ So $xg'(x)-g(x)=0$ for all $x$.

For $x \ne 0$, let $h(x)=g(x)/x$. Then for any $x \ne 0$, we have $$h'(x)=\frac{xg'(x)-g(x)}{x^2}=0.$$

It follows that $h(x)$ is a constant $p$ on $(0, \infty)$, and a constant $n$ on $(-\infty,0)$.
Thus $g(x)=px$ on $(0,\infty)$ and $g(x)=nx$ on $(-\infty,0)$.

But $g'(x)=0$. So $$\lim_{x\to 0+} \frac{px-0}{x-0}=0.$$ It follows that $p=0$. In the same way we can show that $n=0$. So $g(x)$ is identically $0$, and therefore $f(x)=mx+b$.

-

Suppose that $y=f(x)$ is a differentiable function that satisfies $f(x)-xf'(x)=f(0)$ for all $x\in\mathbb{R}$. Then $y=f(x)$ satisfies the linear differential equation $$y'=\frac{y-k}{x},$$ where $k=f(0)$. The homogeneous system $y'=\frac{y}{x}$ has solutions $y_\lambda=\lambda x$, for any $\lambda\in\mathbb{R}$. Also, the equation $y'=(y-k)/x$ has a solution $y_p=x +k$. Thus, all the solutions of our differential equation are of the form $y=y_\lambda+y_p$ for some $\lambda\in\mathbb{R}$, i.e., $$y=\mu x + k,$$ where $\mu=\lambda+1\in\mathbb{R}$. Hence, all functions $f(x)$ with said property are linear.

Note: Technically, the existence and uniqueness theorem for linear differential equations tells us that the differential equation $y'=f(x,y)=(y+k)/x$ has a unique solution $f_1(x)$ in $(0,\infty)$ and also a unique solution $f_2(x)$ in $(-\infty,0)$, because $f(x,y)$ has a discontinuity at $x=0$. The argument above says that $f_1(x)=\mu_1 x+k$ and $f_2(x)=\mu_2 x + k$ are linear. Since we are assuming that $f$ is differentiable, we must have $\mu_1=\mu_2=\mu$ and $f(x)=\mu x + k$.

-