判別式:在求出根之前先數清楚
回頭看求根公式。關鍵全發生在根號底下,即表達式 b^2 - 4ac 中。這個量就是[[discriminant|判別式]],記作 D。由於負數沒有實數平方根,單憑 D 的*符號*就決定了方程式有幾個實根——根本不必完整求解。
- 若 D > 0:兩個不同的實根——拋物線兩次穿過 x 軸。
- 若 D = 0:一個重複實根,即二重根——拋物線與 x 軸相切。
- 若 D < 0:沒有實根——拋物線與 x 軸不相交(根是複數)。
Discriminant D = b^2 - 4ac. x^2 - 5x + 6 = 0: D = 25 - 24 = 1 > 0 → 2 real roots x^2 - 6x + 9 = 0: D = 36 - 36 = 0 → 1 double root (x = 3) x^2 + x + 1 = 0: D = 1 - 4 = -3 < 0 → no real roots A perfect-square D (like 1, 4, 9, ...) is a bonus signal: the roots are rational, so the quadratic factors nicely.
根的和與積:韋達定理
有一個漂亮的捷徑,可以在完全不求解的情況下把兩個根與係數聯繫起來。如果 r 和 s 是 a x^2 + b x + c = 0 的根,那麼它們的[[sum-and-product-of-roots|和與積]]滿足[[vietas-formulas|韋達定理]]:r + s = -b/a,且 r·s = c/a。你立刻就能看出原因——展開 a(x - r)(x - s) 並與 a x^2 + b x + c 逐項對照,正好逼出這兩個關係。
Vieta's formulas for a x^2 + b x + c = 0 with roots r, s:
r + s = -b/a r·s = c/a
Check on 2x^2 + 3x - 5 = 0 (roots were 1 and -5/2):
r + s = 1 + (-5/2) = -3/2 = -b/a = -3/2 ✓
r·s = 1·(-5/2) = -5/2 = c/a = -5/2 ✓
Use it backward — build a quadratic with roots 3 and -4:
sum = -1, product = -12
x^2 - (sum)x + (product) = x^2 + x - 12 = 0