You have a general quadratic of the form: ax^2 + bx + c = 0, where a,b,c are constants (although is consistent for functions). Divide by a (assuming a/=0, this would not be a quadratic in that case):x^2 + (b/a)x + c/a = 0Complete the square on the first 2 terms:(x+(b/2a))^2 - (b/2a)^2Add the 3rd term back on:(x+(b/2a))^2 - (b/2a)^2 + c/a = 0Rearrange to have the x term on its own:(x+(b/2a))^2 = (b/2a)^2 - c/aTake the square root:x+(b/2a) = +/-sqrt{(b/2a)^2 - c/a}Subtract b/2a:x = -b/2a +/- sqrt{(b/2a)^2 - c/a}Putting the right hand side over a common denominator:x = [-b +/- sqrt{b^2-4ac}]/2a