For some constants a and b let
f(x) = 8 - x if x <= 4
f(x) = ax + b if x > 4
The function f has the property that f(f(x)) = x for all x. What is a + b?
Note that f(x) will always put out a value greater than or equal to four for an imput of less than or equal to four.
For x<=4:
f(f(x)) = a(f(x))+b = a(8 - x) + b = x
We want (a,b) such that a(8 - x) + b = x for x<=4.
-ax + 8a + b = x
There is only one term on the left that contains x, which means that it must be equal to x. The only value of a that would do that is a = -1.
x - 8 + b = x
b = 8
a + b = 7
(I didn't check this, it could be wrong)