random() < 0.25 1 randRangeNonZero( -10, 10 ) 1 SQUARE ? B : randRangeNonZero( -10, 10 ) "x" "x^2" "\\left(" + plus( A+X, B ) + "\\right)" "\\left(" + plus( C+X, D ) + "\\right)"

`LEFT + (SQUARE ? "^2" : RIGHT) = \ ?`

`plus((A * C) + XX, (A * D + B * C) + X, B * D)`

- `plus(XX, B * D)`
- `plus(XX, B * D)`
- `plus((A + C) + XX, (A * D + B * C) + X, B * D)`
- `plus((A * C) + XX, (A * D + B * C) + X, B + D)`
- `plus((A + C) + XX, (A * D + B * C) + X, B + D)`
- `plus((A + C) + XX, (A * D - B * C) + X, B * D)`
- `plus((A * C) + XX, (A * D - B * C) + X, B + D)`
- `plus((A + C) + XX, (A * D - B * C) + X, B + D)`
- `plus((A + C) + XX, (A * B + C * D) + X, B * D)`
- `plus((A * C) + XX, (A * B + C * D) + X, B + D)`
- `plus((A + C) + XX, (A * B + C * D) + X, B + D)`
- `plus((A + C) + XX, (A * B - C * D) + X, B * D)`
- `plus((A * C) + XX, (A * B - C * D) + X, B + D)`
- `plus((A + C) + XX, (A * B - C * D) + X, B + D)`

`= LEFT + RIGHT`

Start by distributing the `(\blue{X + B})`:

`\qquad = \quad (\blue{X + B})(X + D)`

`\qquad = \quad \blue{X}(X + D) \blue{+B}(X + D)`

Next, distribute the `\blue{X}` and the `\blue{B}`:

`\qquad = \quad (\blue{X} \cdot X) + (\blue{X} \cdot D) + (\blue{B} \cdot X) + (\blue{B} \cdot D)`

Notice that by distributing you're really just multiplying each term in the first expression by each term in the second expression.

Simplify:

`\qquad = \quad XX + DX + BX + B * D`

Keep simplifying to get the final answer:

`\qquad = \quad plus(XX, (D + B) + X, (B * D))`