randFromArray([1, -1]) NEG1 === -1 ? "-" : "" randRange(1, 9) randRange(2, 9) randFromArray([1, -1]) NEG2 === -1 ? "-" : "" randRange(1, 9) randRange(2, 9) getGCD( N1, N2 ) N1 / GCD1 N2 / GCD1 getGCD( D1, D2 ) D1 / GCD2 D2 / GCD2
Reduce to lowest terms:

NEG1S \dfrac{N1}{D1} \div NEG2S \dfrac{N2}{D2} = {?}

(NEG1 * N1 * NEG2 * D2) / (D1 * N2)

Dividing by a fraction is the same as multiplying by the reciprocal.

The reciprocal of NEG2S \dfrac{N2}{D2} is NEG2S \dfrac{D2}{N2}. We just flipped the numerator and denominator.

Since multiplying by the reciprocal is the same as dividing, lets use the reciprocal to change the problem into a multiplication problem:

\begin{eqnarray} NEG1S \frac{N1}{D1} \color{GREEN}{\div NEG2S \frac{N2}{D2}} & \qquad = \qquad & NEG1S \frac{N1}{D1} \color{BLUE}{\times NEG2S \frac{D2}{N2}} \end{eqnarray}

Because we're now multiplying fractions instead of dividing them, all we have to do is multiply the numerators and the denominators:

\begin{eqnarray} \hphantom{NEG1S \frac{N1}{D1} \div \color{GREEN}{NEG2S \frac{N2}{D2}}} & \qquad = \qquad & \dfrac{NEG1S N1 \times \color{BLUE}{NEG2S D2}}{D1 \times \color{BLUE}{N2}} \end{eqnarray}

We could just multiply everything to get \frac{NEG1 * NEG2 * N1 * D2}{N2 * D1} and then try to reduce that to get the final answer, but it's easier if we can find and reduce some common factors before we multiply.

In this case, we can divide the NEG2 * D2 in the numerator and the D1 in the denominator by GCD2:

\begin{eqnarray} \hphantom{NEG1S \frac{N1}{D1} \div \color{GREEN}{NEG2S \frac{N2}{D2}}} & \qquad = \qquad & \dfrac{NEG1S N1 \times \color{PINK}{\cancel{\color{BLUE}{NEG2S D2}}^{NEG2SSIMP_D2}}}{\color{PINK}{\cancel{\color{black}{D1}}^{SIMP_D1}} \times \color{BLUE}{N2}} \\ \\ & \qquad = \qquad & \dfrac{NEG1S N1 \times \color{PINK}{NEG2SSIMP_D2}}{\color{PINK}{SIMP_D1} \times \color{BLUE}{N2}} \end{eqnarray}

After reducing the common factors, it's easier to multiply and get the simplified answer:

\begin{eqnarray} \hphantom{\color{gray}{NEG1S \frac{N1}{D1} \div NEG2S \frac{N2}{D2}}} & \qquad = \qquad & fractionReduce(NEG1 * N1 * NEG2 * D2, D1 * N2) \end{eqnarray}

Just multiply to get the final answer. Double-check that it's simplified:

\begin{eqnarray} \hphantom{\color{gray}{NEG1S \frac{N1}{D1} \div NEG2S \frac{N2}{D2}}} & \qquad = \qquad & fractionReduce(NEG1 * N1 * NEG2 * D2, D1 * N2) \end{eqnarray}