Answer
$a=0$
$b=1$
Work Step by Step
$\lim\limits_{x \to 0^-}f(x)$
$=\lim\limits_{x \to 0^-}\cos(x)$
$=\cos(0)$
$=1$
$\lim\limits_{x \to 0^+}f(x)$
$=\lim\limits_{x \to 0^+}(ax+b)$
$=a(0)+b$
$=b$
For $f(x)$ to be differentiable, it must be continuous.
Therefore, $b = 1$.
$ax + 1$
$x \rightarrow 0^-$
$f(x) = cos(x)$
$f'(x) = -sin(x)$
$f'(0) = -sin(0)$
$f'(0) = 0$
$x \rightarrow 0^+$
$f(x) = ax + 1$
$f'(x) = a$
The differentiation at $x=0$ should be equal when approaching from the left and right side.
So $a=0$.