If $(x+a)(x+8)=x^{2}+b x+24$ for all values of $x$, then $a+b$ equals
(A) 32
(B) 144
(C) 40
(D) 14
(E) 16
Solution 1

Since $(x+a)(x+8)=x^{2}+b x+24$ for all $x$, then $x^{2}+a x+8 x+8 a=x^{2}+b x+24$ or $x^{2}+(a+8) x+8 a=x^{2}+b x+24$ for all $x$.

Since the equation is true for all $x$, then the coefficients on the left side must match the coefficients on the right side.

Therefore, $a+8=b$ and $8 a=24$.

The second equation gives $a=3$, from which the first equation gives $b=3+8=11$.

Finally, $a+b=3+11=14$.

## Solution 2

Since $(x+a)(x+8)=x^{2}+b x+24$ for all $x$, then the equation is true for $x=0$ and $x=1$.

When $x=0$, we obtain $(0+a)(0+8)=0+0+24$ or $8 a=24$, which gives $a=3$.

When $x=1$, we obtain $(1+3)(1+8)=1+b+24$ or $36=b+25$, which gives $b=11$.

Finally, $a+b=3+11=14$.