The equation x^2+px+q=0, q cannot be equal to 0, has two unequal roots such that the squares of the roots are the same as the two roots. Calculate the product pq.

I think the obvious root would be one but the second roots i just can't figure out!

a web search will turn up this exact problem and its solution

To find the roots of the quadratic equation x^2 + px + q = 0, we can use the quadratic formula:

x = (-p ± √(p^2 - 4q)) / 2

Since the squares of the roots are equal to the two roots, we can write it as:

x^2 = x

Simplifying, we get:

x^2 - x = 0

This equation can be factored as:

x(x - 1) = 0

Therefore, the two potential roots are x = 0 and x = 1.

Since the question states that the roots are unequal, we can conclude that there is one root equal to 1 and the other root equal to 0.

Now, let's substitute these roots into the equation x^2 + px + q = 0:

(1)^2 + p(1) + q = 0

This simplifies to:

1 + p + q = 0

Likewise for x = 0:

(0)^2 + p(0) + q = 0

This simplifies to:

q = 0

But the problem states that q cannot be equal to 0, which means this solution is not valid.

Therefore, we have only one solution: x = 1.

Substituting this back into the equation:

(1)^2 + p(1) + q = 0

This simplifies to:

1 + p + q = 0

Since q ≠ 0, we can rearrange the equation to find q in terms of p:

q = -(p + 1)

Now, we can calculate the product pq:

pq = p(-p - 1) = -p^2 - p

Therefore, the product pq is -p^2 - p.