Khan/khan-exercises

Use regex answer type to avoid dependency on math-model

```Summary: I changed this to use regexs to check the answer and made it pretty liberal (i.e. it's always ok to run a -1 through everything)

1 parent 4391df1 commit 1602377c85705c8118844de751ea4ff97c177d54 beneater committed
Showing with 105 additions and 0 deletions.
1. +105 −0 exercises/factoring_linear_binomials.html
105 exercises/factoring_linear_binomials.html
 @@ -0,0 +1,105 @@ + + + + + Factoring linear binomials + + + +
+
+
+
+ randRange(2, 9) + random() < 0.2 + +
+ randRangeExclude(-20, 20, [-1, 0, 1]) + getGCD(A, B) +
+ + IS_IRREDUCIBLE ? plus(A + "x", B) : + GCD + "(" + plus(A / GCD + "x", B / GCD) + ")" + + + toSentenceTex(getFactors(abs(A)).concat(["x"])) + + + toSentenceTex(getFactors(abs(B))) + + GCD + "[-\\u2212]" + GCD + "(?:" + (A < 0 ? "[-\\u2212]" : "") + abs(A / GCD) + (A / GCD === 1 ? "|" : "" ) + (A / GCD === -1 ? "|[-\\u2212]" : "") + ")\\s*x" + "(?:" + (A > 0 ? "[-\\u2212]" : "") + abs(A / GCD) + (A / GCD === -1 ? "|" : "" ) + (A / GCD === 1 ? "|[-\\u2212]" : "") + ")\\s*x" + (B < 0 ? "[-\\u2212]" : "\\+") + "\\s*" + abs(B / GCD) + (B > 0 ? "[-\\u2212]" : "\\+") + "\\s*" + abs(B / GCD) +
+

+ Write the following expression in its most factored form: +

+

+ expr(["+", ["*", A, "x"], B]) +

+
+
+
^\s*TERM2\s*TERM3\s*\$
+
^\s*TERM2N\s*TERM3N\s*\$
+
^\s*\(\s*TERM2\s*TERM3\s*\)\s*\$
+
^\s*\(\s*TERM2N\s*TERM3N\s*\)\s*\$
+
+
+
^\s*TERM1\s*\(\s*TERM2\s*TERM3\s*\)\s*\$
+
^\s*TERM1N\s*\(\s*TERM2N\s*TERM3N\s*\)\s*\$
+
+
+
+ a factored expression, like 5(x+2) +
+
+
+

+ To factor a polynomial, you should first try to find + the greatest common factor of all the terms. +

+

+ The factors of Ax are + Ax_FACTORS and the factors of + B are B_FACTORS. +

+

+ The greatest common factor of Ax + and B is + GCD. +

+ +

+ Since the greatest common factor is 1, + the expression is already in its most factored form. +

+

+ Therefore the answer is the original expression, + SOLUTION. +

+ +

+ We can factor out the GCD and + put it before the parenthesis. +

+

+ If we divide each of the terms in the original + expression by GCD we get + \dfrac{Ax}{GCD} = + plus((A/GCD) + "x") and + \dfrac{B}{GCD} = + B/GCD. +

+

+ So the factored expression is + SOLUTION. +

+
+
+
+
+ +