# Khan/khan-exercises

### Subversion checkout URL

You can clone with
or
.
Fetching contributors…

Cannot retrieve contributors at this time

269 lines (261 sloc) 14.224 kB
 Absolute value equations
randRange(2, 8) randRangeNonZero(-10, 10) randRangeNonZero(-6, 6) randRange(2, 10) randRangeNonZero(-10, 10) abs(A-C) fractionReduce(D-B, A-C) (D-B)/(A-C) > 0 abs((A-C)/getGCD(D-B, A-C)) (function() { if ((D-B)/(A-C) > 0) { return fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C)); } else { return "No solution"; } })() (function() { if ((D-B)/(A-C) > 0) { return fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C)); } else { return "No solution"; } })() (function() { if ((D-B)/(A-C) > 0) { return "<code>" +"x = " +fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C)) +"\\text{ or }" +"x = " +fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C)) +"</code>"; } else { return "No solution"; } })() (function() { var choices = []; for (var i = 0; i < 4; i++) { var choice = "<code>"; var nOffset = randRange(1, 10); var dOffset = randRangeExclude(1, 10, [ C-A ]); var tOffset = randRange(1, 10); if (D-B+nOffset === 0 && E+tOffset === 0) { choice += "x = 0"; } else { choice += "x = " +fractionReduce(-1*abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset)) +"\\text{ or }" +"x = " +fractionReduce(abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset)); } choice += "</code>"; choices.unshift(choice); } if ((D-B)/(A-C) > 0) { choices.shift(); choices.unshift(SOLUTION); choices = shuffle(choices); choices.push("No solution"); } else { choices = shuffle(choices); choices.push(SOLUTION); } return choices; })()

Solve for x:

A|x + E| + B = C|x + E| + D

SOLUTION

• choice

C > 0 ? "Subtract" : "Add" abs(C)|x + E| C > 0 ? "from" : "to" both sides:

(A|x + E| + B) - C|x + E| = (C|x + E| + D) - C|x + E|

A - C|x + E| + B = D

B > 0 ? "Subtract" : "Add" abs(B) B > 0 ? "from" : "to" both sides:

(A - C|x + E| + B) - B = D - B

A - C|x + E| = D - B

Divide both sides by A - C.

\dfrac{A - C|x + E|}{A - C} = fraction(D-B, A-C)

Simplify.

|x + E| = SIMPLIFIED

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

x + E = - SIMPLIFIED

or

x + E = SIMPLIFIED

Calculate the solution where x + E is negative.

x + E = - SIMPLIFIED

E > 0 ? "Subtract" : "Add" abs(E) E > 0 ? "from" : "to" both sides:

x + E - E = - SIMPLIFIED - E

x = - SIMPLIFIED - E

Change the term to an equivalent fraction with a denominator of SIMPLIFIED_DENOM.

x = - SIMPLIFIED - E\cdot fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)

x = - SIMPLIFIEDE > 0 ? "-" : "+" fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)

x = NEG_RESULT

Then calculate the solution where x + E is positive.

x + E = SIMPLIFIED

E > 0 ? "Subtract" : "Add" abs(E) E > 0 ? "from" : "to" both sides:

x + E - E = SIMPLIFIED - E

x = SIMPLIFIED - E

Change the term to an equivalent fraction with a denominator of SIMPLIFIED_DENOM.

x = SIMPLIFIED - E\cdot fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)

x = SIMPLIFIEDE > 0 ? "-" : "+" fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)

x = POS_RESULT

A > 0 ? "Subtract" : "Add" A|x + E| A > 0 ? "from" : "to" both sides:

(A|x + E| + B) - A|x + E| = (C|x + E| + D) - A|x + E|

B = C - A|x + E| + D

D > 0 ? "Subtract" : "Add" abs(D) D > 0 ? "from" : "to" both sides:

B - D = (C - A|x + E| + D) - D

B - D = C - A|x + E|

Divide both sides by C - A.

fraction(B-D, C-A) = \dfrac{C - A|x + E|}{C - A}

Simplify.

SIMPLIFIED = |x + E|

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

- SIMPLIFIED = x + E

or

SIMPLIFIED = x + E

Calculate the solution where x + E is negative.

- SIMPLIFIED = x + E

E > 0 ? "Subtract" : "Add" abs(E) E > 0 ? "from" : "to" both sides:

- SIMPLIFIED - E = x + E - E

- SIMPLIFIED - E = x

Change the term to an equivalent fraction with a denominator of SIMPLIFIED_DENOM.

- SIMPLIFIED - E\cdotfraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM) = x

- SIMPLIFIEDE > 0 ? "-" : "+" fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM) = x

NEG_RESULT = x

Then calculate the solution where x + E is positive.

SIMPLIFIED = x + E

E > 0 ? "Subtract" : "Add" abs(E) E > 0 ? "from" : "to" both sides:

SIMPLIFIED - E = x + E - E

SIMPLIFIED - E = x

Change the term to an equivalent fraction with a denominator of SIMPLIFIED_DENOM.

SIMPLIFIED - E\cdot fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM) = x

SIMPLIFIEDE > 0 ? "-" : "+" fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM) = x

POS_RESULT = x

Thus, the correct answer is SOLUTION.

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

Something went wrong with that request. Please try again.