1

This question was inspired by the solution to this problem: Piecewise linear function and absolute value.

Question: Suppose you have the real-valued piecewise function:

\begin{equation*} f(x) = \begin{cases} f_1(x), & \text{if } x < a \\ f_2(x), & \text{if } x \geq a \end{cases}, \end{equation*} where $f_1$ is continuous and differentiable on the left side of $a$ and $f_2$ is continuous and differentiable on the right side of $a$. Is there a systematic way to write $f(x)$ without making it piecewise? I suspect the answer will have something like the form:

$f(x)=f_1(x) \space + \space $(something involving $f_1'$ and $f_2'$) $ \space \cdot \space$ (some mix of $f_1$ and $f_2$ along with $a$ involving absolute values),

but the only reason I suspect this is because of the special case where the $f_i$s are linear.

Note: The case where $f$ is continuous and piecewise-linear is straightforward:

\begin{equation*} f(x) = \begin{cases} \alpha_1 x+\beta_1, & \text{if } x < a \\ \alpha_2 x+\beta_2, & \text{if } x \geq a \end{cases}, \end{equation*}

\begin{equation} = (\alpha_1 x+\beta_1)+\frac{\alpha_2-\alpha_1}{2}\cdot(|x-a|+x-a) \end{equation}

which can be reasoned to graphically and algebraically through examples, but I don't see how to generalize it from there.

Luke
  • 86
  • 4

1 Answers1

2

You can write indicator functions of intervals $[a,\infty]$ in terms of absolute values:

$$1_{[a,\infty]}(x)=\frac{1}{2}\left(\frac{|x-a|}{(x-a)}+1\right)$$

so you can write indicator functions of intervals $[a,b]$ in terms of absolute values:

$$1_{[a,b]}(x)=1_{[a,\infty]}(x)-1_{[b,\infty]}(x)=\frac{1}{2}\left(\frac{|x-a|}{(x-a)}-\frac{|x-b|}{(x-b)}\right)$$

From there you can just multiply your $f_i$ by their respective interval indicator functions and take the sum.

S.L.
  • 1,120