Since 1 < x < 5, adding each side by a, where a is negative, gives
a > ax > 5a
and adding b to each side gives
a + b > ax + b > 5a + b
or
5a + b < ax + b < a + b
Since 7 < f(x) < 23, it follows that
5a + b = 7
a + b = 23
Solve for a by eliminating b :
(5a + b) - (a + b) = 7 - 23
4a = -16
a = -4
Solve for b :
-4 + b = 23
b = 27