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?

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$.
