Factoring Trinomials

Factor a Second-degree Polynomial: x2 + Bx + C

{{{ %hideall #auto def int_who_prod(n): d_of_n = divisors(n) length = len(d_of_n) if n > 0: if is_even(length): return [(d_of_n[i//2],d_of_n[length-1-i//2]) if is_even(i) else (-d_of_n[i//2],-d_of_n[length-i//2-1]) for i in range(length)] else: return [(d_of_n[i//2],d_of_n[length-1-i//2]) if is_even(i) else (-d_of_n[i//2],-d_of_n[length-i//2-1]) for i in range(length + 1)] if n < 0: if is_even(length): return [(d_of_n[i//2],-d_of_n[length-1-i//2]) if is_even(i) else (-d_of_n[i//2],d_of_n[length-i//2-1]) for i in range(length)] else: return [(d_of_n[i//2],-d_of_n[length-1-i//2]) if is_even(i) else (-d_of_n[i//2],d_of_n[length-i//2-1]) for i in range(length + 1)] def sum_list(ilist): return [sum(ilist[i]) for i in range(len(ilist))] def visual_factor_BCform(B,C): g. = PolynomialRing(ZZ) f = x^2 + B*x + C if f.is_irreducible(): print "This quadratic is un-factorable." return if B == 0: print "B must be non-zero" return if type(B) != Integer or type(C) != Integer: print "B and C must be integers." pwholist = int_who_prod(C) sl = sum_list(pwholist) length = len(sl) string = "" string += """ """ string += "

Factor completely: " inputq = "x2" if B > 0: if B != 1: inputq += " + %dx" % B else: inputq += " + x" else: if B != -1: inputq += " - %dx" % (B*-1) else: inputq += " - x" if C > 0: inputq += " + %d" % C else: inputq += " - %d" % (C*-1) string += inputq +"

" string += "

Solution

" string += "

First, determine all integer pairs whose product is %d and then compute each sum.

" % C string += "
" % C for i in range(length): if sl[i] != B: string += "" % (pwholist[i][0],pwholist[i][1]) else: string += "" % (pwholist[i][0],pwholist[i][1]) a = pwholist[i][0] b = pwholist[i][1] string += "" for i in range(length): if sl[i] != B: string += "" % sl[i] else: string += "" % sl[i] string += "
Integer pairs whose product is %d%d,%d%d,%d
Sum%d%d
" string += "

Since %d is the coefficient of the middle term, " % B string += inputq + " = " if a > 0: p1 = "(x + %d)" % a else: p1 = "(x - %d)" % (a*-1) if b > 0: p2 = "(x + %d)" % b else: p2 = "(x - %d)" % (b*-1) if p1 != p2: string += p1 + p2 + "

" else: string += p1 + "2

" string += "" print string return /// CPU time: 0.00 s, Wall time: 0.00 s }}} {{{ visual_factor_BCform(-7,12) ///

Factor completely: x2 - 7x + 12

Solution

First, determine all integer pairs whose product is 12 and then compute each sum.

Integer pairs whose product is 121,12-1,-122,6-2,-63,4-3,-4
Sum13-138-87-7

Since -7 is the coefficient of the middle term, x2 - 7x + 12 = (x - 3)(x - 4)

}}} {{{ visual_factor_BCform(-8,6) /// This quadratic is un-factorable. }}} {{{ visual_factor_BCform(1,-12) ///

Factor completely: x2 + x - 12

Solution

First, determine all integer pairs whose product is -12 and then compute each sum.

Integer pairs whose product is -121,-12-1,122,-6-2,63,-4-3,4
Sum-1111-44-11

Since 1 is the coefficient of the middle term, x2 + x - 12 = (x - 3)(x + 4)

}}} {{{ visual_factor_BCform(2,1) ///

Factor completely: x2 + 2x + 1

Solution

First, determine all integer pairs whose product is 1 and then compute each sum.

Integer pairs whose product is 11,1-1,-1
Sum2-2

Since 2 is the coefficient of the middle term, x2 + 2x + 1 = (x + 1)2

}}} {{{ visual_factor_BCform(3,-40) ///

Factor completely: x2 + 3x - 40

Solution

First, determine all integer pairs whose product is -40 and then compute each sum.

Integer pairs whose product is -401,-40-1,402,-20-2,204,-10-4,105,-8-5,8
Sum-3939-1818-66-33

Since 3 is the coefficient of the middle term, x2 + 3x - 40 = (x - 5)(x + 8)

}}} {{{ visual_factor_BCform(34,-287) ///

Factor completely: x2 + 34x - 287

Solution

First, determine all integer pairs whose product is -287 and then compute each sum.

Integer pairs whose product is -2871,-287-1,2877,-41-7,41
Sum-286286-3434

Since 34 is the coefficient of the middle term, x2 + 34x - 287 = (x - 7)(x + 41)

}}} {{{ visual_factor_BCform(-4,4) ///

Factor completely: x2 - 4x + 4

Solution

First, determine all integer pairs whose product is 4 and then compute each sum.

Integer pairs whose product is 41,4-1,-42,2-2,-2
Sum5-54-4

Since -4 is the coefficient of the middle term, x2 - 4x + 4 = (x - 2)2

}}} {{{ visual_factor_BCform(4,4) ///

Factor completely: x2 + 4x + 4

Solution

First, determine all integer pairs whose product is 4 and then compute each sum.

Integer pairs whose product is 41,4-1,-42,2-2,-2
Sum5-54-4

Since 4 is the coefficient of the middle term, x2 + 4x + 4 = (x + 2)2

}}} {{{ visual_factor_BCform(-2,1) ///

Factor completely: x2 - 2x + 1

Solution

First, determine all integer pairs whose product is 1 and then compute each sum.

Integer pairs whose product is 11,1-1,-1
Sum2-2

Since -2 is the coefficient of the middle term, x2 - 2x + 1 = (x - 1)2

}}} {{{ visual_factor_BCform(-10,25) ///

Factor completely: x2 - 10x + 25

Solution

First, determine all integer pairs whose product is 25 and then compute each sum.

Integer pairs whose product is 251,25-1,-255,5-5,-5
Sum26-2610-10

Since -10 is the coefficient of the middle term, x2 - 10x + 25 = (x - 5)2

}}} {{{ }}} {{{ visual_factor_BCform(10,25) ///

Factor completely: x2 + 10x + 25

Solution

First, determine all integer pairs whose product is 25 and then compute each sum.

Integer pairs whose product is 251,25-1,-255,5-5,-5
Sum26-2610-10

Since 10 is the coefficient of the middle term, x2 + 10x + 25 = (x + 5)2

}}} {{{ visual_factor_BCform(2,1) ///

Factor completely: x2 + 2x + 1

Solution

First, determine all integer pairs whose product is 1 and then compute each sum.

Integer pairs whose product is 11,1-1,-1
Sum2-2

Since 2 is the coefficient of the middle term, x2 + 2x + 1 = (x + 1)2

}}} {{{ visual_factor_BCform(5,6) ///

Factor completely: x2 + 5x + 6

Solution

First, determine all integer pairs whose product is 6 and then compute each sum.

Integer pairs whose product is 61,6-1,-62,3-2,-3
Sum7-75-5

Since 5 is the coefficient of the middle term, x2 + 5x + 6 = (x + 2)(x + 3)

}}} {{{ visual_factor_BCform(6,8) ///

Factor completely: x2 + 6x + 8

Solution

First, determine all integer pairs whose product is 8 and then compute each sum.

Integer pairs whose product is 81,8-1,-82,4-2,-4
Sum9-96-6

Since 6 is the coefficient of the middle term, x2 + 6x + 8 = (x + 2)(x + 4)

}}} {{{ visual_factor_BCform(10,16) ///

Factor completely: x2 + 10x + 16

Solution

First, determine all integer pairs whose product is 16 and then compute each sum.

Integer pairs whose product is 161,16-1,-162,8-2,-84,4-4,-4
Sum17-1710-108-8

Since 10 is the coefficient of the middle term, x2 + 10x + 16 = (x + 2)(x + 8)

}}} {{{ visual_factor_BCform(7,6) ///

Factor completely: x2 + 7x + 6

Solution

First, determine all integer pairs whose product is 6 and then compute each sum.

Integer pairs whose product is 61,6-1,-62,3-2,-3
Sum7-75-5

Since 7 is the coefficient of the middle term, x2 + 7x + 6 = (x + 1)(x + 6)

}}} {{{ visual_factor_BCform(9,8) ///

Factor completely: x2 + 9x + 8

Solution

First, determine all integer pairs whose product is 8 and then compute each sum.

Integer pairs whose product is 81,8-1,-82,4-2,-4
Sum9-96-6

Since 9 is the coefficient of the middle term, x2 + 9x + 8 = (x + 1)(x + 8)

}}} {{{ visual_factor_BCform(7,10) ///

Factor completely: x2 + 7x + 10

Solution

First, determine all integer pairs whose product is 10 and then compute each sum.

Integer pairs whose product is 101,10-1,-102,5-2,-5
Sum11-117-7

Since 7 is the coefficient of the middle term, x2 + 7x + 10 = (x + 2)(x + 5)

}}} {{{ visual_factor_BCform(11,10) ///

Factor completely: x2 + 11x + 10

Solution

First, determine all integer pairs whose product is 10 and then compute each sum.

Integer pairs whose product is 101,10-1,-102,5-2,-5
Sum11-117-7

Since 11 is the coefficient of the middle term, x2 + 11x + 10 = (x + 1)(x + 10)

}}} {{{ visual_factor_BCform(-10,16) ///

Factor completely: x2 - 10x + 16

Solution

First, determine all integer pairs whose product is 16 and then compute each sum.

Integer pairs whose product is 161,16-1,-162,8-2,-84,4-4,-4
Sum17-1710-108-8

Since -10 is the coefficient of the middle term, x2 - 10x + 16 = (x - 2)(x - 8)

}}} {{{ visual_factor_BCform(2,8) /// This quadratic is un-factorable. }}} {{{ visual_factor_BCform(-17,16) ///

Factor completely: x2 - 17x + 16

Solution

First, determine all integer pairs whose product is 16 and then compute each sum.

Integer pairs whose product is 161,16-1,-162,8-2,-84,4-4,-4
Sum17-1710-108-8

Since -17 is the coefficient of the middle term, x2 - 17x + 16 = (x - 1)(x - 16)

}}} {{{ visual_factor_BCform(-7,-8) ///

Factor completely: x2 - 7x - 8

Solution

First, determine all integer pairs whose product is -8 and then compute each sum.

Integer pairs whose product is -81,-8-1,82,-4-2,4
Sum-77-22

Since -7 is the coefficient of the middle term, x2 - 7x - 8 = (x + 1)(x - 8)

}}} {{{ visual_factor_BCform(-2,-8) ///

Factor completely: x2 - 2x - 8

Solution

First, determine all integer pairs whose product is -8 and then compute each sum.

Integer pairs whose product is -81,-8-1,82,-4-2,4
Sum-77-22

Since -2 is the coefficient of the middle term, x2 - 2x - 8 = (x + 2)(x - 4)

}}} {{{ visual_factor_BCform(7,-8) ///

Factor completely: x2 + 7x - 8

Solution

First, determine all integer pairs whose product is -8 and then compute each sum.

Integer pairs whose product is -81,-8-1,82,-4-2,4
Sum-77-22

Since 7 is the coefficient of the middle term, x2 + 7x - 8 = (x - 1)(x + 8)

}}} {{{ visual_factor_BCform(2,-8) ///

Factor completely: x2 + 2x - 8

Solution

First, determine all integer pairs whose product is -8 and then compute each sum.

Integer pairs whose product is -81,-8-1,82,-4-2,4
Sum-77-22

Since 2 is the coefficient of the middle term, x2 + 2x - 8 = (x - 2)(x + 4)

}}} {{{ visual_factor_BCform(-16,-80) ///

Factor completely: x2 - 16x - 80

Solution

First, determine all integer pairs whose product is -80 and then compute each sum.

Integer pairs whose product is -801,-80-1,802,-40-2,404,-20-4,205,-16-5,168,-10-8,10
Sum-7979-3838-1616-1111-22

Since -16 is the coefficient of the middle term, x2 - 16x - 80 = (x + 4)(x - 20)

}}} {{{ visual_factor_BCform(4,-32) ///

Factor completely: x2 + 4x - 32

Solution

First, determine all integer pairs whose product is -32 and then compute each sum.

Integer pairs whose product is -321,-32-1,322,-16-2,164,-8-4,8
Sum-3131-1414-44

Since 4 is the coefficient of the middle term, x2 + 4x - 32 = (x - 4)(x + 8)

}}} {{{ visual_factor_BCform(9,18) ///

Factor completely: x2 + 9x + 18

Solution

First, determine all integer pairs whose product is 18 and then compute each sum.

Integer pairs whose product is 181,18-1,-182,9-2,-93,6-3,-6
Sum19-1911-119-9

Since 9 is the coefficient of the middle term, x2 + 9x + 18 = (x + 3)(x + 6)

}}} {{{ visual_factor_BCform(17,60) ///

Factor completely: x2 + 17x + 60

Solution

First, determine all integer pairs whose product is 60 and then compute each sum.

Integer pairs whose product is 601,60-1,-602,30-2,-303,20-3,-204,15-4,-155,12-5,-126,10-6,-10
Sum61-6132-3223-2319-1917-1716-16

Since 17 is the coefficient of the middle term, x2 + 17x + 60 = (x + 5)(x + 12)

}}} {{{ visual_factor_BCform(20,36) ///

Factor completely: x2 + 20x + 36

Solution

First, determine all integer pairs whose product is 36 and then compute each sum.

Integer pairs whose product is 361,36-1,-362,18-2,-183,12-3,-124,9-4,-96,6-6,-6
Sum37-3720-2015-1513-1312-12

Since 20 is the coefficient of the middle term, x2 + 20x + 36 = (x + 2)(x + 18)

}}} {{{ visual_factor_BCform(10,-3*13) ///

Factor completely: x2 + 10x - 39

Solution

First, determine all integer pairs whose product is -39 and then compute each sum.

Integer pairs whose product is -391,-39-1,393,-13-3,13
Sum-3838-1010

Since 10 is the coefficient of the middle term, x2 + 10x - 39 = (x - 3)(x + 13)

}}} {{{ }}}