Real numbers a and b are chosen so that each of two quadratic trinomials x

^{2}+ax+b and x

^{2}+bx+a has two distinct real roots and the product of these trinomials has exactly three distinct real roots.

Determine all possible values of the sum of these three roots.

a cannot equal b, else there would be only two distinct real roots.

Solve each quadratic using the quadratic formula to yield:

x = (-a+/-sqrt(a^2-4b))/2

x = (-b+/-sqrt(b^2-4a))/2

To have three distinct roots overall, one of the smaller roots of one quadratic must equal the larger root of the other quadratic. Wlog:

(-a-sqrt(a^2-4b))/2 = (-b-sqrt(b^2-4a))/2

Rearrange a bit to get the radicals on one side:

b-a = sqrt(a^2-4b) + sqrt(b^2-4a)

Square both sides and rearrange:

2a + 2b - a*b = sqrt(a^2-4b) * sqrt(b^2-4a)

Square both sides and rearrange again:

a^3 - a^2*b - a*b^2 + b^3 + a^2 - 2a*b + b^2 = 0

This last equation factors into (a+b+1) * (a-b)^2 = 0

The solution of a=b must be discarded leaving a+b+1=0 as a necessary condition for a and b.

Apply this to the two quadratics to get x^2 + ax - (a+1) and x^2 + bx - (b+1). These quadratics factor into (x-1) * (x+a+1) and (x-1) * (x+b+1).

Then the common root is x=1. Then the sum of the roots is (-a-1) + 1 + (-b-1) = -1*(a+b+1) = -1*0 = 0. The sum of the three distinct roots is always 0 for any valid choice of a,b.