Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose for example that I have a function $g_y(x)$ such that

$g_y(x) = \begin{cases} y+x &\mbox{if } -x<y<1-x \\ 1 & \mbox{if } y>1-x \\0 &\mbox{if } y<-x \end{cases}$

How, if possible, would I find $ \frac{dg}{dx} $?

Edit: Also, I need to have that $ x\in (0,1)$

share|cite|improve this question
up vote 1 down vote accepted

$$g_y(x) = \begin{cases}0 & \text{if } x < -y\\ x+y & \text{if }x \in (-y,1-y)\\ 1 & \text{if }x > 1-y\end{cases}$$ You also need $x \in (0,1)$. We will split it into cases depending on where $y$ lies.

If $y \leq -1$, then we get that $g_y(x) = 0$ for all $x \in (0,1)$.

If $-1 \leq y \leq 0$, then we get that $$g_y(x) = \begin{cases}0 & \text{if } x \in (0,-y)\\ x+y & \text{if }x \in (-y,1)\end{cases}$$ for all $x \in (0,1)$.

If $0 \leq y \leq 1$, then we get that $$g_y(x) = \begin{cases} x+y & \text{if }x \in (0,1-y)\\ 1 & \text{if }x \in(1-y,1)\end{cases}$$ for all $x \in (0,1)$.

If $y \geq 1$, then we get that $g_y(x) = 1$ for all $x \in (0,1)$.

Now you should be able to work out the derivative with relative ease. Note that if $y \in [-1,0]$, then the function is not differentiable at $-y$ and for $y \in [0,1]$, the function is not differentiable at $1-y$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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