# Prove that a function is linear

Let $$U \subseteq \mathbb R^k$$ be an connected open set, and let $$f:U\to\mathbb R$$.

Suppose that $$\forall p\in U$$, there exists a closed set $$C$$ with non-empty interior such that $$p\in C$$ and $$f(x)=a_C\cdot x+b_C$$ on $$C$$ ($$a_C \in \mathbb R^k$$ is a constant vector and $$b_C$$ is a constant for each $$C$$).

Prove that $$f$$ is linear over $$U$$ (that is, $$f(x)=a\cdot x + b$$).

It seems really intuitive and straight forward but I don't even know how to get started.

• $U$ needs to be connected. When $U$ is open and connected consider two expressions of $f$ on the intersection of the interior of two of $C$ in the hypothesis. That is to say, assume $a_1 \cdot x + b_1 = a_2 \cdot x + b_2$ are equal on an open set. Then, their derivates are the same, but the derivative of the left hand side at any point is $h \mapsto a_1 \cdot h$ and that of the right hand side is $h \mapsto a_2 \cdot h,$ here $h$ runs through all of $\mathbf{R}^k.$ Then, $a_1 = a_2$ (for we have $a_1 \cdot h = a_2 \cdot h$ and we can consider $h = a_1 - a_2$). $b_1 = b_2$ by subtraction. – Will M. Feb 18 at 22:06
• @WillM. I'm failing to see why $f$ couldn't be piecewise linear. More precisely, it's not clear that the interiors of the closed sets we get will necessarily intersect. – jgon Feb 18 at 22:09
• Is $p$ in the interior of $C?$ – zhw. Feb 18 at 23:59
• @WillM. Perhaps I should be more clear. I understood your comment, but the question doesn't give us an open ball around every point on which $f$ is linear, it gives us a closed set with nonempty interior containing every point on which $f$ is linear. And a (continuous) piecewise linear function satisfies this second property but not the first. Thus your argument fails. – jgon Feb 19 at 14:00
• @jgon correct, I read that $p$ was in the interior (I think I did this exercise long ago). But as written is not correct. – Will M. Feb 19 at 15:18

This is false as written. Consider $$f : \Bbb{R}\to\Bbb{R}$$ defined by $$f(x) =\begin{cases} x & x\le 0 \\ 2x & x > 0 \end{cases}$$
Then we can cover $$\Bbb{R}$$ by the closed sets with nonempty interior $$(-\infty, 0]$$ and $$[0,\infty)$$, and $$f$$ is linear on each of these closed sets. Thus this is a counterexample to the claim.
The claim can be saved by requiring $$p$$ to be in the interior of your closed sets (which means you may as well just take open sets in the first place), and this can be proved by following the argument given by Will M. in the comments.