Question 1172141
<pre>

Here is a different way, borrowing from linear programming the idea of
using a non-negative slack variable to change an inequality into an equation.

Since {{{x^2 + px + q = 0}}} has only real solutions, 

{{{p^2-4q>=0}}}
{{{p^2>=4q}}}
{{{q<=p^2/4}}}

Introduce a non-negative slack variable s {{{s>=0}}} so that

{{{q+s=p^2/4}}}
{{{q=p^2/4-s}}}

Substitute for q in 

{{{x^2 + px + q + (x + a)(2x + p) = 0}}} 

{{{x^2 + px + p^2/4 - s + (x + a)(2x + p) = 0}}}

Which simplifies to this

{{{3x^2 + (2a+2p)x + ap + p^2/4 - s = 0}}}

Which has the discriminant

{{{(2a+2p)^2-12(ap+p^2/4-s)}}}

Which simplifies to

{{{4a^2 - 4ap + p^2 + 12s}}}

and it must be non-negative, so

{{{4a^2 - 4ap + p^2 + 12s>=0}}}

We solve this for a

{{{a >= (p + 2sqrt(-3s) )/2 }}} 

OR

{{{a <= (p - 2sqrt(-3s) )/2 }}} 

But since a is real, this tells us that our
slack variable s, is not only non-negative but
it is also non-positive {{{s<=0}}} as well.
This means s=0.

Therefore, {{{q=p^2/4-s}}} becomes {{{q=p^2/4}}}

{{{x^2 + px + p^2/4 - s + (x + a)(2x + p) = 0}}}

becomes

{{{x^2 + px + p^2/4 + (x + a)(2x + p) = 0}}}

which has solutions:

{{{x = (-4a - p)/6}}} and {{{x=-p/2}}}

which are real.

Edwin</pre>