how to find subdifferential of a function $x^2+ |x-1|+|x-2|$

3.7k Views Asked by At

Given a function

$f(x) = x^2+ |x-1|+|x-2| $

find it's subdifferential.

My approach to solving this was to divide the answer into 5 parts:

  1. For |x-1|>1 and |x-2|>2

    $f(x) = x^2+ x-1+x-2$ and $f'(x) = 2x+2$

  2. For |x-1|<1 and |x-2|<2

    $f(x) = x^2-(x-1)-(x-2)$ and $f'(x) = 2x-2$

  3. For |x-1|>1 and |x-2|<2

    $f(x) = x^2+(x-1)-(x-2)$ and $f'(x) = 2x$

  4. For |x-1|<1 and |x-2|>2

    $f(x) = x^2-(x-1)+(x-2)$ and $f'(x) = 2x$

  5. For |x-1|=1 and |x-2|=2

    $ f(x) = x^2$ and $f'(x) = 2x$

Does this look right? Is this the correct approach?

3

There are 3 best solutions below

1
On BEST ANSWER

Here's an approaching using the subdifferential sum rule: \begin{align} \partial f(x) &= \partial f_1(x) + \partial f_2(x) + \partial f_3(x) \\ &= f_1'(x) + \partial f_2(x) + \partial f_3(x) \end{align} where $f_1(x) = x^2, f_2(x) = |x - 1|$, and $f_3(x) = |x - 2|$.

The function $f$ is differentiable everywhere except at $x = 1$ and $x = 2$. If $x \neq 1$ and $x \neq 2$, then we have $$ \partial f(x) = \{f_1'(x) + f_2'(x) + f_3'(x)\}. $$ If $x = 1$, we have \begin{align} \partial f(x) &= \{f_1'(x) \} + \partial f_2(x) + \{f_3'(x)\} \\ &= \{f_1'(x)\} + [-1,1] + \{f_3'(x)\} \\ &= \{f_1'(x) + f_3'(x) + g \mid -1 \leq g \leq 1 \}. \end{align} If $x = 2$, we have \begin{align} \partial f(x) &= \{f_1'(x)\} + \{f_2'(x)\} + \partial f_3(x) \\ &= \{f_1'(x)\} + \{f_2'(x)\} + [-1,1] \\ &= \{ f_1'(x) + f_2'(x) + g \mid -1 \leq g \leq 1\}. \end{align}

3
On

First, I have to admit I am not familiar with a "subdifferential". It look to me like you are just taking the derivative. Second, dividing with things like "|x- 1|> 1 and |x- 2|> 2" is confusing and probably not what you want. Instead divide the real line into three intervals: $x\le 1$, $1< x\le 2$, and $x> 2$.

For $x\le 1$ both x-1 and x-2 are negative: $x^2+ |x- 1|+ |x- 2|= x^2- (x- 1)- (x- 2)= x^2- 2x+ 3$. The derivative is $2x- 2$.

For $1< x\le 3$ x-1 is positive but x-2 is still negative:$x^2+ |x- 1|+ |x- 2|= x^2+ (x- 1)- (x- 2)= x^2+ 10$. The derivative is $2x$.

For $x> 2$ both x-1 and x-2 are positive: $x^2+ |x- 1|+ |x- 2|= x^2+ (x- 1)+ (x- 2)= x^2+ 2x- 3$. The derivative is $2x+ 2$.

0
On

You have the idea of changing your absolute values but you made some mistakes in writing $|x-1|>1$ and similar inequalities.

Instead you need to partition the real line into intervals $$(-\infty,1)\cup (1,2)\cup (2,\infty)$$ and evaluate $$f(x) = x^2+ |x-1|+|x-2|$$ on each interval and differentiate the result.

For example on $(-\infty, 1)$ we have $$f(x) = x^2+ |x-1|+|x-2| = x^2 -(x-1)-(x-2)=x^2-2x+3$$ and the derivative is $$f'(x) = 2x-2$$

For the boundary points the function is not differentible.