For what values ​of $k$, $f(x)=\lvert x^{2}+(k-1) \lvert x \rvert -k \rvert$ is non-differentiable at five points? I arrived at the following answer by drawing graphs with a calculator:
$$k<0 \quad \& \quad k≠-1$$
But I was hoping that maybe it would be possible to find the answer by using an algebraic solution and not by drawing diagrams.
A tip that I used:

*

*Using the fact that to find points that are not differentiable functions that have absolute value the point where the branches of the absolute value are connected usually do not have a derivative.

As I said, I'm looking for an algebraic solution.
 A: $$f(x)=|x^2-(k-1)|x|-k|$$ will have 5 points of non differentiabilty if the quadratic $x^2-(k-1)x-k=0$ has both roots distinct and  positive. For this we need $(k-1)^2+4k=(k+1)^2>0$, which always met provivided $k$   is real and not equal to -1. Further, product and sum of the roots should be positive: $-k>0$ and $(1-k)>0$ these two imply $k<0 $. Then $f(x)$ the symmetric function will be non differentiable at $x=0, x_1,x_2, -x_1, -x_2.$ See below $f(x)$ for $k=-2$.

A: If $x>0$, then $|x|=x$ and
$$ x^2+(k-1)|x|-k = x^2+(k-1)x-k = (x+k)(x-1) $$
If $x<0$, then $|x|=-x$ and
$$ x^2+(k-1)|x|-k = x^2-(k-1)x-k = (x-k)(x+1) $$
Now if $f$ is a real function differentiable everywhere and $f(x)>0$ on an open interval $(a,b)$ (where $a$ is either real or $-\infty$ and $b$ is either real or $+\infty$), then $|f(x)|$ is also differentiable on that interval, since $|f(x)| = f(x)$ and $\frac{d}{dx} |f(x)| = f'(x)$ in that set. Similarly, if $f(x)<0$ on an open interval, then $|f(x)|$ is differentiable on the interval, since $|f(x)| = -f(x)$ and $\frac{d}{dx} |f(x)| = -f'(x)$ in that set. We can also write this fact as
$$ \frac{d}{dx} = \frac{|f(x)|}{f(x)} f'(x) $$
in any interval where $f(x) \neq 0$. The fraction term is always $\pm 1$.
So the only possible points where $|(x^2+(k-1)|x|-k)|$ might not be differentiable are $0$, the points where $x>0$ and $(x+k)(x-1) = 0$, and the points where $x<0$ and $(x-k)(x+1)$. To get all five points, we must have $k<0$, and the five potential points of discontinuity are $0, 1, -1, k, -k$. We'll also need $k \neq -1$, or else that set only has three values.
It just remains to check for whether the function actually is discontinuous at each point. Since the derivatives exist and are continuous everywhere except those critical points, we can just check whether the left and right limits of the derivative are unequal. Calling $f(x) = x^2+(k-1)|x|-k$, notice  $f(x) < 0$ if and only if $x$ is between $-1$ and $k$ or between $1$ and $-k$ (no matter which order those pairs come in). So the sign term $\frac{|f(x)|}{f(x)}$ changes between $+1$ and $-1$ at each of the points $x \in \{-1,k,1,-k\}$.
$$ \begin{align*}
\lim_{x \to 0^-} g'(x) &= \frac{|f(0)|}{f(0)} (2\cdot 0 + (k-1)) = k-1 < 0 \\
\lim_{x \to 0^+} g'(x) &= \frac{|f(0)|}{f(0)} (2\cdot 0 - (k-1)) = 1-k > 0 \\
\lim_{x \to -1^-} g'(x) &= \pm (2(-1) - (k-1)) = \pm(-k-1) \\
\lim_{x \to -1^+} g'(x) &= \pm (2(-1) - (k-1)) = \pm(-k-1) \\
\lim_{x \to k^-} g'(x) &= \pm (2 k - (k-1)) = \pm(k+1) \\
\lim_{x \to k^+} g'(x) &= \pm (2 k - (k-1)) = \pm(k+1) \\
\lim_{x \to 1^-} g'(x) &= \pm (2\cdot 1 + (k-1)) \pm(k+1) \\
\lim_{x \to 1^+} g'(x) &= \pm (2\cdot 1 + (k-1)) \pm(k+1) \\
\lim_{x \to -k^-} g'(x) &= \pm (2(-k) + (k-1)) = \pm(-k-1) \\
\lim_{x \to -k^+} g'(x) &= \pm (2(-k) + (k-1)) = \pm(-k-1)
\end{align*} $$
Since each pair after the $x \to 0$ pair has a changing sign with the same expression, and we already require $k \neq -1$, each pair of limits approaches two different values, so the function really is not differentiable at each of the five points, as long as $k<0$ and $k \neq -1$.
A: $$f(x)=|(|x|+k)(|x|-1)|$$
For $5$ points of non-differentiability, both the roots of $(x+k)(x-1)$ should lie on the positive $x-$axis.
Thus $k\lt0$.
At $k=-1$, we'll have a repeated root, thus we won't get $5$ points of non-differentiability.
Thus, $k\in(-\infty,0)-\{-1\}$
