Let
f(x) = x^2 - 4 if x >= -4
f(x) = 3x + 1 if x < -4
Then for how many values of x is f(f(x)) = 5?
solve f(x)=5
if x >= -4
5 = x^2 - 4
9=x^2
x= +3 or -3 but X>-4 so both are ok
Now solve f(x)=3 and then f(x)=-3
3=x^2-4
7=x^2
x=+/- sqrt(7) both are bigger than -4 so they are ok
-3=x^2-4
1=x^2
x=+1 or -1
-------------
Solve f(x)=5 when x<-4
5=3x+1
4=3x
x=4/3 which is not less than -4 so there are no solutions here
-----------
So I have found x=sqrt(7), x=-sqrt(7), x=1 and x=-1
I have checked these answers, they all work.