# What are a and b if the roots of equation x^2+ax+b=0 are integers and a+b=12?

### 1 Answer | Add Yours

The roots of the equation x^2 + ax + b = 0 are `x1 = (-a + sqrt(a^2 - 4b))/2` and `x2 = (-a - sqrt(a^2 - 4b))/2`

a + b = 12 and as the roots are integers `a^2 - 4b = (12 - b)^2 - 4b` has to be a square.

`(12 - b)^2 - 4b = (12 - b - 2*sqrt b)(12 - b + 2*sqrt b)`

`-2*sqrt b = 2*sqrt b`

=> `4*sqrt b = 0`

=> b = 0

a = 12

**The required values of a and b are 12 and 0 respectively.**