
It is evident that the given function f is defined at all points of the real line. If f is a continuous function, then f is continuous at all real numbers. In particular, f is continuous at x = 2 and x = 10 Since f is continuous at x = 2, we obtain

On subtracting equation (1) from equation (2), we obtain
8a = 16
⇒ a = 2
By putting a = 2 in equation (1), we obtain
2 × 2 + b = 5
⇒ 4 + b = 5
⇒ b = 1
Therefore, the values of a and b for which f is a continuous function are 2 and 1 respectively.