Factoring Calculator (Polynomial & Number)

Prime factorization, divisors, GCD/LCM, and quadratic factoring with discriminant and roots.

MATH

Two-in-one factoring tool. Switch between Number mode (prime factorization, divisor list, GCD, LCM of two integers) and Quadratic mode (factor ax²+bx+c into a(x−r₁)(x−r₂) using the discriminant b²−4ac).

Number mode does trial division by primes up to √n, then enumerates every divisor and computes GCD via the Euclidean algorithm with LCM = a·b/gcd. Quadratic mode evaluates the discriminant D = b²−4ac: D > 0 gives two distinct real roots and the factored form a(x−r₁)(x−r₂); D = 0 gives a repeated root and a(x−r)²; D < 0 reports complex conjugate roots and notes the polynomial is irreducible over the reals. Worked example: 60 = 2² × 3 × 5, divisors {1,2,3,4,5,6,10,12,15,20,30,60}, GCD(60,24)=12, LCM=120. Quadratic x²−5x+6 has discriminant 1, roots 2 and 3, factored (x−2)(x−3).

Disclaimer: Handles standard ax²+bx+c with real coefficients and positive-integer factoring. For higher-degree polynomials or symbolic factoring use a CAS such as Wolfram Alpha or SymPy.

Factoring Calculator (Polynomial & Number)

Factor positive integers into primes (with all divisors, GCD, and LCM) or factor a quadratic ax² + bx + c into a(x − r₁)(x − r₂). Shows the discriminant and handles complex-root cases.

Positive integer. Trial division runs up to √n.
Prime Factorization
60 = 2² × 3 × 5
Number of Divisors12
GCD12
LCM120
All Divisors
{ 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60 }

How Factoring Works

Every integer greater than 1 has a unique prime factorization — this is the Fundamental Theorem of Arithmetic. Trial division by primes 2, 3, 5, 7, ... up to √n always terminates because any composite n must have a factor ≤ √n. Once you have the prime decomposition, every divisor of n is a product of subsets of those primes (with multiplicity), so the divisor list and the divisor count follow immediately. The number of divisors of n = p₁^a₁ · p₂^a₂ · ... is (a₁+1)(a₂+1)... — e.g. 60 = 2²·3·5 has (2+1)(1+1)(1+1) = 12 divisors.

The quadratic formula comes from completing the square. Starting from ax² + bx + c = 0, divide by a, move c/a across, and add (b/2a)² to both sides: (x + b/2a)² = (b² − 4ac) / 4a². Taking square roots gives x = (−b ± √(b² − 4ac)) / 2a. The expression under the radical, D = b² − 4ac, is the discriminant. It tells you everything about the roots before you compute them.

When D > 0 the polynomial has two distinct real roots and factors as a(x − r₁)(x − r₂). When D = 0 there is one repeated root and the factored form is a(x − r)². When D < 0 the roots are complex conjugates and the polynomial is irreducible over the reals — it factors only over ℂ. By the Rational Root Theorem, a quadratic with integer coefficients factors over the rationals exactly when D is a perfect square; otherwise the roots are irrational (still real, but the factored form contains surds).

Handles standard ax² + bx + c with real coefficients and positive-integer factoring. For higher-degree polynomials, symbolic factoring, or factoring over finite fields, use a CAS such as Wolfram Alpha or SymPy.

Frequently Asked Questions

What is prime factorization?
Writing an integer as a product of prime numbers. By the Fundamental Theorem of Arithmetic this representation is unique up to order — e.g. 60 = 2 × 2 × 3 × 5 = 2² × 3 × 5.
How do I factor a quadratic?
Compute the discriminant D = b²−4ac, then the roots r = (−b ± √D)/(2a). If D ≥ 0 the factored form is a(x−r₁)(x−r₂); if D = 0 it collapses to a(x−r)².
What is the discriminant?
The expression b²−4ac under the square root in the quadratic formula. Its sign tells you the nature of the roots: positive = two distinct real roots, zero = one repeated root, negative = complex conjugate roots.
What's the difference between GCD and LCM?
GCD (greatest common divisor) is the largest integer dividing both numbers; LCM (least common multiple) is the smallest positive integer they both divide. They satisfy GCD(a,b) × LCM(a,b) = a × b.
Why can't all quadratics be factored over rationals?
A quadratic with integer coefficients factors over the rationals only when its discriminant is a perfect square. Otherwise the roots are irrational (D > 0 but not a perfect square) or complex (D < 0).