Any polynomial `p(x) = x^n+a_1x^(n-1)+cdots+a_(n-1)x+a_n` of degree `n` can be factored like this
where `x_1,x_2,ldots,x_r` are roots of equation `p(x)=0` and numbers `m_1,m_2,ldots,m_r` are multiplicities of each of the roots.
Hence in order to factor your expression you need to find roots of equation
Since this is quadratic equation its roots are
`x_(1,2)=(-b pm sqrt(b^2-4ac))/(2a)`
In your case `a=1` so your roots are
`x_(1,2)=(-b pm sqrt(b^2-4c))/2`
Also notice that if `b^2-4c=0` we will have only one root but its multiplicity will be 2. In that case your solution would be
In general case your solution would be
`x^2+bx+c=(x-(-b - sqrt(b^2-4c))/2)(x-(-b + sqrt(b^2-4c))/2)`
You colud also use Viete's formulas to find solutions to equation (1) or you could simply guess if you have nice numbers, but the way showed above works always and it's not that hard once you use real numbers instead of general ones.
`ax^2+bx+c= a(x^2+b/ax +c/a)`
Now we want write `x^2 +b/a x +c/a` as a square adding d i.e:
`(x+y)^2=x^2+b/a x +c/a+d`
`x^2+2xy +y^2= x^2+b/ax+c/a +d`
so: `2xy=b/a x` `rArr` `y=b/2a` and `c/a+d=b^2/(4a^2)` `d=b^2/(4a^2)-c/a=`
we have got: `a(x^2+b/a x+ c/a)=a[(x+b/2a)^2-(b^2-4ac)/(4a^2)]`
From `(A^2-B^2)=(A+B)(A-B) ` :
`a(x^2+b/a x+c/a)=a(x+b/(2a) +1/(2a) sqrt(b^2-4ac))(x+b/(2a) -1/(2a) sqrt(b^2-4ac))=`
`=1/(4a) (2ax+b +sqrt(b^2-4ac))(2ax+b-sqrt(b^2-4ac))`
THIS FACTORIZIGIN IS UNIQUE.