How can i find wheather the roots of the square equation (X^2 + p*X + q = 0) are positive or negative. (without solving the equation).
Printable View
How can i find wheather the roots of the square equation (X^2 + p*X + q = 0) are positive or negative. (without solving the equation).
the equation solves always like:
x = -p/2 +- Sqrt((p/2)^2-q)
so just check the expression in the root. If it is negative, you'll have to deal with imaginary numbers or in other words, there are no real solutions to your equation.
If the roots are complex, it is not clear what you mean by positive or negative.
For real roots, it helps to know that q is the product of the roots, and -p is their sum.
If q is negative, one root is positive and one is negative.
If q is positive, both roots have the same sign, which is the opposite of the sign of p.
ok, let's try it again.
you never can say whether a squareroot is positive or negative. it is always both. think about
(-2)^2=2^2
sqareroot just undos the operation of ^2, but because the result of ^2 is always positive then information about the sign is lost. thus you usually have in quadratic equations the following two solutions:
x1 = -p/2 + Sqrt((p/2)^2-q)
x2 = -p/2 - Sqrt((p/2)^2-q)
let's use s= (p/2)^2-q, means the expression in the squareroot
in case of s=0 you will have one solution (x1=x2)
in case of s<0 there are only imaginary results (=no real solutions)
in case of s>0 you will always have two solutions which you have to check for sign
you can also write the quadratic equation as follows:
x^2+px+q=0=(x-x1)*(x-x2)
from this you get
q=x1*x2
-p=x1+x2
deducting further:
if q has a positive sign, both solutions x1 and x2 must have the same sign, else there will be one positive and one negative solution.
in case q is positive (x1 and x2 have the same sign) you can check the sign of them by taking a look at p: if p is positive, both have negative sign, else positive.
(which is somewhat the same as guv wrote, just with the mathematical background)
hope i didn't mix up the signs, i am close to braindead!
... and next time we'll show algebraic La Place transformations in visual basic (just kidding! but i could really use that)
OK, thanks for the replies.