Pre-Calculus for Programmers

Algebra foundations: the toolkit calculus never reteaches

15 / 397
Contents

Contents

Pre-Calculus for Programmers

0 of 397 complete

10 min read

Rearranging a formula, and the errors that ruin calculus

Solving for whichever letter you want, and a tester that will tell you when an algebra step was a lie.

A weather feed gives temperatures in Fahrenheit and your program wants Celsius. The relationship you were given runs the wrong way: F=95C+32F = \frac{9}{5}C + 32 tells you FF from CC, and you need CC from FF. Guessing at the inverse is a good way to get an answer that is nearly right, so here is what nearly right looks like.

A rearrangement that is almost rightPython

No row agrees, and the gap between the two last columns is the same 14.2 degrees every time. What does a gap that never changes tell you about which operation the guess undid first? Then change the - 32 in the guess to - 17.7778 and run it again: every row is fixed, because 59×32=17.7778\frac{5}{9}\times 32 = 17.7778 to four places.

The guess undid the multiplication before it undid the addition, and it is wrong by tens of degrees. Rearranging is not a matter of moving symbols about until it looks right; it is undoing operations in the correct order.

The method

A literal equation is one with several letters, where you are asked to solve for a chosen one. Treat the chosen letter as the only unknown and every other letter as though it were a number you happen not to know the value of. Then peel the operations off it in reverse order, doing the same thing to both sides each time.

  1. Start from F=95C+32F = \frac{9}{5}C+32, solving for CC.
  2. The last thing done to CC was adding 32, so undo that first: subtract 32 from both sides, giving F−32=95CF - 32 = \frac{9}{5}C.
  3. The remaining operation on CC is multiplication by 95\frac{9}{5}, so undo it: multiply both sides by 59\frac{5}{9}.
  4. That gives C=59(F−32)C = \frac{5}{9}(F-32). The bracket is compulsory, because the whole of F−32F-32 was multiplied.
  5. Check with a value you know: water boils at C=100C = 100 and F=212F = 212. Then 59(212−32)=59⋅180=100\frac{5}{9}(212-32) = \frac{5}{9}\cdot180 = 100.

When the target appears in more than one place

Collect every term containing the target on one side, everything else on the other, then take the target out as a common factor and divide by what is left.

Solve ax+b=cx+dax+b = cx+d for xx.

  1. Move the xx terms together: subtract cxcx from both sides, giving ax−cx+b=dax - cx + b = d.
  2. Move the rest away: subtract bb from both sides, giving ax−cx=d−bax - cx = d - b.
  3. The left side has xx in both terms, so factor it out: x(a−c)=d−bx(a-c) = d-b.
  4. Divide both sides by (a−c)(a-c): x=d−ba−cx = \dfrac{d-b}{a-c}.
  5. This needs a≠ca \ne c. If a=ca = c the original equation has no xx left in it at all, and it is either always true or never true.

A formula with the target underneath a fraction line needs the fractions cleared first, using the method from the lesson on fractions inside fractions. Solve 1c=1a+1b\dfrac{1}{c} = \dfrac{1}{a}+\dfrac{1}{b} for aa, a formula that describes resistors in parallel and lenses alike.

  1. Get the term holding aa on its own: subtract 1b\frac{1}{b} from both sides, giving 1c−1b=1a\frac{1}{c}-\frac{1}{b} = \frac{1}{a}.
  2. Combine the left side over the common denominator bcbc: bbc−cbc=b−cbc\frac{b}{bc}-\frac{c}{bc} = \frac{b-c}{bc}.
  3. So b−cbc=1a\frac{b-c}{bc} = \frac{1}{a}.
  4. Both sides are single fractions, so turn both upside down, which is legal as long as neither side is zero: bcb−c=a\frac{bc}{b-c} = a.
  5. Check with numbers: b=6b = 6 and c=2c = 2 predict a=124=3a = \frac{12}{4} = 3. And indeed 13+16=12\frac{1}{3}+\frac{1}{6} = \frac{1}{2}.

The errors, and a tester for them

An algebraic identity is a claim that two expressions agree at every value. That makes it easy to test and impossible to fudge: one value where they disagree kills the claim. This snippet is a tool worth keeping.

An identity testerPython

Change right to x ** 2 + 6 * x + 9 and run it again: zero disagreements. Then test a claim of your own, such as left returning (x + 3) ** 3 against a right you write yourself.

Every row of the table below is a claim that fails that test. They have names because they are so common, and each one is a way of pretending an operation spreads across a sum when it does not.

The false claimA counterexampleWhat is actually true
(a+b)2=a2+b2(a+b)^{2} = a^{2}+b^{2}a=3,b=4a=3, b=4: 49 against 25(a+b)2=a2+2ab+b2(a+b)^{2} = a^{2}+2ab+b^{2}
a+b=a+b\sqrt{a+b} = \sqrt{a}+\sqrt{b}a=9,b=16a=9, b=16: 5 against 7nothing simpler; leave it alone
1a+b=1a+1b\dfrac{1}{a+b} = \dfrac{1}{a}+\dfrac{1}{b}a=b=1a=b=1: 12\frac{1}{2} against 21a+1b=a+bab\dfrac{1}{a}+\dfrac{1}{b} = \dfrac{a+b}{ab}
a+cb+c=ab\dfrac{a+c}{b+c} = \dfrac{a}{b}a=1,b=2,c=1a=1,b=2,c=1: 23\frac{2}{3} against 12\frac{1}{2}only common factors cancel, never common terms
a2=a\sqrt{a^{2}} = aa=−5a=-5: 5 against −5-5a2=∣a∣\sqrt{a^{2}} = |a|
−(a−b)=−a−b-(a-b) = -a-ba=5,b=2a=5,b=2: −3-3 against −7-7−(a−b)=−a+b-(a-b) = -a+b
(ab)2=ab2(ab)^{2} = ab^{2}a=2,b=3a=2,b=3: 36 against 18(ab)2=a2b2(ab)^{2} = a^{2}b^{2}
Claims that are false, with one value that proves it.
Solve A=P(1+rt)A = P(1+rt) for tt.

Divide both sides by PP first, since PP multiplies the whole bracket: AP=1+rt\frac{A}{P} = 1+rt. Subtract 1: AP−1=rt\frac{A}{P}-1 = rt. Divide by rr: t=AP−1rt = \frac{\frac{A}{P}-1}{r}, which tidies by multiplying top and bottom by PP to t=A−PPrt = \frac{A-P}{Pr}. Check with A=120A = 120, P=100P = 100, r=0.1r = 0.1: the formula gives t=2010=2t = \frac{20}{10} = 2, and 100(1+0.1⋅2)=120100(1+0.1\cdot2) = 120.

Check yourself

Solving S=a1−rS = \dfrac{a}{1-r} for rr gives which of these?

All lessons in Pre-Calculus for Programmers