Roots and Discriminant of a Quadratic Equation
Roots and Discriminant of a Quadratic Equation
Roots of ax² + bx + c = 0 with the discriminant, a status code and a warning for nearly repeated roots.
- 204 bytes
- COMP mode
Worked examples
Example 1
A rectangular display board has length (x + 2) cm and width (x − 1) cm. Its area is 18 cm². Find the value of x.
Answer
Standard solution (without a calculator)
- Length conditions and area equation: the length and width must be positive, so x + 2 > 0 and x − 1 > 0, which together give x > 1. Length × width = area gives (x + 2)(x − 1) = 18.
- Quadratic form: expanding gives x² + x − 2 = 18, so x² + x − 20 = 0. The coefficient of x² is 1, that of x is 1 and the constant term is −20.
- Factorise: x² + x − 20 = (x + 5)(x − 4), so x = −5 or x = 4. The discriminant gives a separate check: Δ = 1² − 4(1)(−20) = 81, and the formula gives (−1 ± 9)/2 = −5 or 4.
- Select by the context and check: x = −5 does not satisfy x > 1 and is rejected; for x = 4 the length is 6 cm, the width 3 cm and the area 6 × 3 = 18 cm². So x = 4, option B. Of the program’s two algebraic roots only the larger fits the length conditions.
Example 2
The line y = kx + 2 touches the parabola y = x² + 3x + 6, where k is a real constant. Show the necessary steps to find:
(a) all possible values of k;
(b) for each value of k, the coordinates of the point of contact.
Answer
Standard solution (without a calculator)
- Equal-roots condition for the x equation: at a common point x² + 3x + 6 = kx + 2, that is x² + (3 − k)x + 4 = 0. The line touches the parabola exactly when this equation has equal roots, so Δx = (3 − k)² − 16 = 0, which expands to the new equation in k: k² − 6k − 7 = 0.
- Solve the parameter equation: k² − 6k − 7 = (k + 1)(k − 7), so k = −1 or k = 7. Both values make Δx = 0.
- Point of contact for each k: for k = −1 the equation becomes x² + 4x + 4 = (x + 2)² = 0, so x = −2 and y = −(−2) + 2 = 4: the point (−2, 4). For k = 7 it becomes x² − 4x + 4 = (x − 2)² = 0, so x = 2 and y = 7(2) + 2 = 16: the point (2, 16). Both points also lie on y = x² + 3x + 6.
- Keep the two discriminants apart: the program is given the derived equation k² − 6k − 7 = 0, with coefficients 1, −6, −7. Its discriminant is Δk = (−6)² − 4(1)(−7) = 64, and the formula gives k = (6 ± 8)/2 = −1 or 7. So the displayed D = 64 belongs to the k equation; it is not the Δx = 0 of the x equation. The points of contact still have to be found by substitution.
Example 3
Original graph-and-discriminant question. The graph of f(t) = 3t² − 6t + 7 is a parabola with t as the horizontal axis. Answer the questions from the function; (b) is an extension exercise on complex numbers, marked separately.
(a) When t is real, find the number of intersections of the graph with the t-axis and give a reason.
(b) Extension exercise: allowing t to be complex, find all complex zeros of f(t) = 0 in exact form, stating i² = −1.
Answer
Standard solution (without a calculator)
- (a) Use the discriminant: the graph meets the t-axis where f(t) = 0. The discriminant is Δ = (−6)² − 4(3)(7) = 36 − 84 = −48 < 0, so there are no real zeros and 0 intersections.
- Check the position by completing the square: f(t) = 3(t² − 2t) + 7 = 3(t − 1)² + 4. For all real t, (t − 1)² ≥ 0, so f(t) ≥ 4 > 0; the vertex is (1, 4) and the whole parabola lies above the t-axis. This is a second check that needs no graph on the calculator.
- (b) Extension exercise, exact form: with i² = −1, √(−48) = 4√3 i. By the formula t = [6 ± 4√3 i]/6 = 1 ± (2√3/3)i. These are a pair of conjugate complex roots; they add no intersections with the real t-axis.
- Real and imaginary parts independently: the real part is −b/(2a) = 6/6 = 1 and the positive imaginary size is √48/6 = 2√3/3 = 2/√3 ≈ 1.1547005383792515. Rounded to ten digits the last screen should read 1.154700538. The written answer must keep 1 ± (2√3/3)i; the bare numbers X and Y must not be mistaken for two real roots.
When to use it
DSE questions on quadratic equations, the discriminant, equal roots and intersections with the x-axis often need the roots, or the sign of Δ, for a set of numerical coefficients. 027 takes a, b and c of ax² + bx + c = 0 in turn. For a ≠ 0 it shows D, M, X and Y, where D is the program’s value of b² − 4ac, M is a status code, and X and Y must be read together with M. For a = 0 it handles the linear and identity cases. It only does the numerical step: setting up the equation, rejecting roots and writing the answer stay on paper. Part (b) of example 3, the complex roots, is an extension exercise and is labelled as such.
What it is for
- Real roots of a quadratic with numerical coefficients, and the sign of its discriminant
- Parameter equations such as k² − 6k − 7 = 0, once the equation in k has been derived by hand
- The number of intersections with the x-axis; complex roots as an extension
What you enter
- A, B, C: a, b, c of ax² + bx + c = 0, in this order, with signs; 0 for a missing term
- Move every term to one side first: x² + x = 20 gives 1, 1, −20; a negative number is keyed with (−)
- Enter all three on every run; a blank EXE keeps the old value and does not mean 0
What it shows
- For a ≠ 0: D, M, X, Y in order; EXE after each of the first three, the fourth ends the run
- M = 2: two distinct real roots, X smaller and Y larger. M = 0: no real roots, the complex roots are X ± Yi with Y > 0
- M = 1: double root 0 (b = c = 0). M = −2: near-repeated warning, not a number of roots. For a = 0 the output is shorter
Check before use
- Real numerical coefficients only. Move every term to one side and order them x², x, constant: x² + x = 20 gives 1, 1, −20. A coefficient containing k must first be turned into a number by hand; the program does no symbolic algebra. Use coefficients that are 0 or have absolute value between 10⁻³⁰ and 10³⁰; this is a recommendation, not a guarantee for any value, nearly repeated root or number of displayed digits.
- Enter a, b and c again on every run, with 0 for a missing term; a blank EXE keeps the current value and does not mean 0. In some branches B and C are used as working storage, so afterwards they need not hold the original coefficients. Key a negative coefficient with (−), e.g. −20 is (−) 2 0; the subtraction key is only for subtracting in an expression.
- Use COMP and P1 (there are no trigonometric functions, so the angle unit does not matter). The program sets Norm 1 itself and takes 204 of the 680 bytes shared by P1 to P4. The key-in steps clear P1 first; if P1 holds a program you want to keep, copy it down first or use an empty area and change the area number.
- For a ≠ 0 there are four results, D, M, X, Y. M = 2: two distinct real roots, X the smaller and Y the larger. M = 0: no real roots; the complex conjugate roots are written X ± Yi with Y > 0.
- For a ≠ 0 and b = c = 0, M = 1 and X = Y = 0: the double root of ax² = 0. Any other non-zero repeated root is deliberately shown with M = −2, so M = 1 cannot be used to find all repeated roots.
- When |D| ≤ 10⁻⁸b² and b, c are not both 0, M = −2. This is a numerical warning for a nearly repeated root; it is not a number of roots and not “no solution”. Check by exact factorisation, completing the square or the discriminant, and do not judge the nature of the roots from the sign of the displayed D alone.
- With M = −2, X and Y are for reference only: if the program’s D > 0 they are two sorted candidate values; if D < 0, a candidate real part X and positive imaginary size Y; if D = 0, the centre −b/(2a) shown twice. Repeated values do not prove a repeated root.
- a = 0 with b ≠ 0 gives only two results: M = 1, then X = −c/b. a = b = 0 with c ≠ 0 shows only M = 0 (no solution); a = b = c = 0 shows only M = −1 (infinitely many solutions). These branches do not show D and must not be read like the four-result quadratic case.
- The warning is a numerical criterion, not a strict error bound. Even with M = 2 or 0, D is not guaranteed to have a fixed number of correct digits; when b² and 4ac are close, D can lose more digits than the roots. If a question needs the exact discriminant, exact surd roots or a proof, check by algebra from the original equation.
- The program solves only the equation you enter. Modelling, substitution and changing back, domains, angle intervals of trigonometric equations and practical limits such as length or time are for you to handle; the two roots of a substitution are not necessarily two solutions of the original question.
- Press EXE after each of the first three quadratic results; the fourth is the finished result and needs no EXE (another EXE reruns the program). The upper line of the last screen may show Lbl 9; it is not a name for the value on the lower line. Press AC to leave.
Checking access…