Quadratic Equation

Quadratic Equation Solver :   `ax^2+bx+c=0`
Coefficients may be real or complex numbers.


How to use this calculator ?

This calculator is a quadratic equation solver (ax2+bx+c=0).
It calculates the exact solutions when they exist and also gives a numerical approximation of them.

"Include complex solutions" field

Choose,
  • No: if you search only real solutions.
  • Yes: if you want to extend the search to complex numbers.

Coefficients input

Here are some hints to help you enter the coefficients of the equation.
  1. Accepted inputs are,
    • integers, example: 5, -7
    • fractions, example: 1/3 or -2/9
    • decimal values, example: 3.9 or -9.65
    • constants, example: pi or e
    • common functions, for example: sin(pi/5)
    • square root operator, example : input sqrt(3) or 3^0.5 for `sqrt(3)`
    • complex numbers, example : 1+i ou -i
  2. To enter a product of two factors, use the * operator. For example: enter 2*pi and not 2pi.

How to solve a quadratic equation?

We suppose the equation coefficients are real numbers and we search real solutions.
We also assume that, in all of the following, `a != 0`.

  • Step 1: Calculate the equation discriminant `\Delta = b^2-4*a*c`
  • Step 2: Calculate the solutions

    • If `\Delta < 0`: there is no solution.

    • If `\Delta = 0`: there is only one solution

      `x_1 = -b/(2*a)`

    • If `\Delta > 0`: there are 2 solutions

      `x_1 = (-b-sqrt(\Delta))/(2*a)`

      `x_2 = (-b+sqrt(\Delta))/(2*a)`

Tips and Tricks

It is useful to know some tips and tricks to quickly solve a second degree equation.
  • If b is an even integer, calculations can be simplified by calculating a reduced discriminant.

  • `\Delta' = b'^2-a*c` with `b' = b/2`

    If this discriminant is positive, then the solutions are,

    `x_1 = (-b'-sqrt(\Delta'))/a`

    `x_2 = (-b+sqrt(\Delta'))/a`

  • If a and c have opposite signs (e.g. a=3 and c=-5) then the equation has two real solutions because in this case, a*c < 0 and then -4*a*c > 0 which implies `\Delta = b^2-4*a*c > 0`

  • It may be useful to quickly calculate s = a+b+c the coefficients sum because, if s=0, then x=1 is a solution of the equation.

    Indeed, by replacing x with 1, we get

    `a*1^2+b*1+c=a+b+c=0`.

    The second solution can be found by factoring the equation ( x-1 is obviously a factor) or by using the following property.

  • It may be useful to know the formulas of the sum and the product of the solutions of a quadratic equation.

    We denote x1 and x2 the roots of the equation. S and P are the sum and product of these solutions, that is,

    `S = x_1+x_2`

    `P = x_1*x_2`

    Then we have,

    `S = -b/a`

    `P = c/a`

    Application: to calculate two numbers given their sum S and their product P then simply solve the following quadratic equation,

    `x^2 - S*x +P=0`

    If they exist, the two searched numbers are the roots of this equation.

Case of Non-real solutions

If `\Delta < 0`, we saw that the equation has no real solution. It has in fact two complex solutions which are:

`x_1 = (-b-i*sqrt(-\Delta))/(2*a)`

`x_2 = (-b+i*sqrt(-\Delta))/(2*a)`

See also

Cubic Equation Solver
Equation and Inequation Calculators
Mathematics Calculators