Expanding brackets using FOIL which stands for First, Outer, Inner and Last.
Example :
( x+5) ( x+2)
First step multiply x with x = x^2
2nd step Multiply x with 2 =2x
3rd step Multiply 5 with x =5x
4 th step Multiply 5 with 2= 10
Put highest powers first, so this will read x^2 + 2x + 5x +10, so the final answer will be x^2+ 7x +10 .
You net like terms so you can add the 2x and 7x together to get 7x
( x-4) (x+6) using the above method will be x^2+ 2x-24. Notice the 6x and negative 4x has been netted to 2x.
Finally, (x-1) (x-8) using the above method will be x^2-8x-x +8 , so final simplified solution will be x^2-9x+8
You can use different powers of x such as 2x^2, 3x^2 etc , but the highest powers will appear at the beginning of the equation and be first to be expanded.
