fraction( N1, D1 ) - fraction( N2, D2 ) = {?}
N1 / D1 - N2 / D2
Simplify each fraction.
fraction( SIMP_N1, SIMP_D1 ) - fraction( SIMP_N2, SIMP_D2 )
Find a common denominator by finding the least common multiple of SIMP_D1
and SIMP_D2
.
\lcm(SIMP_D1, SIMP_D2) = LCM
Change each fraction to an equivalent fraction with a denominator of LCM
.
fraction( SIMP_N1, SIMP_D1 ) - fraction( SIMP_N2, SIMP_D2 )
=fraction( SIMP_N1, SIMP_D1 ) \cdot fraction( LCM / SIMP_D1, LCM / SIMP_D1 ) - fraction( SIMP_N2, SIMP_D2 ) \cdot fraction( LCM / SIMP_D2, LCM / SIMP_D2 )
=fraction( SIMP_N1 * LCM / SIMP_D1, LCM ) - fraction( SIMP_N2 * LCM / SIMP_D2, LCM )
=fraction( SIMP_N1 * LCM / SIMP_D1 - SIMP_N2 * LCM / SIMP_D2, LCM )
Simplify.
=fractionReduce( SIMP_N1 * LCM / SIMP_D1 - SIMP_N2 * LCM / SIMP_D2, LCM )