randFromArray(['multiply', 'divide']) randFromArray([[0, 0], [1, 0], [1, 0], [1, 1]]) randVar() randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) new RationalExpression([[1, X], A]) new RationalExpression([[1, X], B]) new RationalExpression([[1, X], C]) new RationalExpression([[1, X], D]) (function() { var f1 = new Term(randRangeWeightedExclude(-5, 5, 1, 0.4, [0])); var f2 = new Term(randRangeWeightedExclude(-5, 5, 1, 0.4, [0])); var f3 = new Term(randRangeWeightedExclude(-5, 5, 1, 0.4, [0])); var f4 = new Term(randRangeWeightedExclude(-5, 5, 1, 0.4, [0])); if (rand(2)) { var x = new Term(1, X); if (rand(2)) { f1 = x.multiply(f1); } else { f2 = x.multiply(f2); } if (rand(2)) { f3 = x.multiply(f3); } else { f4 = x.multiply(f4); } } return [f1, f2, f3, f4]; })() FACTORS[0].multiply(FACTORS[1]) FACTORS[2].multiply(FACTORS[3]) FACTOR2.isNegative() ? FACTOR1.getGCD(FACTOR2).multiply(-1) : FACTOR1.getGCD(FACTOR2) TERM_C.multiply(FACTOR1.divide(COMMON_FACTOR)) TERM_D.multiply(FACTOR2.divide(COMMON_FACTOR))
[TERM_A.multiply(TERM_B).multiply(FACTORS[0]), TERM_C.multiply(FACTORS[1])] [TERM_A.multiply(TERM_D).multiply(FACTORS[2]), TERM_B.multiply(FACTORS[3])] getProduct(FACTORS[0], [TERM_A, TERM_B]) getProduct(FACTORS[2], [TERM_A, TERM_D]) [FACTOR1, [TERM_A, TERM_B, TERM_C]] [FACTOR2, [TERM_A, TERM_D, TERM_B]] [[0, 1], [0, 2]]
[TERM_A.multiply(TERM_C).multiply(FACTORS[0]), TERM_B.multiply(FACTORS[1])] [TERM_A.multiply(TERM_B).multiply(FACTORS[2]), TERM_D.multiply(FACTORS[3])] getProduct(FACTORS[0], [TERM_A, TERM_C]) getProduct(FACTORS[2], [TERM_A, TERM_B]) [FACTOR1, [TERM_A, TERM_C, TERM_B]] [FACTOR2, [TERM_A, TERM_B, TERM_D]] [[0, 2], [0, 1]]
[TERM_B.multiply(TERM_C).multiply(FACTORS[0]), TERM_A.multiply(FACTORS[1])] [TERM_A.multiply(TERM_D).multiply(FACTORS[2]), TERM_B.multiply(FACTORS[3])] getProduct(FACTORS[0], [TERM_B, TERM_C]) getProduct(FACTORS[2], [TERM_A, TERM_D]) [FACTOR1, [TERM_B, TERM_C, TERM_A]] [FACTOR2, [TERM_A, TERM_D, TERM_B]] [[2, 0], [0, 2]]
(NUMERSOL.toString())/(DENOMSOL.toString())
(NUMERSOL.toStringFactored())/(DENOMSOL.toString())
(NUMERSOL.toString())/(DENOMSOL.toStringFactored())
(NUMERSOL.toStringFactored())/(DENOMSOL.toStringFactored())
-B -A
`X \neq \space`
`X \neq \space`

Simplify the following expression and state the conditions under which the simplification is valid. You can assume that `X \neq 0`.

`\qquad \dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[1]]} \times \dfrac{NUMERATORS[1 - ORDER[0]]}{DENOMINATORS[1 - ORDER[1]]} \dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[1]]} \div \dfrac{DENOMINATORS[1- ORDER[1]]}{NUMERATORS[1 - ORDER[0]]}`

Dividing by an expression is the same as multiplying by its inverse.

`\qquad \dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[1]]} \times \dfrac{NUMERATORS[1 - ORDER[0]]}{DENOMINATORS[1 - ORDER[1]]}`

First factor out any common factors.

`\qquad \dfrac{NUMERATORS[ORDER[0]].toStringFactored()}{DENOMINATORS[ORDER[1]].toStringFactored()} \times \dfrac{NUMERATORS[1 - ORDER[0]].toStringFactored()}{DENOMINATORS[1 - ORDER[1]].toStringFactored()}`

Then factor the quadratic expressions.

`\qquad \dfrac {NUMERATORS[1].toStringFactored()NUMER_QUADRATIC} {DENOMINATORS[1].toStringFactored()DENOM_QUADRATIC} \times \dfrac {NUMER_QUADRATICNUMERATORS[1].toStringFactored()} {DENOM_QUADRATICDENOMINATORS[1].toStringFactored()}`

Then multiply the two numerators and multiply the two denominators.

`\qquad \dfrac {NUMERATORS[1].toStringFactored(true) \times NUMER_QUADRATIC NUMER_QUADRATIC \times NUMERATORS[1].toStringFactored(true)} {DENOMINATORS[1].toStringFactored(true) \times DENOM_QUADRATIC DENOM_QUADRATIC \times DENOMINATORS[1].toStringFactored(true)}`

`\qquad = \dfrac {getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1])} {getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1])}`

Notice that `(TERM_A)` and `(TERM_B)` appear in both the numerator and denominator so we can cancel them.

`\qquad = \dfrac {getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1], CANCEL_ORDER[0].slice(0, 1))} {getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1], CANCEL_ORDER[1].slice(0, 1))}`

We are dividing by `TERM_A`, so `TERM_A \neq 0`.
Therefore, `X \neq -A`.

`\qquad \dfrac {getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1], CANCEL_ORDER[0])} {getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1], CANCEL_ORDER[1])}`

We are dividing by `TERM_B`, so `TERM_B \neq 0`.
Therefore, `X \neq -B`.

`\qquad \dfrac {NUMERSOL.multiply(COMMON_FACTOR).toStringFactored()} {DENOMSOL.multiply(COMMON_FACTOR).toStringFactored()}`

`\dfrac{NUMERSOL.toStringFactored()}{DENOMSOL.toStringFactored()}; X \neq -A; X \neq -B`