# Finding the derivative of an indicator function using the limit definition.

Find the derivative of the function:

$$\frac {x^2}2 \cdot (I[x \ge 0] - I[x < 0])$$

Using the limit definition:

$$\lim_{h \to 0} \frac {f(x+h) - f(x)}{h}$$

Now at a simple glance, I know the derivatives of this is the absolute value function ($x \cdot (I[x \ge 0] - I[x < 0])$) as I obtained the other function through integration. My trouble here is that I cannot the algebraic steps for evaluating the limit.

I found that I could restructure the function as:

$$\frac {x^2}2 \cdot (I[x \ge 0] + 1 - I[x < 0] - 1)=$$

$$\frac {x^2}2 \cdot (I[x \ge 0] + I[x\ge 0] - 1)=$$

$$x^2 \cdot I[x \ge 0] - \frac {x^2}2$$

I'm not sure if that is easier to take the derivative of. It looks like it might be.

At any point other than $0$, this derivative is as easy to prove as finding $x^2$'s:

If $x < 0$:

$$f'(x) = \lim_{h \to 0} \frac {f(x+h) - f(x)}{h} = \lim_{h \to 0} \frac {\frac{-(x+h)^2}2 + \frac{x^2}2}{h} = \lim_{h \to 0} \frac {xh + \frac{h^2}2}{h} = x$$

If $x > 0$:

$$f'(x) = \lim_{h \to 0} \frac {f(x+h) - f(x)}{h} = \lim_{h \to 0} \frac {\frac{(x+h)^2}2 - \frac{x^2}2}{h} = \lim_{h \to 0} \frac {-xh + \frac{h^2}2}{h} = -x$$

Finally, if $x = 0$:

$$f'(0) = \lim_{h \to 0} \frac {f(0+h) - f(0)}{h}$$

$$\lim_{h \to 0^+} \frac {f(0+h) - f(0)}{h} = \lim_{h \to 0^+} \frac {\frac{-(0+h)^2}2 - \frac{0^2}2}{h} = \frac12\lim_{h \to 0^+} \frac {-h^2}{h} = 0$$

$$\lim_{h \to 0^-} \frac {f(0+h) - f(0)}{h} = \lim_{h \to 0^-} \frac {\frac{(0+h)^2}2 + \frac{0^2}2}{h} = \frac12\lim_{h \to 0^-} \frac {h^2}{h} = 0$$

Therefore, $f'(0) = 0$

And by their powers combined...

$$f'(x) = x * (I[x >= 0] - I[x < 0]) = abs(x)$$

Edit: As Did said, indicator functions are defined case by case so sometimes it's not possible to work with them without splitting. That said, there is a way to obtain $f'(x)$ with a little less surgery. As in:

$$f(x) = \frac12 abs(x)x$$

$$\frac{df(x)}{dx} = \frac{d(\frac12 abs(x)x)}{dx}$$

Now, for $x \ne 0$, we can express the derivative of $abs(x)$ as $\frac{abs(x)}x$, so:

$$\frac{d(\frac12 abs(x)x)}{dx} = \frac12\left[ x\frac{d(abs(x))}{dx} + abs(x)\frac{dx}{dx} \right] = \frac12\left[ x\frac{abs(x)}{x} + abs(x)\right] = abs(x)$$

And then for $x=0$ we proceed as before.

• But how would it be solved without splitting it? I don't want it solved case by case. I want to know how the entire expression can be reduced... – The Great Duck Jun 12 '16 at 2:50
• "I don't want it solved case by case" Why? Note that this is an odd requirement, starting from a function very much defined "case by case". – Did Jun 12 '16 at 14:04
• @Did Becuase I want to know the limit identities regarding indicator functions used in solving it. – The Great Duck Jun 15 '16 at 20:46
• @Emisor I see though... I guess whatever direct identity comes into play is too complex for our minds to grasp. Either that, or the identity is the derivation result. – The Great Duck Jun 15 '16 at 20:50