f(x) = (x2-1)|x2-3x+2| +cos(|x|)
As most of you have pointed out cos(|x|) is a red herring as cos(|x|) = cosx, so the point x=0 can be ignored.
So, the critical points become the roots of x2-3x+2, x=1 and x=2
g(x) = (x2-1)|x2-3x+2| can be written out as
g(x) = (x
2-1)(x
2-3x+2) -

<x

1
= -(x
2-1)(x
2-3x+2) 1

x

2
= (x
2-1)(x
2-3x+2) 2

x<

I agree with all of you when you say that it is not differentiable at x=2. But it is definitely differentiable at x=1.
Consider P(x) = (x2-1)(x2-3x+2) = (x-1)2(x+1)(x-2)
x=1 is a double root of P(x) and hence also a root of P'(x).
That means the slope of g(x) is zero for x

1
- and x

1
+.
AT x=2, you get a non-zero value for P'(x). So, the slopes on either side of 2 will be equal in magnitude but opposite in sign. So, it is not differentiable at x=2.
The function is not differentiable at only one point,x=2