# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
459 lines (455 sloc) 22.9 KB
 Absolute value equations
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 =

$("#solutionarea input").eq(0).val() === "" &&$("#solutionarea input").eq(1).val() === "" && !\$("#solutionarea input").eq(2).is(":checked")
return guess ? "" : true;
one or two integers, like 6 one or two simplified proper fractions, like 3/5 one or two simplified improper fractions, like 7/4 one or two exact decimals, like 0.75 if there is no solution for x, leave the boxes blank and check "No solution"

C > 0 ? "Subtract" : "Add" \red{abs(C)|x + E|} C > 0 ? "from" : "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}

B > 0 ? "Subtract" : "Add" \red{abs(B)} B > 0 ? "from" : "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

E > 0 ? "Subtract" : "Add" \red{abs(E)} E > 0 ? "from" : "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

E > 0 ? "Subtract" : "Add" \red{abs(E)} E > 0 ? "from" : "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)

A > 0 ? "Subtract" : "Add" \red{A|x + E|} A > 0 ? "from" : "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}

D > 0 ? "Subtract" : "Add" abs(D) D > 0 ? "from" : "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

E > 0 ? "Subtract" : "Add" \red{abs(E)} E > 0 ? "from" : "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

E > 0 ? "Subtract" : "Add" \red{abs(E)} E > 0 ? "from" : "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.