ForHosting KIT · Math

Cubic equation solver

x³ − 6x² + 11x − 6 = 0 has the roots 3, 2 and 1: enter the four coefficients and get all three roots, real or complex, with the depressed form and discriminant behind them. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
A
1
B
-6
C
11
D
-6
You get
Equation
1*x^3 + -6*x^2 + 11*x + -6 = 0
Discriminant
-0.037037037
Root type
three_real
Real root count
3

A cubic equation is any polynomial equation of degree three written as a times x cubed plus b times x squared plus c times x plus d equals zero when the leading coefficient a is not zero. Cardano's classical closed form still gives every root over the complex numbers after a short sequence of algebraic steps: divide by a to make the polynomial monic, shift the variable to remove the quadratic term, solve the resulting depressed cubic t cubed plus p t plus q equals zero, then shift the three solutions back. The sign of the depressed discriminant completely classifies the picture: three distinct real roots, a multiple real root pattern, or one real root paired with a complex conjugate pair.

How Cardano's method solves a general cubic

Begin with the general real cubic a x cubed plus b x squared plus c x plus d equals zero and insist that a is nonzero so the equation truly has degree three. Divide through by a to obtain the monic form x cubed plus A x squared plus B x plus C equals zero.

The substitution x equals t minus A over three removes the squared term and produces the depressed cubic t cubed plus p t plus q equals zero, where p and q are elementary polynomials in A, B, and C. The discriminant of that depressed cubic is Delta equals the square of q over two plus the cube of p over three. When Delta is positive, classical Cardano expressions built from two cube roots and the non-real cube roots of unity yield one real root and a complex conjugate pair.

When Delta is zero, all roots are real and at least two coincide, recovering double-root textbook cases such as a perfect cube or a squared linear factor times another linear factor. When Delta is negative—the famous casus irreducibilis—three distinct real roots appear, and the stable evaluation path uses the trigonometric identity with two times the square root of negative p over three times cosines of a third-angle arccos argument shifted by multiples of two pi over three.

After the three t values are known, every root is shifted back by subtracting A over three, restoring solutions of the original monic and therefore of the original scaled polynomial. Coefficients must be finite; NaN and Infinity are rejected. The special case a approximately zero is rejected with invalid input because Cardano would divide by zero and the problem would no longer be cubic.

Where cubic equation solvers show up in real work

Secondary-school and college algebra courses constantly assign Cardano drills, discriminant classification tables, and factor-or-formula comparisons; a single trusted oracle that returns all three roots with real and imaginary parts speeds grading and demo setup. Programming contest problems and interview warm-ups often hide a cubic under volume constraints, cubic cost models, or depressed forms after a substitution, and engineers need exact classification of three-real versus complex outcomes rather than a silent NaN from an unchecked radical.

Control theory and mechanical design solve cubic characteristic equations for stability margins and need every complex eigenvalue of a three-by-three companion matrix without leaving the closed-form path. Graphics, animation, and game engines sample cubic Bezier timing curves and solve for parameter roots of cubic polynomials along collision or silhouette queries. If you later need the quadratic formula alone, quartic Ferrari solutions, systems of two polynomial equations, or symbolic factoring over the integers, treat those as separate search intents and landings rather than overloading this cubic Cardano solver page.

Homework and exam answer keys

Generate all three roots, depressed p/q, and discriminant class for textbook ax³+bx²+cx+d sets so teachers and auto-graders share one ground truth.

Characteristic equations and stability

Solve cubic characteristic polynomials from 3×3 linear models and classify real versus complex spectra without iterative root finders.

Cubic cost, volume, and Bezier parameters

Find real intersection parameters of cubic curves and break-even roots of cubic cost models with honest complex fallbacks when needed.

Does it return complex roots?

Yes. When the depressed discriminant is positive you get one real root and a complex conjugate pair. When it is negative you get three real roots. Each root is an object with re and im.

What is the depressed cubic?

The response includes p, q, and the shift so you can verify intermediate algebra steps.

What does it cost?

The browser tool is free and runs locally.

How does it know how many real roots there are?

From the sign of the discriminant of the depressed cubic. Positive means one real root and a complex conjugate pair, zero means repeated real roots, and negative means three distinct real roots.

What happens if the first coefficient is zero?

The equation is no longer a cubic, so it is refused instead of being treated as one. Use a quadratic solver for that case, since Cardano's method has to divide by the cubic coefficient.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/cubic-equation

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/cubic-equation \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":1,"b":-6,"c":11,"d":-6}'
{
  "a": 1,
  "b": -6,
  "c": 11,
  "d": -6
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.cubic_equation",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

When a is zero the request is rejected with a clear validation error instead of silently treating a quadratic as a cubic.

How Cardano's method solves a general cubic

The entire pipeline is deterministic floating-point arithmetic: no random seeds, no wall-clock timestamps, no network calls, and no model drift, so identical coefficients always produce identical JSON.

What you send and what you get back

Send four finite numbers under the fields a, b, c, and d representing the coefficients of a x cubed plus b x squared plus c x plus d equals zero. All four fields are required. For purely real solutions every imag part is zero; for mixed spectra the complex pair is conjugate. Classic textbook checks include a equals one, b equals negative six, c equals eleven, d equals negative six with roots three, two, and one; the depressed triple-root case x cubed equals zero; and cubics with one real and two complex roots such as x cubed plus x plus one equals zero. Missing fields, non-numeric strings, NaN, and Infinity fail with invalid_input and are not charged. When a is zero or extremely close to zero the request fails with a message that Cardano's method requires a nonzero cubic term, so clients can switch to a quadratic solver rather than guessing. On success the response echoes cleaned coefficients, a printable equation string, monic coefficients A, B, and C, the depressed triple p, q, and shift, the depressed discriminant as a number, root_type as one of three_real, one_real_two_complex, or multiple_real, a boolean real_roots flag, real_root_count, and an array roots of three objects each with re and im. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where cubic equation solvers show up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

What method does this cubic equation solver use?

Cardano's method: monic normalization, depression x = t − b/(3a), solution of t³ + p t + q = 0 by discriminant case (Cardano cube roots or the trigonometric form), then back-substitution.

What happens if a is zero?

The request fails with invalid_input. Cardano's method requires a non-zero cubic coefficient; a quadratic ax² + bx + c = 0 is a different problem and a different landing.

Read the full KIT documentation →