In addition to this problem, I have a similar problem in my assignment asking me to find k such that $|x^2-1|+x=k$ has only one root. Proceeding similarly , I
Removed the modulus and made two different equations $x^2+x−(k+1)=0$ and $x^2−x+(k−1)=0$.
After this, I took $D_1>0$ and $D_2<0$ in the first case and $D_1<0$ and $D_2>0$ in the second. In the first case, I got $k=-5/4$ and $k>5/4$ and in the second case I got $k=5/4$ and $k<-5/4$. Where did I go wrong?