"abcdefghijklmnpqrstuvwxyz" randRange( 0, LETTERS.length - 3 ) LETTERS[ LETTER + 0 ] LETTERS[ LETTER + 1 ] LETTERS[ LETTER + 2 ]
randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) random() < 0.5 random() < 0.5 G + X + ( X_HAS_Y ? Y : "" ) + ( X_HAS_Z ? Z : "" ) ( X_HAS_Y ? Y : "" ) + ( X_HAS_Z ? Z : "" ) getGCD( getGCD( abs( G ), abs( D-A ) ), getGCD( abs( E-B ), abs( F-C ) ) ) ( G < 0 ? -1 : 1 ) / GCD function( y, z, c, d ) { return X + "= \\dfrac{" + plus( round( DIVISOR*y )+Y, round( DIVISOR*z )+Z, round( DIVISOR*c ) ) + "}{" + plus( round( DIVISOR*d )+X_EXTRAS ) + "}"; }

plus( X_TERM, A+Y, B+Z, C ) = plus( D+Y, E+Z, F )

Solve for X.

ANSWER( D-A, E-B, F-C, G )

• ANSWER( D+A, E-B, F-C, G )
• ANSWER( D-A, E+B, F-C, G )
• ANSWER( D-A, E-B, F+C, G )
• ANSWER( D+A, E+B, F-C, G )
• ANSWER( D+A, E-B, F+C, G )
• ANSWER( D-A, E+B, F+C, G )
• ANSWER( D+A, E+B, F+C, G )

Combine constant terms on the right.

plus( X_TERM, A+Y, B+Z, color_( C, true ) ) = plus( D+Y, E+Z, color_( F, true ) )

plus( X_TERM, A+Y, B+Z ) = plus( D+Y, E+Z, color_( F-C, true ) )

Combine Z terms on the right.

plus( X_TERM, A+Y, color_( B+Z, false ) ) = plus( D+Y, color_( E+Z, false ), F-C )

plus( X_TERM, A+Y ) = plus( D+Y, color_( (E-B)+Z, false ), F-C )

Combine Y terms on the right.

plus( X_TERM, color_( A+Y, true ) ) = plus( color_( D+Y, true ), (E-B)+Z, F-C )

plus( X_TERM ) = plus( color_( (D-A)+Y, true ), (E-B)+Z, F-C )

Isolate X.

plus( color_( G, false ) + X + color_( X_EXTRAS, false ) ) = plus( (D-A)+Y, (E-B)+Z, F-C )

X = \dfrac{ plus( (D-A)+Y, (E-B)+Z, F-C ) }{ plus( color_( G + X_EXTRAS, false ) ) }

All of these terms are divisible by GCD.

Divide by the common factor and swap signs so the denominator isn't negative.

Divide by the common factor.

Swap the signs so the denominator isn't negative.

X = \dfrac{ plus( color_( round( DIVISOR*(D-A) ), true )+Y, color_( round( DIVISOR*(E-B) ), true )+Z, color_( round( DIVISOR*(F-C) ), true ) ) }{ plus( color_( round( DIVISOR*G )+X_EXTRAS, true ) ) }

randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) function( y1, c, y2, z, d, flip ) { if ( typeof flip === "undefined" ? FLIP : flip ) { y1 = -y1; c = -c; y2 = -y2; z = -z; d = -d; } return X + "= \\dfrac{" + plus( y1+Y, c ) + "}{" + plus( y2+Y, z+Z, d ) + "}"; } (function() { var n = 0, ns = [ E, F-D, A, B, C ]; for( var i = 0; i < ns.length; i++ ) { if (ns[ i ] < 0 ) { n++; } } return n >= 3; })()

plus( A+X+Y, B+X+Z, C+X, D ) = plus( E+Y, F )

Solve for X.

ANSWER( E, F-D, A, B, C )

• ANSWER( E, F+D, A, B, C )
• ANSWER( 0, F-D, A, B, C )
• ANSWER( E, 0, A, B, C )
• ANSWER( E, F-D, 0, B, C )
• ANSWER( E, F-D, A, 0, C )
• ANSWER( E, F-D, A, B, 0 )
• ANSWER( E+A, F-D, A, B, C )
• ANSWER( E-A, F-D, A, B, C )
• ANSWER( E, F-D, A+B, B, C )
• ANSWER( E, F-D, A-B, B, C )
• ANSWER( E, F-D, A, A+B, C )
• ANSWER( E, F-D, A, A-B, C )
• ANSWER( E, F-D, A, B, A+C )
• ANSWER( E, F-D, A, B, A-C )

Combine constant terms on the right.

plus( A+X+Y, B+X+Z, C+X, color_( D, true ) ) = plus( E+Y, color_( F, true ) )

plus( A+X+Y, B+X+Z, C+X ) = plus( E+Y, color_( F-D, true ) )

Notice that all the terms on the left-hand side of the equation have X in them.

plus( A+color_( X, false )+Y, B+color_( X, false )+Z, C+color_( X, false ) ) = plus( E+Y, F-D )

Factor out the X.

color_( X, false ) \cdot \left( plus( A+Y, B+Z, C ) \right) = plus( E+Y, F-D )

Isolate the X.

X \cdot \left( color_( plus( A+Y, B+Z, C ), true ) \right) = plus( E+Y, F-D )

X = \dfrac{ plus( E+Y, F-D ) }{ color_( plus( A+Y, B+Z, C ), true ) }

We can simplify this by multiplying the top and bottom by -1.

ANSWER( E, F-D, A, B, C )

randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeExclude( -10, 10, [ 0, -1, 1 ] ) randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) randRangeExclude( -10, 10, [ 0, -1, 1 ] ) ( function() { if ( C === F || C === -F || C % F === 0 ) { return A; } else { return A*F; } })() ( function() { if ( C === F || C === -F || C % F === 0 ) { return B; } else { return B*F; } })() ( function() { if ( C === F ) { return D; } else if ( C === -F ) { return -D; } else if ( C % F === 0 ) { return D*(C/F); } else { return D*C; } })() ( function() { if ( C === F ) { return E; } else if ( C === -F ) { return -E; } else if ( C % F === 0 ) { return E*(C/F); } else { return E*C; } })() getGCD( getGCD( abs( E_TERM ), abs( B_TERM ) ), abs( A_TERM - D_TERM ) ) ( A_TERM-D_TERM < 0 ? -1 : 1 ) / GCD function( z, y, c ) { return X + " = \\dfrac{" + plus( round( z*DIVISOR )+Z, round( y*DIVISOR )+Y ) + "}{" + round( c*DIVISOR ) + "}"; }

\dfrac{ plus( A+X, B+Y ) }{ C } = \dfrac{ plus( D+X, E+Z ) }{ F }

Solve for X.

ANSWER( E_TERM, -B_TERM, A_TERM-D_TERM )

• ANSWER( E_TERM, B_TERM, A_TERM-D_TERM )
• ANSWER( -E_TERM, -B_TERM, A_TERM-D_TERM )
• ANSWER( -E_TERM, B_TERM, A_TERM-D_TERM )
• ANSWER( E_TERM, -B_TERM, A_TERM+D_TERM )
• ANSWER( E_TERM, B_TERM, A_TERM+D_TERM )
• ANSWER( -E_TERM, -B_TERM, A_TERM+D_TERM )
• ANSWER( -E_TERM, B_TERM, A_TERM+D_TERM )
• ANSWER( E_TERM, -B_TERM, -A_TERM-D_TERM )
• ANSWER( E_TERM, B_TERM, -A_TERM-D_TERM )
• ANSWER( -E_TERM, B_TERM, -A_TERM-D_TERM )
• ANSWER( -E_TERM, -B_TERM, -A_TERM-D_TERM )

Notice that the left- and right- denominators are the sameopposite.

\dfrac{ plus( A+X, B+Y ) }{ color_( C, true ) } = \dfrac{ plus( D+X, E+Z ) }{ color_( F, true ) }

So we can multiply both sides by C.

color_( C, true ) \cdot \dfrac{ plus( A+X, B+Y ) }{ color_( C, true ) } = color_( C, true ) \cdot \dfrac{ plus( D+X, E+Z ) }{ color_( F, true ) }

plus( A+X, B+Y ) = plus( D+X, E+Z ) color_( "-", true ) \cdot \left( plus( D+X, E+Z ) \right) 

Distribute the negative sign on the right side.

plus( A+X, B+Y ) = plus( D_TERM+X, E_TERM+Z )

plus( color_( A_TERM, true )+X, color_( B_TERM, true )+Y ) = plus( color_( D_TERM, true )+X, color_( E_TERM, true )+Z )

Multiply both sides by the left denominator.

\dfrac{ plus( A+X, B+Y ) }{ color_( C, true ) } = \dfrac{ plus( D+X, E+Z ) }{ F }

color_( C, true ) \cdot \dfrac{ plus( A+X, B+Y ) }{ color_( C, true ) } = color_( C, true ) \cdot \dfrac{ plus( D+X, E+Z ) }{ F }

plus( A+X, B+Y ) = color_( C, true ) \cdot \dfrac { plus( D+X, E+Z ) }{ F }

Reduce the right side.

plus( A+X, B+Y ) = color_( C, false ) \cdot \dfrac{ plus( D+X, E+Z ) }{ color_( F, false ) }

plus( A+X, B+Y ) = color_( C / F, false ) \cdot \left( plus( D+X, E+Z ) \right)

Multiply both sides by the right denominator.

plus( A+X, B+Y ) = C \cdot \dfrac{ plus( D+X, E+Z ) }{ color_( F, false ) }

color_( F, false ) \cdot \left( plus( A+X, B+Y ) \right) = color_( F, false ) \cdot C \cdot \dfrac{ plus( D+X, E+Z ) }{ color_( F, false ) }

color_( F, false ) \cdot \left( plus( A+X, B+Y ) \right) = C \cdot \left( plus( D+X, E+Z ) \right)

Distribute the right sideboth sides.

plus( A+X, B+Y ) = color_( C / F, true ) \cdot \left( plus( color_( D+X, true ), color_( E+Z, true ) ) \right)

color_( F, true ) \cdot \left( plus( A+X, B+Y ) \right) = color_( C, true ) \cdot \left( plus( D+X, E+Z ) \right)

plus( A_TERM+X, B_TERM+Y ) = plus( color_( D_TERM, true )+X, color_( E_TERM, true )+Z )

plus( color_( A_TERM, true )+X, color_( B_TERM, true )+Y ) = plus( color_( D_TERM, true )+X, color_( E_TERM, true )+Z )

Combine X terms on the left.

plus( color_( A_TERM+X, false ), B_TERM+Y ) = plus( color_( D_TERM+X, false ), E_TERM+Z )

plus( color_( (A_TERM-D_TERM)+X, false ), (B_TERM)+Y ) = (E_TERM)+Z

Move the Y term to the right.

plus( (A_TERM-D_TERM)+X, color_( B_TERM+Y, true ) ) = E_TERM+Z

(A_TERM-D_TERM)+X = plus( E_TERM+Z, color_( (-B_TERM)+Y, true ) )

Isolate X by dividing both sides by its coefficient.

color_( A_TERM-D_TERM, false )+X = plus( E_TERM+Z, (-B_TERM)+Y )

X = \dfrac{ plus( E_TERM+Z, (-B_TERM)+Y ) }{ color_( A_TERM-D_TERM, false ) }

All of these terms are divisible by GCD.

Divide by the common factor and swap signs so the denominator isn't negative.

Divide by the common factor.

Swap signs so the denominator isn't negative.

X = \dfrac{ plus( color_( round( E_TERM*DIVISOR ), true )+Z, color_( round( -B_TERM*DIVISOR ), true )+Y ) }{ color_( round( (A_TERM-D_TERM)*DIVISOR ), true ) }