Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find this explanation overly complicated. For the general case a*x^2+bx+c, the easiest way is to try to reduce it to the form A^2-B^2 which has the easy factorisation (A+B)(A-B). So:

ax^2+bx+c = a[x^2+(b/a)x+(c/a)] = a[x^2+(b/a)x+(b/2a)^2-(b/2a)^2+c/a] (only adding and removing the same thing) =a[(x+(b/2a))^2 - ((b^2/4a)-c/a)] (using (A+B)^2=A^2+B^2+2AB)

Call D the term (b^2/4a)-c/a, if D is positive we can take its square root, factor and have our two solutions.

I like more analytical solutions.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: