randVar() randVar() randRangeWeighted(1, 5, 1, 0.25) randRangeNonZero(-10, 10) new RationalExpression([[COEFFICIENT, X], CONSTANT]) (function() { if (rand(2)) { var expr2 = new Term(randRangeWeighted(1, 8, 1, 0.25), X); var term2 = new Term(randRange(1, 10)); } else { var expr2 = new Term(randRangeExclude(-10, 10, [-1, 0, 1])); var term2 = rand(2) ? new Term(randRange(1, 10)) : new Term(randRangeWeighted(1, 8, 1, 0.25), X); } expr2.string = expr2.toString(); expr2.parenthesise = false; if (rand(2)) { var expr3 = new Term(randRangeWeighted(1, 8, 1, 0.25), X); var term1 = new Term(randRange(1, 10)); } else { var expr3 = new Term(randRangeExclude(-10, 10, [-1, 0, 1])); var term1 = rand(2) ? new Term(randRange(1, 10)) : new Term(randRangeWeighted(1, 8, 1, 0.25), X); } expr3.string = expr3.toString(); expr3.parenthesise = false; var expr1 = COMMON_TERM.multiply(term1); var expr4 = COMMON_TERM.multiply(term2); if (rand(2)) { expr1.string = expr1.toString(); expr1.parenthesise = true; } else { expr1.string = expr1.toStringFactored(); expr1.parenthesise = (term1.toString() === '1'); } if (rand(2)) { expr4.string = expr4.toString(); expr4.parenthesise = true; } else { expr4.string = expr4.toStringFactored(); expr4.parenthesise = (term2.toString() === '1'); } if (rand(2)) { return [ { numerator: expr1, denominator: expr2 }, { numerator: expr3, denominator: expr4 }, { numerator: [expr3, term1], denominator: [expr2, term2] } ]; } else { return [ { numerator: expr2, denominator: expr1 }, { numerator: expr4, denominator: expr3 }, { numerator: [expr2, term2], denominator: [expr3, term1] } ]; } })() FRACTION1.numerator.multiply(FRACTION2.numerator) FRACTION1.denominator.multiply(FRACTION2.denominator) FRACTION3.numerator[0].multiply(FRACTION3.numerator[1]) FRACTION3.denominator[0].multiply(FRACTION3.denominator[1]) DENOMTERM.coefficient > 0 ? NUMERTERM.getGCD(DENOMTERM) : NUMERTERM.getGCD(DENOMTERM).multiply(-1) NUMERTERM.divide(FACTOR) DENOMTERM.divide(FACTOR)

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

`\dfrac{FRACTION1.numerator.string}{FRACTION1.denominator.string} \times \dfrac{FRACTION2.numerator.string}{FRACTION2.denominator.string}`

`\dfrac{FRACTION1.numerator.string}{FRACTION1.denominator.string} \div \dfrac{FRACTION2.denominator.string}{FRACTION2.numerator.string}`

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

`\qquad \dfrac{FRACTION1.numerator.string}{FRACTION1.denominator.string} \times \dfrac{FRACTION2.numerator.string}{FRACTION2.denominator.string}`

(NUMERSOL.toString())/(DENOMSOL.toString())
(NUMERSOL.toString())/(DENOMSOL.toStringFactored())
(NUMERSOL.toStringFactored())/(DENOMSOL.toString())
(NUMERSOL.toStringFactored())/(DENOMSOL.toStringFactored())
NUMERSOL.toString()
NUMERSOL.toStringFactored()
`X \neq \space` -CONSTANT/COEFFICIENT

When multiplying fractions, we multiply the numerators and the denominators.

`\qquad \dfrac{ (FRACTION1.numerator.string) FRACTION1.numerator.string \times (FRACTION2.numerator.string) FRACTION2.numerator.string } { (FRACTION1.denominator.string) FRACTION1.denominator.string \times (FRACTION2.denominator.string) FRACTION2.denominator.string }`

`\qquad \dfrac {FRACTION3.numerator[0] \times FRACTION3.numerator[1](COMMON_TERM)} {FRACTION3.denominator[0] \times FRACTION3.denominator[1](COMMON_TERM)}`

`\qquad \dfrac{NUMERTERM(COMMON_TERM)}{DENOMTERM(COMMON_TERM)}`

We can cancel the `COMMON_TERM` so long as `COMMON_TERM \neq 0`.

Therefore `X \neq fraction(-CONSTANT, COEFFICIENT, true, true)`.

`\qquad \dfrac{NUMERTERM \cancel{(COMMON_TERM})}{DENOMTERM \cancel{(COMMON_TERM)}} = writeExpressionFraction(NUMERTERM, DENOMTERM) = writeExpressionFraction(NUMERSOL, DENOMSOL) NUMERSOL`