How to find the subgradient of $x \mapsto \max \left( (x+1)^2, (x-3)^2 \right) $ at $x=1$? I need help finding the subgradient of the following function at the point $x = 1$.
$$ \max \left( (x+1)^2, (x-3)^2 \right) $$
I think it's $$ [-4,4] $$ since that is the range between the left-hand and right-hand derivatives, but I can't prove it.

We can observe that
$$f(x) = \max((x+1)^2, (x-3)^2) = \begin{cases} (x+1)^2 & x \geq 1 \\ (x-3)^2 & x < 1 \end{cases}$$
and this function passes through $(1,4)$. Consider the line
$$y = a(x-1) + 4$$
This line intersects the parabola $y = (x+1)^2$ at $(1,4)$ and $(a-3,(a-2)^2)$ and intersects the parabola $y = (x-3)^2$ at $(1,4)$ and $(a+5,(a+2)^2)$. As such, the line only intersects $f(x)$ twice if $a-3 > 1$ or $a+5 < 1$, or equivalently, if $a > 4$ or $a < -4$. The subgradients are the values of $a$ for which this line does not intersect the graph of $f$ twice, which would be $[-4,4]$.
