randRange(2, 8) randRangeNonZero(-10, 10) randRangeNonZero(-6, 6) randRange(2, 10) randRangeNonZero(-10, 10) (D - B) / (A - C) <= 0 [abs(D - B) - E * abs(A - C), abs(A - C)] [-1 * abs(D - B) - E * abs(A - C), abs(A - C)] NO_SOLUTION ? [] : [ POS_SOLUTION[0] / POS_SOLUTION[1], NEG_SOLUTION[0] / NEG_SOLUTION[1] ] fractionReduce(D - B, A - C) abs((A - C) / getGCD(D - B, A - C))

Solve for `x`:
`A|x + E| + B = C|x + E| + D`

SOLUTION

`x =` or `x =`

NO_SOLUTION There is no solution

Subtract `\red{abs(C)|x + E|}` from both sides:

Add `\red{abs(C)|x + E|}` to both sides:

`\qquad\begin{eqnarray} A|x + E| + B &=& C|x + E| + D \\ \\ \red{ - C|x + E|} && \red{ - C|x + E|} \\ \\ A - C|x + E| + B &=& D \end{eqnarray}`

Subtract `\red{abs(B)}` from both sides:

Add `\red{abs(B)}` to both sides:

`\qquad\begin{eqnarray} A - C|x + E| + B &=& D \\ \\ \red{ - B} &=& \red{ - B} \\ \\ A - C|x + E| &=& D - B \end{eqnarray}`

Divide both sides by `\red{A - C}`:

`\qquad \dfrac{A - C|x + E|} {\red{A - C}} = \dfrac{D - B} {\red{A - C}}`

Simplify:

`\qquad |x + E| = SIMPLIFIED`

Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:

`\qquad x + E = -SIMPLIFIED`

or

`\qquad x + E = SIMPLIFIED`

Solve for the solution where `x + E` is negative:

`\qquad x + E = -SIMPLIFIED`

Subtract `\red{abs(E)}` from both sides:

Add `\red{abs(E)}` to both sides:

`\qquad\begin{eqnarray} x + E &=& -SIMPLIFIED \\ \\ \red{- E} && \red{- E} \\ \\ x &=& -SIMPLIFIED - E \end{eqnarray}`

Change the `\red{{} - E}` to an equivalent fraction with a denominator of `SIMPLIFIED_DENOM`:

`\qquad x = - SIMPLIFIED \red{E > 0 ? "-" : "+" fraction(abs(E) * SIMPLIFIED_DENOM, SIMPLIFIED_DENOM)}`

`\qquad x = fractionReduce.apply(null, NEG_SOLUTION)`

Then calculate the solution where `x + E` is positive:

`\qquad x + E = SIMPLIFIED`

Subtract `\red{abs(E)}` from both sides:

Add `\red{abs(E)}` to both sides:

`\qquad\begin{eqnarray} x + E &=& SIMPLIFIED \\ \\ \red{- E} && \red{- E} \\ \\ x &=& SIMPLIFIED - E \end{eqnarray}`

Change the `\red{{} - E}` to an equivalent fraction with a denominator of `SIMPLIFIED_DENOM`:

`\qquad x = SIMPLIFIED \red{E > 0 ? "-" : "+" fraction(abs(E) * SIMPLIFIED_DENOM, SIMPLIFIED_DENOM)}`

`\qquad x = fractionReduce.apply(null, POS_SOLUTION)`

Subtract `\red{A|x + E|}` from both sides:

Add `\red{A|x + E|}` to both sides:

`\qquad\begin{eqnarray} A|x + E| + B &=& C|x + E| + D \\ \\ \red{- A|x + E|} && \red{- A|x + E|} \\ \\ B &=& C - A|x + E| + D \end{eqnarray}`

Subtract `abs(D)` from both sides:

Add `abs(D)` to both sides:

`\qquad\begin{eqnarray} B &=& C - A|x + E| + D \\ \\ \red{- D} && \red{- D} \\ \\ B - D &=& C - A|x + E| \end{eqnarray}`

Divide both sides by `\red{C - A}`.

`\qquad \dfrac{B - D} {\red{C - A}} = \dfrac{C - A|x + E|} {\red{C - A}}`

Simplify:

`\qquad SIMPLIFIED = |x + E|`

Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:

`\qquad -SIMPLIFIED = x + E`

or

`\qquad SIMPLIFIED = x + E`

Solve for the solution where `x + E` is negative:

`\qquad - SIMPLIFIED = x + E`

Subtract `\red{abs(E)}` from both sides:

Add `\red{abs(E)}` to both sides:

`\qquad\begin{eqnarray} - SIMPLIFIED &=& x + E \\ \\ \red{- E} && \red{- E} \\ \\ -SIMPLIFIED - E &=& x \end{eqnarray}`

Change the `\red{{} - E}` to an equivalent fraction with a denominator of `SIMPLIFIED_DENOM`.

`\qquad - SIMPLIFIED \red{E > 0 ? "-" : "+" fraction(abs(E) * SIMPLIFIED_DENOM, SIMPLIFIED_DENOM)} = x`

`\qquad fractionReduce.apply(null, NEG_SOLUTION) = x`

Then calculate the solution where `x + E` is positive:

`\qquad SIMPLIFIED = x + E`

Subtract `\red{abs(E)}` from both sides:

Add `\red{abs(E)}` to both sides:

`\qquad\begin{eqnarray} SIMPLIFIED &=& x + E \\ \\ \red{- E} && \red{- E} \\ \\ SIMPLIFIED - E &=& x \end{eqnarray}`

Change the `\red{{} - E}` to an equivalent fraction with a denominator of `SIMPLIFIED_DENOM`.

`\qquad SIMPLIFIED \red{E > 0 ? "-" : "+" fraction(abs(E) * SIMPLIFIED_DENOM, SIMPLIFIED_DENOM)} = x`

`\qquad fractionReduce.apply(null, POS_SOLUTION) = x`

Thus, the correct answer is `x = fractionReduce.apply(null, NEG_SOLUTION)` or `x = fractionReduce.apply(null, POS_SOLUTION)` .

The absolute value cannot be negative. Therefore, there is no solution.