Solution 1
Since f(x)=ax+b for all real numbers x, then f(t)=at+b for some real number t.
When t=bx+a, we obtain f(bx+a)=a(bx+a)+b=abx+(a2+b).
We also know that f(bx+a)=x for all real numbers x.
This means that abx+(a2+b)=x for all real numbers x and so (ab−1)x+(a2+b)=0 for all real numbers x.
For this to be true, it must be the case that ab=1 and a2+b=0.
From the second equation b=−a2 which gives a(−a2)=1 and so a3=−1, which means that a=−1.
Since b=−a2, then b=−1 as well, which gives a+b=−2.
Solution 2
Since f(x)=ax+b for all x, then when x=a, we obtain f(a)=a2+b.
Since f(bx+a)=x for all x, then when x=0, we obtain f(a)=0.
Comparing values for f(a), we obtain a2+b=0 or b=−a2.
This gives f(x)=ax−a2 for all real numbers x and f(−a2x+a)=x for all real numbers x.
Since f(−a2x+a)=x for all x, then when x=−1, we obtain f(a2+a)=−1.
Since f(x)=ax−a2 for all x, then when x=a2+a, we obtain f(a2+a)=a(a2+a)−a2.
Comparing values for f(a2+a), we obtain a(a2+a)−a2=−1 or a3=−1.
Since a is a real number, then a=−1.
Since b=−a2, then b=−1, which gives a+b=−2.
Checking, we see that if f(x)=−x−1, then f(−x−1)=−(−x−1)−1=x, as required.