randVar() randRange(1, 12)
randRange(1, 12) * FACTOR randRange(1, 12) * FACTOR
getGCD(COEFFICIENT1, COEFFICIENT2) randRange(1, 5) randRange(1, 5) [X, X, X, X, X].slice(0, DEGREE1) [X, X, X, X, X].slice(0, DEGREE2) DEGREE1 > DEGREE2 ? [DEGREE1 - DEGREE2, 0] : [0, DEGREE2 - DEGREE1] new Term(COEFFICIENT1, X, DEGREE1) new Term(COEFFICIENT2, X, DEGREE2) getExpression(1, 1, SOL_DEGREES[0], SOL_DEGREES[1], X) getExpression(COEFFICIENT1 / GCD, COEFFICIENT2 / GCD, SOL_DEGREES[0], SOL_DEGREES[1], X) getSolution(COEFFICIENT1 / GCD, COEFFICIENT2 / GCD, SOL_DEGREES[0], SOL_DEGREES[1], X)

Simplify the following expression:

`\dfrac{NUMERATOR}{DENOMINATOR}`

You can assume `X \neq 0`.

SOLUTION

`\dfrac{NUMERATOR}{DENOMINATOR} = \dfrac{COEFFICIENT1}{COEFFICIENT2} \cdot \dfrac{X^DEGREE1}{X^DEGREE2}`

To simplify `\frac{COEFFICIENT1}{COEFFICIENT2}`, find the greatest common factor (GCF) of `COEFFICIENT1` and `COEFFICIENT2`.

`COEFFICIENT1 = getPrimeFactorization(COEFFICIENT1).join(" \\cdot ")`
`COEFFICIENT2 = getPrimeFactorization(COEFFICIENT2).join(" \\cdot ")`

`\mbox{GCD}(COEFFICIENT1, COEFFICIENT2) = getPrimeFactorization(GCD).join(" \\cdot ") = GCD`

`\dfrac{COEFFICIENT1}{COEFFICIENT2} \cdot \dfrac{X^DEGREE1}{X^DEGREE2} = \dfrac{GCD \cdot COEFFICIENT1 / GCD}{GCD \cdot COEFFICIENT2 / GCD} \cdot \dfrac{X^DEGREE1}{X^DEGREE2}`

`\phantom{ \dfrac{COEFFICIENT1}{COEFFICIENT2} \cdot \dfrac{DEGREE1}{DEGREE2}} = fractionReduce(COEFFICIENT1 / GCD, COEFFICIENT2 / GCD) \cdot \dfrac{X^DEGREE1}{X^DEGREE2}`

`\dfrac{X^DEGREE1}{X^DEGREE2} = \dfrac{VARIABLE1.join(" \\cdot ")}{VARIABLE2.join(" \\cdot ")} = POWERFRACTION`

`fractionReduce(COEFFICIENT1 / GCD, COEFFICIENT2 / GCD) \cdot POWERFRACTION = SOLUTIONFRACTION`