# Is composition of piecewise linear functions again a piecewise linear function?

I have some piecewise linear (not necessarily continuous) functions (also, in case it matters, in my specific case 'a' is larger than 0 in all functions). Is every the composition of those functions again a piecewise linear (not necessarily continuous) function?

If yes, how about the slightly more complicated scenario. The functions are still piecewise, but now the pieces are not ideal linear functions anymore but include a small amount of 'noise': f(x)= a*x+b+randomNoise (randomNoise is different for every call to f(), but always smaller than a). Is the composition of such functions again a piecewise linear function of the form f(x)= a*x+b+randomNoise for all pieces?

-

Yes, the composition of piecewise linear functions is piecewise linear.

However, your "linear plus random noise" class is not closed under composition, at least under reasonable standard assumptions about what "random noise" is allowed to look like. Consider

$$f(x) = \max(0,x) + 0\cdot\mathit{noise}$$ $$g(x) = 0 + 1\cdot\mathit{noise}$$

Then $f(g(x))$ is $0$ plus some one-sided noise, which probably isn't what you were expecting to get.

-
In my case, all 'a' are larger than 0 and all noise is larger than 0 but smaller than 'a'. Does this change things (the example you give can not happen in my case) ? – user10399 Jul 27 '12 at 1:46
@user10399: The inner noise will still behave "strangely" around the junction points in the outer function. It is possible (perhaps even plausible) that this strangeness will not be pronounced enough to upset things for whatever application you have in mind, but (naturally) that depends on what the application actually is -- as well as on what kind of noise we're talking about in the first place. – Henning Makholm Jul 27 '12 at 2:01