We'll start from the quadratic equation.

ax^2 + bx + c = 0

We'll factorize by a:

a(x^2 + bx/a + c/a) = 0

We'll group the first 2 terms and we'll complete the square:

a(x^2 + 2*x*b/2a + b^2/4a)- b^2/4a + c/a = 0

The first 3 terms represent the perfect square (x +b/2a)^2:

a(x +b/2a)^2 = b^2/4a - c/a

a(x +b/2a)^2 = (b^2 - 4c)/4a

We'll divide by a:

(x +b/2a)^2 = (b^2 - 4c)/4a^2

We'll apply square root both sides:

x + b/2a = +/-sqrt(b^2 - 4c)/2a

We'll subtract b/2a:

x = [-b +/- sqrt(b^2 - 4c)]/2a

Note: the square root exists if the expression under the square root is positive or zero.

the expression under the square root is delta, the discriminant of equation.

If delta > 0=> the equation has 2 distinct roots.

If delta = 0 => the eq. has 2 equal roots.

If delta < 0 => the eq. has no ral roots.