# expanding and factoring in algebra

Expanding very simple process, just open round brackets and multiply each with each for example

$(x-6)(x+3) = x^2 + 3x - 6x -18 = x^2 -3x -18$

Factoring is confused me a little for example I have $x^2 -3x -18$ I try to brute force all combinations in my mind and get the result like this $(x-6)(x+3)$ Cold you please recommend some algorithm, how to find factoring in the easy way.

Thanks.

• – Lorenzo Sep 13 '16 at 10:29
• $(x - a)(x - b) = x^2 -(a+b)x + ab$, so in your case $a+b=3$ and $ab= -18$. – user305860 Sep 13 '16 at 10:32

You can do this:

$$x^2-3x-18=\left(x-\frac 32 x\right)^2-\frac 94-18$$ $$=\left(x-\frac 32 \right)^2-\frac {81}4$$ $$=\left(x-\frac 32 -\sqrt{\frac{81}4}\right)\left(x-\frac 32 x+\sqrt{\frac{81}4}\right)$$ $$=\left(x-\frac 32 -\frac{9}2\right)\left(x-\frac 32 +\frac{9}2\right)$$ $$=(x-6)(x+3).$$

Here's an algorithm to factor any quadratic (so $a\neq 0$):

\begin{align}ax^2+bx+c&=a\left(x^2+\frac{b}{a}x+\frac{c}{a}\right)\\&=a\left(\left(x+\frac{b}{2a}\right)^2-\frac{b^2}{4a^2}+\frac{c}{a}\right)\\&=a\left(\left(x+\frac{b}{2a}\right)^2-\frac{\Delta}{4a^2}\right) &(\Delta=b^2-4ac)\\&=a\left(\left(x+\frac{b}{2a}\right)^2-\left(\frac{\sqrt{\Delta}}{2a}\right)^2\right)\\&=a\left(x+\frac{b-\sqrt{\Delta}}{2a}\right)\left(x+\frac{b+\sqrt{\Delta}}{2a}\right)\end{align}

Note that we used $\sqrt{\Delta}$. If you know complex numbers, that shouldn't be a problem. If not, note that when $\Delta<0$, the equation $ax^2+bx+c=0$ has no solutions in $\mathbb{R}$ because it's equivalent to $$\left(x+\frac{b}{2a}\right)^2-\frac{\Delta}{4a^2}=0$$ which has clearly no solutions in $\mathbb{R}$ as $\left(x+\frac{b}{2a}\right)^2\ge 0$ and $-\frac{\Delta}{4a^2}>0$. Thus, if $\Delta<0$, you can't factor over $\mathbb{R}$.

Here is another alternative

\begin{align} x^2-3x-18 &= \frac{1}{4}\bigg(4x^2-4\cdot 3x-4\cdot 18\bigg )\\ &= \frac{1}{4}\bigg((2x)^2-2\cdot 3(2x)-72\bigg )\\ \end{align}

Now suppose we define $t=2x$ \begin{align} \frac{1}{4}\bigg(t^2-2\cdot 3t-72\bigg )&= \frac{1}{4}\bigg(t^2-2\cdot 3t+9-9-72\bigg )\\ &= \frac{1}{4}\bigg((t-3)^2-81\bigg )\\ &= \frac{1}{4}\bigg((t-3)^2-9^2\bigg )\\ &= \frac{1}{4}\bigg((t-3)-9\bigg )\bigg((t-3)+9\bigg )\\ &= \frac{1}{4}\bigg(t-12\bigg )\bigg(t+6\bigg )\\ &= \frac{1}{4}\bigg(2x-12\bigg )\bigg(2x+6\bigg )\\ &= \bigg(x-6\bigg )\bigg(x+3\bigg )\\ \end{align} This method is probably overkill, but it shines when used to derive the quadratic formula.