# publicKhan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

file 89 lines (81 sloc) 5.245 kb
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89         Factoring polynomials with two variables

randRangeNonZero( -10, 10 )                    randRangeNonZero( -10, 10 )
A * B                CONSTANT === 1 ? "" : CONSTANT === -1 ? "-" : CONSTANT                -A - B                LINEAR === 1 ? "" : LINEAR === -1 ? "-" : LINEAR

Factor the following expression:

x^2 + LINEAR_DISPxy + CONSTANT_DISPy^2

(x-Ay)(x-By)

When we factor a polynomial of this form, we are basically reversing this process of multiplying linear expressions together:

\qquad                        \begin{eqnarray}                        (x + ay)(x + by)&=&xx &+& xby + ayx &+& ayby \\ \\                        &=& x^2 &+& \green{(a+b)}xy &+& \blue{ab}y^2 \\                        &\hphantom{=}& \hphantom{x^2} &\hphantom{+}& \hphantom{\green{LINEAR}xy} &\hphantom{+}& \hphantom{\blue{CONSTANT}y^2}                        \end{eqnarray}

\qquad                        \begin{eqnarray}                        \hphantom{(x + ay)(x + by)}&\hphantom{=}&\hphantom{xx} &\hphantom{+}& \hphantom{xby + ayx} &\hphantom{+}&\hphantom{ayby} \\                        &\hphantom{=}& \hphantom{x^2} &\hphantom{+}&\hphantom{\green{(a+b)}xy}&\hphantom{+}&\hphantom{\blue{ab}y^2} \\                        &=& x^2 &+& \green{LINEAR}xy &+& \blue{CONSTANT}y^2                        \end{eqnarray}

The coefficient on the xy term is LINEAR                        and the coefficient on the y^2 term is CONSTANT, so to reverse the steps above, we need to find two numbers                        that add up to LINEAR and multiply to                        CONSTANT.

You can start by trying to guess which factors of CONSTANT add up to                    LINEAR. In other words, you need to find the values for a and                    b that meet the following conditions:

\qquad \pink{a} + \pink{b} = \green{LINEAR}

\qquad \pink{a} \times \pink{b} = \blue{CONSTANT}

If you're stuck, try listing out every single factor of CONSTANT and its opposite as                    a in these equations, and see if it gives a value for b                    that validates both conditions. For example, since abs(A) is a factor of CONSTANT,                    try substituting abs(A) for a as well as -abs(A).

The two numbers -A and -B satisfy both conditions:

\qquad \pink{-A} + \pink{-B} = \green{LINEAR}

\qquad \pink{-A} \times \pink{-B} = \blue{CONSTANT}

So we can factor the polynomial as (plus("x", -A + "y"))(plus("x", -B + "y")).

Something went wrong with that request. Please try again.