# Quadratic Equation Formula and the Discriminant

## Related Calculator: Quadratic Equation Calculator

**Quadratic Equation Formula** can be derived from the steps for completing the square (actually, this formula is a general case).

Let's see how to do it.

- Start from the equation `ax^2+bx+c=0`.
- Divide both sides by `a`: `x^2+b/ax+c/a=0`.
- Move constant term to the right: `x^2+b/ax=-c/a`.
- Add `(b/2a)^2=b^2/(4a^2)` to both sides of the equation: `x^2+b/ax+b^2/(4a^2)=-c/a+b^2/(4a^2)`.
- Rewrite left hand side: `(x+b/(2a))^2=-c/a+b^2/(4a^2)`.
- Simplify right hand side: `-c/a+b^2/(4a^2)=(-c*color(red)(4a))/(a*color(red)(4a))+b^2/(4a^2)=(-4ac)/(4a^2)+b^2/(4a^2)=(b^2-4ac)/(4a^2)`.
- Write the final equation: `(x+b/(2a))^2=(b^2-4ac)/(4a^2)`.
- Solve the equation: `x+b/(2a)=sqrt((b^2-4ac)/(4a^2))` or `x+b/(2a)=-sqrt((b^2-4ac)/(4a^2))`.
- Above equations have roots `x_1=(-b+sqrt(b^2-4ac))/(2a)` and `x_2=(-b-sqrt(b^2-4ac))/(2a)`.
- We can write it even more compactly: `x_(1,2)=(-b+-sqrt(b^2-4ac))/(2a)`.

Expression `b^2-4ac` is called the discriminant of the quadratic equation.

Since it is under square root, then, depending on its value, quadratic equation will have 0, 1 or 2 roots.

Indeed, if `b^2-4ac>0`, then `sqrt(b^2-4ac)` exists and we will get two solutions.

If `b^2-4ac=0`, then `+-sqrt(b^2-4ac)=+-sqrt(0)=0` and we will get one solution.

If `b^2-4ac<0`, then there are no real roots, because square root of negative number doesn't exist.

**Quadratic Equation Formula**: `color(brown)(ax^2+bx+c=0)` has following roots: `color(magenta)(x_(1,2)=(-b+-sqrt(b^2-4ac))/(2a))`.

`color(green)(D=b^2-4ac)` is called the **Discriminant** of the quadratic equation.

- If `b^2-4ac>0`, equation has 2 real roots.
- If `b^2-4ac=0`, equation has 1 real root.
- If `b^2-4ac<0`, equation has no real roots.

Let's go through all three cases.

**Example 1**. Solve the equation using quadratic equation formula: `5x^2-9x-2=0`.

Here `a=5`, `b=-9`, `c=-2`.

Calculate discriminant: `D=(-9)^2-4*5*(-2)=81-(-40)=121`.

Since discriminant is positive, then we expect 2 real roots.

`x_1=(-(-9)+sqrt(121))/(2*5)=(9+11)/10=20/10=2`.

`x_2=(-(-9)-sqrt(121))/(2*5)=(9-11)/10=-2/10=-1/5`.

**Answer**: roots are `2` and `-1/5`.

However, we will not always get rational roots. Roots can also be irrational.

**Example 2**. Solve the following equation: `y^2-6y+2=0`.

Here `a=1`, `b=6`, `c=2`.

Calculate discriminant: `D=6^2-4*1*2=36-8=28`.

Since discriminant is positive, then we expect 2 real roots.

`x_1=(-6+sqrt(28))/(2*1)=(-6+sqrt(4*7))/2=(-6+sqrt(4)*sqrt(7))/2=(-6+2sqrt(7))/2=-6/2+(2sqrt(7))/2=-3+sqrt(7)`.

`x_2=(-6-sqrt(28))/(2*1)=(-6-sqrt(4*7))/2=(-6-sqrt(4)*sqrt(7))/2=(-6-2sqrt(7))/2=-3-sqrt(7)`.

**Answer**: roots are `-3+sqrt(7)` and `-3-sqrt(7)`.

Next case is when there is only one root.

**Example 3**. Solve `9x^2=-6x-1`.

First of all, write equation in standard form: `9x^2+6x+1=0`.

Here `a=9`, `b=6`, `c=1`.

Calculate discriminant: `D=6^2-4*9*1=0`.

Since discriminant is 0, then we expect 1 real root.

`x=(-6+sqrt(0))/(2*9)=-6/18=-1/3`.

**Answer**: root is `-1/3`.

Finally, consider a case, when there are no real roots.

**Example 4**. Solve the equation, using quadratic equation formula: `9c^2+6c=-2`.

First of all, write equation in standard form: `9c^2+6c+2=0`.

Here `a=9`, `b=6`, `c=2`.

Calculate discriminant: `D=6^2-4*9*2=-36`.

Since discriminant is negative, then there are no roots.

**Answer**: no real roots.

Quadratic equation can be used to solve incomplete quadratic equations (although, there are faster methods).

**Example 5**. Solve incomplete quadratic equation `-3x^2+5=0`.

Here `a=-3`, `b=0`, `c=5`.

Calculate discriminant: `D=0^2-4*(-3)*5=60`.

`x_1=(-0+sqrt(60))/(2*(-3))=-sqrt(60)/6=-sqrt(60)/sqrt(36)=-sqrt(60/36)=-sqrt(5/3)`.

`x_2=(-0-sqrt(60))/(2*(-3))=sqrt(5/3)`.

**Answer**: roots are `-sqrt(5/3)` and `sqrt(5/3)`.

Now, it is time to exercise.

**Exercise 1**. Solve the following incomplete equation, using qudratic formula: `2x^2-5/3x=0`.

**Answer**: `0` and `5/6`.

**Exercise 2**. Solve equation `24x^2=-7x+5`.

**Answer**: `-5/8` and `1/3`.

**Exercise 3**. Find roots of the equation `2c^2-3c=-21`.

**Answer**: no real roots.

**Exercise 4**. Solve `1/4x^2-5x+25=0`.

**Answer**: `10`.

**Exercise 5**. Solve the following euqation, using qudratic formula: `1/3y^2+5y-7=0`.

**Answer**: `(-15-sqrt(309))/2` and `(-15+sqrt(309))/2`.