$f(x)=x^3-x+1$. Find the number of real roots of $f(x)=0$, the number of local maxima of $y=|f(x)|$ and the number of local minima of $y=f(|x|)$ $f(x)=x^3-x+1$
$f'(x)=3x^2-1$, It will be zero at $x=1/3,-1/3$
$f"(x)=6x,$ so $1/3$ is a local minima and $-1/3$ a local maxima. It can have $1$ root or $3$ roots
$y=|x^3-x+1|$, the function will have one local maxima.
$y=f(|x|)$, the only difference between this function and the second one is that while the second one becomes "v shaped" at the x axis, the turning point for this function is the y axis. Since the minima occurs before $y=0$, it will have two minima.
The number of roots doesn't affect the shape of the function so I can solve the second part and third parts.
However my book says that my answers are wrong, where is my logic going wrong? Please help, thanks :)
Edit: Made some corrections
Edit:More corrections
 A: Well, that the first derivative $f'(x)=3x^2-1$ does not imply that the function is always increasing; this is $0$ at $\pm \sqrt{\frac{1}{3}}$.
However, at $x^+=\sqrt{\frac{1}{3}}$ i.e., the positive root of $f'$, note that the second derivative $f''=6x$ is positive, so the first derivative $f'$ is increasing at $x^+$ so $x^+$ must be a local minimum. Likewise, at $x^-=-\sqrt{\frac{1}{3}}$ i.e., the negative root of $f''$, note that the second derivative $f''=6x$ is negative so the first derivative $f'$ of $f$ is decreasing so $x^-$ must be a local maximum of $f$.
So $f$ has exactly one local maximum and exactly one local minimum.
To see that $f$ has only 1 zero, calculate directly that $f$ is positive in the interval $[x^-,x^+]$ [or note that $f(x^-),f(x^+)$ are both positive and use the fact that there is no local minimum of $f$ in $(x^-,x^+)$ to see that $f$ must be positive everywhere on the interval $[x^-,x^+]$ ]. Thus so there can be no roots in that interval. And as $f(x^+)$ is positive and $f$ is increasing in $[x^+,\infty)$ [because $f'$ is nonnegative on that interval], there can be no zeros of $f$ in $[x^+,\infty)$ either. However, $f(x^-)$ is positive but $f(-3)$ is negative, so there has to be at least one root in $[-3,x^-]$ so $f$ has to have at least one real root. Can you check for yourself that $f$ has no roots $x'$ satisfying $x'<-3$ and thus conclude that $f$ has exactly one real root?
A: $f(x) = x^3 - x + 1\\
f'(x) = 3x^2 - 1\\
f''(x) = 6x\\
\lim_\limits{x\to \infty} = \infty\\
\lim_\limits{x\to -\infty} = -\infty\\
f(0) = 1$
$f'(x) = 0$ when $x = \pm \sqrt {\frac 13}$
The second derivative test says that $x = +\sqrt {\frac 13}$ is a local minimum and $x = -\sqrt {\frac 13}$ is a local maximum
If $f(\sqrt{\frac 13}) > 0$ then $f(x)$ has 1 real root.
Analysis of the end behavior tells us that that root will be on the left side of the maximum.
If $f(\sqrt{\frac 13}) < 0$ then $f(x)$ has 3 real roots.  The end behavior tells us one root on the left side of the maximum, one between the max and the min, and one on the right side of the minimum.
$f(|x|)$ will have as many roots for $x\in(-\infty, 0)$ as $f(x)$ has for $x\in (0,\infty)$
$|f(x)|$ will have additional critical points whenever $f(x) = 0$  these will be minima.
if $x_0$ is a minimum of $f(x)$ and $f(x_0)< 0$ then $f(x_0)$ will be a maximum.
