I have the following question and the solution along with it but I can't get my head around what's been done.

The aim is to write the following function as a sum of even and odd functions:

$h(x) = \begin{cases} 1, & \text{if $x<0$} \\ e^x, & \text{if $ x\geq 0$} \end{cases} $

I am aware that any function $f(x)$ can be written as:

$f(x) = \underbrace{\frac{1}{2}(h(x)+h(-x))}_{f_{even}(x)}+ \underbrace{\frac{1}{2}(h(x)-h(-x))}_{f_{odd}(x)}$

I attempted to do it myself but it was incorrect.

The correct method was to find the following:

We have

$h(-x) = \begin{cases} 1, & \text{if $x>0$} \\ e^{-x}, & \text{if $ x\leq 0$} \end{cases} $


$h_{even}(x) = \begin{cases} \frac{1}{2}(1+e^{-x}), & \text{if $x<0$} \\ \frac{1}{2}(1+e^{x}), & \text{if $ x> 0$} \\ \ 1, & \text{ if $x=0$}\end{cases} $

$h_{odd}(x) = \begin{cases} \frac{1}{2}(1-e^{-x}), & \text{if $x<0$} \\ \frac{1}{2}(e^{x}-1), & \text{if $ x> 0$} \\ \ 0, & \text{ if $x=0$}\end{cases} $

My problem is I have no idea how these functions were found.. I'm sure it's as simple as applying the formula I stated above but I think perhaps because they are piece wise functions I am not entirely sure how this happened.

Any explanation is greatly appreciated.

Further Info:

I think I understand the formula but applying it to examples particularly is where I struggle, as in the actual calculation is what I don't understand.

For example, to calculate $h_{even}(x)$ we should do the addition of the following functions, if I am correct:

$ \frac{1}{2}h(x) = \begin{cases} \frac{1}{2}, & \text{if $x<0$} \\ \frac{1}{2}e^x, & \text{if $ x\geq 0$} \end{cases} $

$\frac{1}{2}h(-x) = \begin{cases} \frac{1}{2}, & \text{if $x>0$} \\ \frac{1}{2}e^{-x}, & \text{if $ x\leq 0$} \end{cases}$

But my issue is, how do you combine these? How can you deduce that for example $h_{even}(x)=1$, if $x=0$ purely from this addition.

I guess my question is quite simple really as in just how to add piece wise functions when the conditions are different.


Note that in your expression $$f(x) = \underbrace{\frac{1}{2}(h(x)+h(-x))}_{f_{even}(x)}+ \underbrace{\frac{1}{2}(h(x)-h(-x))}_{f_{odd}(x)}$$ $$f(x) = \frac{1}{2}h(x) + \frac{1}{2}h(x) + \frac{1}{2}h(-x)-\frac{1}{2}h(-x)$$ $$f(x) = h(x)$$ This derivation should help you out, as finding $f_{even}$ and $f_{odd}$ is now just a matter of calculation.

  • $\begingroup$ I think perhaps it is the calculation I am struggling with.. I have added more information at the end of the question. $\endgroup$ – Evan May 18 '17 at 12:31
  • 1
    $\begingroup$ As for your question on how to add piecewise functions. You can split up the bounds further so that you have $x>0$, $x<0$, and $x=0$. Then you can go about adding up the similar parts of the functions. Does that help? $\endgroup$ – Isaac Browne May 18 '17 at 12:34
  • $\begingroup$ Yes !! God it's so simple now, thank you so much ! :) $\endgroup$ – Evan May 18 '17 at 12:41

$$f(x)=\frac12 \Big(2f(x)\Big)=\frac12 \Big(f(x)+f(x)\Big)=\frac12 \Big(f(x)-f(-x)+f(x)+f(-x)\Big)=\underbrace{\frac12 (f(x)+f(-x))}_{\text{Even function}}+\underbrace{\frac12 (f(x)-f(-x))}_{\text{Odd function}}$$

In your solution $h(x)=f(x)$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.