Description
Build monic quadratic equations from bounded integer roots and return their computed solutions.
A quadratic equation ax² + bx + c = 0 can be constructed from its roots. Expanding (x − r1)(x − r2) gives a monic equation, meaning a = 1, with b determined by the root sum and c by their product.1
This generator samples integer roots first and then constructs the coefficients. Each item in result.exercises has coefficients and solution, including case, discriminant, and roots. It produces real integer-root questions, including repeated roots, rather than arbitrary coefficient triples.
When to use Random Quadratic Equation Exercise Generator
Use it for factoring or quadratic-solution worksheets with an included answer key and controlled root magnitude.
How to use Random Quadratic Equation Exercise Generator and understand its results
- Enter integer exerciseCount from 1 through 64 and integer rootMagnitude from 1 through 1,000.
- Run and read coefficients.a, coefficients.b, and coefficients.c as ax² + bx + c = 0.
- Keep solution separate for checking. Read roots and case; a double_root result has one root entry even though its multiplicity is two.
r1,r2 = −M + floor(randomDraw × (2M + 1)); a = 1; b = −(r1 + r2); c = r1 × r2 Two independent draws choose roots in inclusive [−M, M].
The quadratic-equation calculator computes the solution from those coefficients. The discriminant is (r1 − r2)², so the construction yields either two real roots or a double root, never a nonreal pair. Roots are returned in ascending order when distinct.
{
"input": {
"exerciseCount": 3,
"rootMagnitude": 10
},
"randomDraw": 0.25,
"output": {
"result": {
"exercises": [
{
"coefficients": {
"a": 1,
"b": 10,
"c": 25
},
"solution": {
"case": "double_root",
"discriminant": 0,
"imaginaryPart": 0,
"realPart": 0,
"roots": [
-5
]
}
},
{
"coefficients": {
"a": 1,
"b": 10,
"c": 25
},
"solution": {
"case": "double_root",
"discriminant": 0,
"imaginaryPart": 0,
"realPart": 0,
"roots": [
-5
]
}
},
{
"coefficients": {
"a": 1,
"b": 10,
"c": 25
},
"solution": {
"case": "double_root",
"discriminant": 0,
"imaginaryPart": 0,
"realPart": 0,
"roots": [
-5
]
}
}
]
}
}
} Zero and repeated roots are allowed. rootMagnitude bounds the sampled roots: |b| can reach 2M and |c| can reach M². Exchanging two sampled roots produces the same equation, so equations are not uniformly distributed over coefficient triples.
Limitations and assumptions
The default source is Math.random; no seed input or cryptographic entropy guarantee is provided. Repeated runs may select the same result, and the distribution depends on the random source.
Only monic integer-root equations are generated. There are no complex-root, nonmonic, symbolic, automatically hidden-answer, or difficulty-scored exercises. The realPart and imaginaryPart placeholders are not substitutes for the returned real roots.
Alternative or Complementary methods
Solve a chosen equation with the deterministic calculator. Polynomial-evaluation questions support a separate substitution exercise rather than solving for roots.
References
-
Algebra and Trigonometry 2e: Quadratic Functions — OpenStax, Rice University
Similar or alternative tools
- Quadratic Equation
Solve explicit quadratic coefficients.
- Random Polynomial Evaluation Exercise Generator
Generate bounded polynomial substitution questions.