# A Quick Intuition For Parametric Equations

Algebra is really about relationships. How are things connected? Do they move together, or apart, or maybe they’re completely independent?

Normal equations assume an “input to output” connection. That is, we take an input (x=3), plug it into the relationship (y=x2), and observe the result (y=9).

But is that the only way to see a scenario? The setup y=x2 implies that y only moves because of x. But it could be that y just coincidentally equals x2, and some hidden factor is changing them both (the factor changes x to 3 while also changing y to 9).

As a real world example: For every degree above 70, our convenience store sells x bottles of sunscreen and x2 pints of ice cream.

We could write the algebra relationship like this:

$\displaystyle{ice \ cream = (sunscreen)^2}$

The equation implies sunscreen directly changes the demand for ice cream, when it’s the hidden variable (temperature) that changed them both!

It’s much better to write two separate equations

$\displaystyle{sunscreen = temperature - 70}$

$\displaystyle{ice \ cream = (temperature - 70)^2}$

that directly point out the causality. The ideas “temperature impacts ice cream” and “temperature impacts sunscreen” clarify the situation, and we lose information by trying to factor away the common “temperature” portion. Parametric equations get us closer to the real-world relationship.

Don’t Think About Time. Just Look for Root Causes.

A reader pointed out that nearly every parametric equation tutorial uses time as its example parameter. We get so hammered with “parametric equations involve time” that we forget the key insight: parameters point to the cause. Why did we change? (Maybe it was time, or temperature, or perhaps sunscreen really does make you hungry for ice cream.)

Most algebraic equations lay out a connection like y = x2. Parametric equations remind us to look deeper (lost on me until recently; I’d been stuck in the “time/physics” mindset).

Sure, not every setup has a hidden parameter, but isn’t it worth a look?

Update: Eddie Woo made an excellent video using this analogy.

Watch the full series (part 2, part 3), I really loved how he explained the history of the word (para=beside, i.e. you have a hidden variable beside the ones you see). Thanks Eddie!

# BetterExplained Calculus Course Now Available (Public Beta)

Hi all! I’m happy to announce a public availability of the BetterExplained Guide To Calculus. You can read it online:

http://betterexplained.com/calculus/

And here’s a peek at the first lesson:

(Like the new look? I’ve been working with a great designer and will be refreshing the main site too.)

The goal is an intuition-first look at a notoriously gnarly subject. This isn’t a replacement for a stodgy textbook — it’s the friendly introduction I wish I’d had. A few hours of reading that would have saved me years of frustration.

The course text is free online, with a complete edition available, which includes:

• Course Text
• Video walkthroughs for each lesson
• Per-lesson class discussions
• PowerPoint files for all diagrams
• Quizzes to check understanding (In development)
• Print-friendly PDF ebook (In development)
• Invitations to class webinars (In development)

Buy The Beta Course 99 149 The price of the course will increase when the final version is released, so hop onto the beta to snag the lower price. ## Building A Course: Lessons Learned A few insights jumped out while making the course. This may be helpful if you’re considering teaching a course one day (I hope you are). Incentives Matter I struggled with what to make free vs. paid. I love sharing insights with people… and I also love knowing I can do so until I’m an old man, complaining that newfangled brain-chip implants aren’t “real learning”. Incentives always exist. I want to make education projects sustainable, designed to satisfy readers, not a 3rd party. Similar to the fantastic Rails Tutorial Book, the course text is free, with extra resources available. Having the core material free with paid variations & guidance helps align my need to create, share, and be sustainable. Being Focused Matters Historically, I’m lucky to write an article a month. But this summer, I wrote 16 lessons in 6 weeks. What was the difference? Well, pressure from friends, for one: I’d promised to do a calculus course this summer. But mostly, it was the focus of having a single topic, brainstorming on numerous analogies/examples, and carving a rough path through on a schedule (2-3 articles/week). I hope this doesn’t sound disciplined, because I’m not. A combination of fear (I told people I’d do this) and frustration (Argh, I remember being a student and not having things click) pushed me. When I finished, I took a break from writing and vegged out for a few weeks. But I think it was a worthwhile trade — in my mind, a year’s worth of material was ready. Fundamentals Matter There’s many options for making a course. Modules. Quizzes. Interactive displays. Tribal dance routines. Hundreds of tools to convey your message. And… what is that message, anyway? Are we transmitting facts, or building insight? Until the fundamentals are working, the fancy dance routine seems useless. I’d rather read genuine insights from a pizza box than have an interactive hologram that that recites a boring lecture. When lessons are lightweight and easy to update, you’re excited about feedback (Oh yeah! A chance to make it better!). The more static the medium, the more you fear feedback (Oh no, I have to redo it?). A fixed medium has its place, ideally after a solid foundation has been mapped out. I’ll be polishing the course in the coming weeks, feedback is welcome! -Kalid # It’s Time For An Intuition-First Calculus Course Summary: I’m building a calculus course from the ground-up focused on permanent intuition, not the cram-test-forget cycle we’ve come to expect. Update: The course is now live at http://betterexplained.com/calculus ## The Problem: We Never Internalized Calculus First off: what’s wrong with how calculus is taught today? (Ha!) Just look at the results. The vast majority of survivors, the STEM folks who used calculus in several classes, have no lasting intuition. We memorized procedures, applied them to pre-packaged problems (“Say, fellow, what is the derivative of x2?”), and internalized nothing. Want proof? No problem. Take a string and wrap it tight around a quarter. Take another string and wrap it tight around the Earth. Ok. Now, lengthen both strings, adding more to the ends, so there’s a 1-inch gap all the way around around the quarter, and a 1-inch gap all the way around the Earth (sort of like having a ring floating around Saturn). Got it? Quiz time: Which scenario uses more extra string? Does it take more additional string to put a 1-inch gap around the quarter, or to put a 1-inch gap around the Earth? Think about it. Ponder it over. Ready? It’s the… same. The same! Adding a 1-inch gap around the Earth, and a quarter, uses the same 6.28 inches. And to be blunt: if you “learned” calculus but didn’t have the answer within 3 seconds, you don’t truly know it. At least not deep down. Now don’t feel bad, I didn’t know it either. Only one engineer in the dozens I’ve asked came up with the answer instantly, without second-guesses (my karate teacher, Mr. Rose). This question has a few levels of understanding: • Algebra Robot: Calculating change in circumference: 2*pi*(r + 1) - 2*pi*r = 2*pi. They are the same. Calculation complete. • Calculus Disciple: Oh! We know circumference = 2*pi*r. The derivative is 2*pi, a constant, which means the current radius has no impact on a changing circumference. • Calculus Zen master: I see the true nature of things. We’re changing a 1-dimensional radius and watching a 1-dimensional perimeter. A dimension in, a dimension out, it’s like making a fence 1-foot longer: the initial size doesn’t change the work needed. The gap could be made around a circle, square, rectangle, or Richard Nixon mask, and it’s the same effort for similar shapes. (And, silly me, I’d forgotten the equation for circumference anyway!) We can be calculus warrior-monks, cutting through problems with our intuition. Notice how the most advanced approach didn’t need specific equations — it was just thinking about the problem! Equations are nice tools, but are they your only source of understanding? See, according to standardized tests and final exams, I “knew” calculus — but clearly only to the beginning level. I didn’t immediately recognize how calculus could help with a question about making a string longer. If you asked someone for the amount of cash in a wallet with six20 bills, and they didn’t think to use multiplication, would you say they’ve internalized arithmetic? (“Oh geez, you didn’t tell me this would be a multiplication question! Could you set up the problem for me?”)

I want you to have the intuition-first calculus class I never did. The goal is lasting intuition, shared by an excited friend, and built with the test of “If you haven’t internalized the idea, the material must change.”

## How Can We Make Learning Intuitive And Interesting?

With Progressive Refinement. You may have seen these two methods to download and display an image:

Teaching a subject is similar:

• Baseline Teaching: Cover individual concepts in full-depth, one after another
• Progressive Teaching: See the big picture, how the whole fits together, then sharpen the detail

The “start-to-finish” approach seems official. Orderly. Rigorous. And it doesn’t work.

What, exactly, do you know when you’ve seen the first 20% of a portrait in full resolution? A forehead? Do you even know the gender? The age? The teacher has forgotten that you’ve never seen the full picture and likely can’t appreciate that you’re even seeing a forehead!

Progressive rendering (blurry-to-sharp) gives a full overview, a rough approximation of what the expert sees, and gets you curious about more. After the overview, we start filling in the details. And because you have an idea of where you’re going, you’re excited to learn. What’s better: “Let’s download the next 10% of the forehead”, or “Let’s sharpen the picture”?

Let’s admit it: we forget the details of most classes. If we’ll have a hazy memory anyway, shouldn’t it be of the entire picture? That has the best shot of enticing us to sharpen the details later on.

## How Do We Know If A Lesson Is Any Good?

With the Pizza Box Test. Imagine you pass a dumpster while walking home. You see a message scrawled on a discarded pizza box. Is the note so insightful and compelling that you’d take the pizza box home to finish reading it?

Ignore the sparkle of a lesson being digital, mobile-friendly, gamified, interactive, or a gesture-based hologram. Would you take this lesson home if it were written on a pizza box?

If yes, great! Clean it up and add in the glitz. But if the core lesson is not compelling without the trimmings, it must be redone.

Everyone’s “pizza box” standard varies; just have one. Here’s a few things I wish were written on the boxes outside my high school:

• Psst! Think of e as a universal component in all growth rates, just like pi is a universal factor in all circles…

• Hey buddy! Degrees are from the observer’s perspective. Radians are from the mover’s. That’s why radians are more natural. Let me show you…

• Yo! Imaginary numbers are another dimension, and multiplication by i is a 90-degree rotation into that dimension! Two rotations and you’re facing backwards, aka -1.

## How Do We Know What’s Best For The Student?

By focusing on what future-you would teach current-you.

Teachers, like all of us, face external incentives which may interfere with their goals (publish or perish, mandated curriculum, need to impress others with jargon, etc.). The test of “What would future-me teach present-me?” helps me focus on the essentials:

• Use the shortest lessons possible. There’s no word count to meet. The same insight in fewer words is preferred.

• Use the simplest language possible. It’s future-me talking to current-me. There’s nobody to impress here.

• Use any analogy that’s memorable. I’m not embarrassed by “childish” analogies. If a metaphor excites me, and helps, I’m going to use it. Nyah.

• Be a friend, not lecturer. I want a buddy, a guide who happened to experience the material before I did, not a pompous schoolmarm I can’t question.

• Point out the naked emperor. Most calculus classes cover “limits, derivatives, integrals” in that order because… why? Limits are the most nuanced concept, invented in the mid-1800s. Were mathematicians like Newton, Leibniz, Euler, Gauss, Taylor, Fourier and Bernoulli inadequate because they didn’t use them? (Conversely: are you better than them because you do?). Most courses are too timid (or oblivious) to question the strategy of covering the most elusive, low-level topic first.

• Learn for the long haul. The elephant in the room is that most math courses are a stepping-stone to some credential. Future-me doesn’t play that game: he only benefits when current-me permanently understands something.

Let’s learn calculus intuition-first. The goal is a lasting upgrade to your intuition and storehouse of analogies. If that doesn’t happen, the course isn’t working, and it will be enhanced until it does.

Sign up for the mailing list and I’ll let you know when the course preview is ready, in November.

Happy math.

# Print Edition of “Math, Better Explained” Now Available

I’m thrilled to announce the print edition of Math, Better Explained is available on Amazon:

With the magic of print-on-demand, you can order the book with overnight shipping (Amazon Prime!), and be reading full-color insights tomorrow. Yowza.

I’ve often been asked if a print version can be made, and I’m beaming to say it’s now a reality:

• 12 chapters (~100 pages) of full-color explanations
• Professional-quality typesetting & layout
• Gorgeous, high-resolution text and diagrams
• Compact, easy-to-carry size with comfortable margins (7″ x 10″)

The best part? There’s no garish marketing fluff needed by traditional books that compete for shelf space (testimonials, callouts, those can go in the Amazon description!). The book is my take on a simple, friendly presentation of the math essentials. It’s what I wish I had in high school (and college, and afterwards), and a tremendous value for the time and frustration it will save you.

Unlike a textbook you’re afraid to open, this book is meant to be accessible. Years later, flip back to that diagram that helped imaginary numbers click. Show that curious young student how the Pythagorean theorem goes way beyond triangles. Math is meant to be seen and felt, not just thought about.

The full-color format does increase the printing costs, but I wanted to share the highest-quality version I could (hey, I’m a reader too!). The introductory price (under 20) is heavily discounted and will change soon, so grab your copy today! As always, happy math. PS: Reviews are sincerely appreciated, and if you’re a math reviewer (or willing to be one!), contact me and I’ll get a copy your way. Thanks for your support! # An Intuitive Introduction To Limits Limits, the Foundations Of Calculus, seem so artificial and weasely: “Let x approach 0, but not get there, yet we’ll act like it’s there… ” Ugh. Here’s how I learned to enjoy them: • What is a limit? Our best prediction of a point we didn’t observe. • How do we make a prediction? Zoom into the neighboring points. If our prediction is always in-between neighboring points, no matter how much we zoom, that’s our estimate. • Why do we need limits? Math has “black hole” scenarios (dividing by zero, going to infinity), and limits give us an estimate when we can’t compute a result directly. • How do we know we’re right? We don’t. Our prediction, the limit, isn’t required to match reality. But for most natural phenomena, it sure seems to. Limits let us ask “What if?”. If we can directly observe a function at a value (like x=0, or x growing infinitely), we don’t need a prediction. The limit wonders, “If you can see everything except a single value, what do you think is there?”. When our prediction is consistent and improves the closer we look, we feel confident in it. And if the function behaves smoothly, like most real-world functions do, the limit is where the missing point must be. ## Key Analogy: Predicting A Soccer Ball Pretend you’re watching a soccer game. Unfortunately, the connection is choppy: Ack! We missed what happened at 4:00. Even so, what’s your prediction for the ball’s position? Easy. Just grab the neighboring instants (3:59 and 4:01) and predict the ball to be somewhere in-between. And… it works! Real-world objects don’t teleport; they move through intermediate positions along their path from A to B. Our prediction is “At 4:00, the ball was between its position at 3:59 and 4:01”. Not bad. With a slow-motion camera, we might even say “At 4:00, the ball was between its positions at 3:59.999 and 4:00.001”. Our prediction is feeling solid. Can we articulate why? • The predictions agree at increasing zoom levels. Imagine the 3:59-4:01 range was 9.9-10.1 meters, but after zooming into 3:59.999-4:00.001, the range widened to 9-12 meters. Uh oh! Zooming should narrow our estimate, not make it worse! Not every zoom level needs to be accurate (imagine seeing the game every 5 minutes), but to feel confident, there must be some threshold where subsequent zooms only strengthen our range estimate. • The before-and-after agree. Imagine at 3:59 the ball was at 10 meters, rolling right, and at 4:01 it was at 50 meters, rolling left. What happened? We had a sudden jump (a camera change?) and now we can’t pin down the ball’s position. Which one had the ball at 4:00? This ambiguity shatters our ability to make a confident prediction. With these requirements in place, we might say “At 4:00, the ball was at 10 meters. This estimate is confirmed by our initial zoom (3:59-4:01, which estimates 9.9 to 10.1 meters) and the following one (3:59.999-4:00.001, which estimates 9.999 to 10.001 meters)”. Limits are a strategy for making confident predictions. ## Exploring The Intuition Let’s not bring out the math definitions just yet. What things, in the real world, do we want an accurate prediction for but can’t easily measure? What’s the circumference of a circle? Finding pi “experimentally” is tough: bust out a string and a ruler? We can’t measure a shape with seemingly infinite sides, but we can wonder “Is there a predicted value for pi that is always accurate as we keep increasing the sides?” Archimedes figured out that pi had a range of $\displaystyle{3 \frac{10}{71} < \pi < 3 \frac{1}{7} }$ using a process like this: It was the precursor to calculus: he determined that pi was a number that stayed between his ever-shrinking boundaries. Nowadays, we have modern limit definitions of pi. What does perfectly continuous growth look like? e, one of my favorite numbers, can be defined like this: $\displaystyle{e = \lim_{n\to\infty} \left( 1 + \frac{1}{n} \right)^n}$ We can’t easily measure the result of infinitely-compounded growth. But, if we could make a prediction, is there a single rate that is ever-accurate? It seems to be around 2.71828… Can we use simple shapes to measure complex ones? Circles and curves are tough to measure, but rectangles are easy. If we could use an infinite number of rectangles to simulate curved area, can we get a result that withstands infinite scrutiny? (Maybe we can find the area of a circle.) Can we find the speed at an instant? Speed is funny: it needs a before-and-after measurement (distance traveled / time taken), but can’t we have a speed at individual instants? Hrm. Limits help answer this conundrum: predict your speed when traveling to a neighboring instant. Then ask the “impossible question”: what’s your predicted speed when the gap to the neighboring instant is zero? Note: The limit isn’t a magic cure-all. We can’t assume one exists, and there may not be an answer to every question. For example: Is the number of integers even or odd? The quantity is infinite, and neither the “even” nor “odd” prediction stays accurate as we count higher. No well-supported prediction exists. For pi, e, and the foundations of calculus, smart minds did the proofs to determine that “Yes, our predicted values get more accurate the closer we look.” Now I see why limits are so important: they’re a stamp of approval on our predictions. ## The Math: The Formal Definition Of A Limit Limits are well-supported predictions. Here’s the official definition: $\displaystyle{ \lim_{x \to c}f(x) = L }$ means for all real ε > 0 there exists a real δ > 0 such that for all x with 0 < |x − c| < δ, we have |f(x) − L| < ε Let’s make this readable: Math EnglishHuman English $\displaystyle{ \lim_{x \to c}f(x) = L }$ means When we “strongly predict” that f(c) = L, we mean for all real ε > 0for any error margin we want (+/- .1 meters) there exists a real δ > 0there is a zoom level (+/- .1 seconds) such that for all x with 0 < |x − c| < δ, we have |f(x) − L| < εwhere the prediction stays accurate to within the error margin There’s a few subtleties here: • The zoom level (delta, δ) is the function input, i.e. the time in the video • The error margin (epsilon, ε) is the most the function output (the ball’s position) can differ from our prediction throughout the entire zoom level • The absolute value condition (0 < |x − c| < δ) means positive and negative offsets must work, and we’re skipping the black hole itself (when |x – c| = 0). We can’t evaluate the black hole input, but we can say “Except for the missing point, the entire zoom level confirms the prediction f(c) = L.” And because f(c) = L holds for any error margin we can find, we feel confident. Could we have multiple predictions? Imagine we predicted L1 and L2 for f(c). There’s some difference between them (call it .1), therefore there’s some error margin (.01) that would reveal the more accurate one. Every function output in the range can’t be within .01 of both predictions. We either have a single, infinitely-accurate prediction, or we don’t. Yes, we can get cute and ask for the “left hand limit” (prediction from before the event) and the “right hand limit” (prediction from after the event), but we only have a real limit when they agree. A function is continuous when it always matches the predicted value (and discontinuous if not): $\displaystyle{\lim_{x \to c}{f(x)} = f(c)}$ Calculus typically studies continuous functions, playing the game “We’re making predictions, but only because we know they’ll be correct.” ## The Math: Showing The Limit Exists We have the requirements for a solid prediction. Questions asking you to “Prove the limit exists” ask you to justify your estimate. For example: Prove the limit at x=2 exists for $\displaystyle{f(x) = \frac{(2x+1)(x-2)}{(x - 2)}}$ The first check: do we even need a limit? Unfortunately, we do: just plugging in “x=2” means we have a division by zero. Drats. But intuitively, we see the same “zero” (x – 2) could be cancelled from the top and bottom. Here’s how to dance this dangerous tango: • Assume x is anywhere except 2 (It must be! We’re making a prediction from the outside.) • We can then cancel (x – 2) from the top and bottom, since it isn’t zero. • We’re left with f(x) = 2x + 1. This function can be used outside the black hole. • What does this simpler function predict? That f(2) = 2*2 + 1 = 5. So f(2) = 5 is our prediction. But did you see the sneakiness? We pretended x wasn’t 2 [to divide out (x-2)], then plugged in 2 after that troublesome item was gone! Think of it this way: we used the simple behavior from outside the event to predict the gnarly behavior at the event. We can prove these shenanigans give a solid prediction, and that f(2) = 5 is infinitely accurate. For any accuracy threshold (ε), we need to find the “zoom range” (δ) where we stay within the given accuracy. For example, can we keep the estimate between +/- 1.0? Sure. We need to find out where $\displaystyle{|f(x) - 5| < 1.0}$ so \begin{align*} |2x + 1 - 5| &< 1.0 \\ |2x - 4| &< 1.0 \\ |2(x - 2)| &< 1.0 \\ 2|(x - 2)| &< 1.0 \\ |x - 2| &< 0.5 \end{align*} In other words, x must stay within 0.5 of 2 to maintain the initial accuracy requirement of 1.0. Indeed, when x is between 1.5 and 2.5, f(x) goes from f(1.5) = 4 to and f(2.5) = 6, staying +/- 1.0 from our predicted value of 5. We can generalize to any error tolerance (ε) by plugging it in for 1.0 above. We get: $\displaystyle{|x - 2| < 0.5 \cdot \epsilon}$ If our zoom level is “δ = 0.5 * ε”, we’ll stay within the original error. If our error is 1.0 we need to zoom to .5; if it’s 0.1, we need to zoom to 0.05. This simple function was a convenient example. The idea is to start with the initial constraint (|f(x) – L| < ε), plug in f(x) and L, and solve for the distance away from the black-hole point (|x – c| < ?). It’s often an exercise in algebra. Sometimes you’re asked to simply find the limit (plug in 2 and get f(2) = 5), other times you’re asked to prove a limit exists, i.e. crank through the epsilon-delta algebra. ## Flipping Zero and Infinity Infinity, when used in a limit, means “grows without stopping”. The symbol ∞ is no more a number than the sentence “grows without stopping” or “my supply of underpants is dwindling”. They are concepts, not numbers (for our level of math, Aleph me alone). When using ∞ in a limit, we’re asking: “As x grows without stopping, can we make a prediction that remains accurate?”. If there is a limit, it means the predicted value is always confirmed, no matter how far out we look. But, I still don’t like infinity because I can’t see it. But I can see zero. With limits, you can rewrite $\displaystyle{\lim_{x \to \infty}}$ as $\displaystyle{\lim_{\frac{1}{x} \to 0}}$ You can get sneaky and define y = 1/x, replace items in your formula, and then use $\displaystyle{\lim_{y \to 0^+}}$ so it looks like a normal problem again! (Note from Tim in the comments: the limit is coming from the right, since x was going to positive infinity). I prefer this arrangement, because I can see the location we’re narrowing in on (we’re always running out of paper when charting the infinite version). ## Why Aren’t Limits Used More Often? Imagine a kid who figured out that “Putting a zero on the end” made a number 10x larger. Have 5? Write down “5” then “0” or 50. Have 100? Make it 1000. And so on. He didn’t figure out why multiplication works, why this rule is justified… but, you’ve gotta admit, he sure can multiply by 10. Sure, there are some edge cases (Would 0 become “00”?), but it works pretty well. The rules of calculus were discovered informally (by modern standards). Newton deduced that “The derivative of x3 is 3x2” without rigorous justification. Yet engines whirl and airplanes fly based on his unofficial results. The calculus pedagogy mistake is creating a roadblock like “You must know Limits™ before appreciating calculus”, when it’s clear the inventors of calculus didn’t. I’d prefer this progression: • Calculus asks seemingly impossible questions: When can rectangles measure a curve? Can we detect instantaneous change? • Limits give a strategy for answering “impossible” questions (“If you can make a prediction that withstands infinite scrutiny, we’ll say it’s ok.”) • They’re a great tag-team: Calculus explores, limits verify. We memorize shortcuts for the results we verified with limits (frac(d)(dx) x3 = 3x2), just like we memorize shortcuts for the rules we verified with multiplication (adding a zero means times 10). But it’s still nice to know why the shortcuts are justified. Limits aren’t the only tool for checking the answers to impossible questions; infinitesimals work too. The key is understanding what we’re trying to predict, then learning the rules of making predictions. Happy math. # Understanding Bayes Theorem With Ratios My first intuition about Bayes Theorem was “take evidence and account for false positives”. Does a lab result mean you’re sick? Well, how rare is the disease, and how often do healthy people test positive? Misleading signals must be considered. This helped me muddle through practice problems, but I couldn’t think with Bayes. The big obstacles: Percentages are hard to reason with. Odds compare the relative frequency of scenarios (A:B) while percentages use a part-to-whole “global scenario” [A/(A+B)]. A coin has equal odds (1:1) or a 50% chance of heads. Great. What happens when heads are 18x more likely? Well, the odds are 18:1, can you rattle off the decimal percentage? (I’ll wait…) Odds require less computation, so let’s start with them. Equations miss the big picture. Here’s Bayes Theorem, as typically presented: $\displaystyle{\displaystyle{\Pr(\mathrm{A}|\mathrm{X}) = \frac{\Pr(\mathrm{X}|\mathrm{A})\Pr(\mathrm{A})}{\Pr(\mathrm{X|A})\Pr(A)+ \Pr(\mathrm{X|\sim A})\Pr(\sim A)}}}$ It reads right-to-left, with a mess of conditional probabilities. How about this version: original odds * evidence adjustment = new odds  Bayes is about starting with a guess (1:3 odds for rain:sunshine), taking evidence (it’s July in the Sahara, sunshine 1000x more likely), and updating your guess (1:3000 chance of rain:sunshine). The “evidence adjustment” is how much better, or worse, we feel about our odds now that we have extra information (if it was December in Seattle, you might say rain was 1000x as likely). Let’s start with ratios and sneak up to the complex version. ## Caveman Statistician Og Og just finished his CaveD program, and runs statistical research for his tribe: • He saw 50 deer and 5 bears overall (50:5 odds) • At night, he saw 10 deer and 4 bears (10:4 odds) What can he deduce? Well, original odds * evidence adjustment = new odds  or evidence adjustment = new odds / original odds  At night, he realizes deer are 1/4 as likely as they were previously: 10:4 / 50:5 = 2.5 / 10 = 1/4  (Put another way, bears are 4x as likely at night) Let’s cover ratios a bit. A:B describes how much A we get for every B (imagine miles per gallon as the ratio miles:gallon). Compare values with division: going from 25:1 to 50:1 means you doubled your efficiency (50/25 = 2). Similarly, we just discovered how our “deers per bear” amount changed. Og happily continues his research: • By the river, bears are 20x more likely (he saw 2 deer and 4 bears, so 2:4 / 50:5 = 1:20) • In winter, deer are 3x as likely (30 deer and 1 bear, 30:1 / 50:5 = 3:1) He takes a scenario, compares it to the baseline, and computes the evidence adjustment. Caveman Clarence subscribes to Og’s journal, and wants to apply the findings to his forest (where deer:bears are 25:1). Suppose Clarence hears an animal approaching: • His general estimate is 25:1 odds of deer:bear • It’s at night, with bears 4x as likely => 25:4 • It’s by the river, with bears 20x as likely => 25:80 • It’s in the winter, with deer 3x more likely => 75:80 Clarence guesses “bear” with near-even odds (75:80) and tiptoes out of there. That’s Bayes. In fancy language: • Start with a prior probability, the general odds before evidence • Collect evidence, and determine how much it changes the odds • Compute the posterior probability, the odds after updating ## Bayesian Spam Filter Let’s build a spam filter based on Og’s Bayesian Bear Detector. First, grab a collection of regular and spam email. Record how often a word appears in each:  spam normal hello 3 3 darling 1 5 buy 3 2 viagra 3 0 ...  (“hello” appears equally, but “buy” skews toward spam) We compute odds just like before. Let’s assume incoming email has 9:1 chance of spam, and we see “hello darling”: • A generic message has 9:1 odds of spam:regular • Adjust for “hello” => keep the 9:1 odds (“hello” is equally-likely in both sets) • Adjust for “darling” => 9:5 odds (“darling” appears 5x as often in normal emails) • Final chances => 9:5 odds of spam We’re learning towards spam (9:5 odds). However, it’s less spammy than our starting odds (9:1), so we let it through. Now consider a message like “buy viagra”: • Prior belief: 9:1 chance of spam • Adjust for “buy”: 27:2 (3:2 adjustment towards spam) • Adjust for (“viagra”): …uh oh! “Viagra” never appeared in a normal message. Is it a guarantee of spam? Probably not: we should intelligently adjust for new evidence. Let’s assume there’s a regular email, somewhere, with that word, and make the “viagra” odds 3:1. Our chances become 27:2 * 3:1 = 81:2. Now we’re geting somewhere! Our initial 9:1 guess shifts to 81:2. Now is it spam? Well, how horrible is a false positive? 81:2 odds imply for every 81 spam messages like this, we’ll incorrectly block 2 normal emails. That ratio might be too painful. With more evidence (more words or other characteristics), we might wait for 1000:1 odds before calling a message spam. ## Exploring Bayes Theorem We can check our intuition by seeing if we naturally ask leading questions: • Is evidence truly independent? Are there links between animal behavior at night and in the winter, or words that appear together? Sure. We “naively” assume evidence is independent (and yet, in our bumbling, create effective filters anyway). • How much evidence is enough? Is seeing 2 deer & 1 bear the same 2:1 evidence adjustment as 200 deer and 100 bears? • How accurate were the starting odds in the first place? Prior beliefs change everything. (“A Bayesian is one who, vaguely expecting a horse, and catching a glimpse of a donkey, strongly believes he has seen a mule.”) • Do absolute probabilities matter? We usually need the most-likely theory (“Deer or bear?”), not the global chance of this scenario (“What’s the probability of deers at night in the winter by the river vs. bears at night in the winter by the river?”). Many Bayesian calculations ignore the global probabilities, which cancel when dividing, and essentially use an odds-centric approach. • Can our filter be tricked? A spam message might add chunks of normal text to appear innocuous and “poison” the filter. You’ve probably seen this yourself. • What evidence should we use? Let the data speak. Email might have dozens of characteristics (time of day, message headers, country of origin, HTML tags…). Give every characteristic a likelihood factor and let Bayes sort ’em out. ## Thinking With Ratios and Percentages The ratio and percentage approaches ask slightly different questions: Ratios: Given the odds of each outcome, how does evidence adjust them? The evidence adjustment just skews the initial odds, piece-by-piece. Percentages: What is the chance of an outcome after supporting evidence is found? In the percentage case, • “% Bears” is the overall chance of a bear appearing anywhere • “% Bears Going to River” is how likely a bear is to trigger the “river” data point • “% Bear at River” is the combined chance of having a bear, and it going to the river. In stats terms, P(event and evidence) = P(event) * P(event implies evidence) = P(event) * P(evidence|event). I see conditional probabilities as “Chances that X implies Y” not the twisted “Chances of Y, given X happened”. Let’s redo the original cancer example: • 1% of the population has cancer • 9.6% of healthy people test positive, 80% of people with cancer do If you see a positive result, what’s the chance of cancer? Ratio Approach: • Cancer:Healthy ratio is 1:99 • Evidence adjustment: 80/100 : 9.6/100 = 80:9.6 (80% of sick people are “at the river”, and 9.6% of healthy people are). • Final odds: 1:99 * 80:9.6 = 80:950.4 (roughly 1:12 odds of cancer, ~7.7% chance) The intuition: the initial 1:99 odds are pretty skewed. Even with a 8.3x (80:9.6) boost from a positive test result, cancer remains unlikely. Percentage Approach: • Cancer chance is 1% • Chance of true positive = 1% * 80% = .008 • Chance of false positive = 99% * 9.6% = .09504 • Chance of having cancer = .008 / (.008 + .09504) = 7.7% When written with percentages, we start from absolute chances. There’s a global 0.8% chance of finding a sick patient with a positive result, and a global 9.504% chance of a healthy patient with a positive result. We then compute the chance these global percentages indicate something useful. Let the approaches be complements: percentages for a bird’s-eye view, and ratios for seeing how individual odds are adjusted. We’ll save the myriad other interpretations for another day. Happy math. # An Interactive Guide To The Fourier Transform The Fourier Transform is one of deepest insights ever made. Unfortunately, the meaning is buried within dense equations: $\displaystyle{X_k = \sum_{n=0}^{N-1} x_n \cdot e^{-i 2 \pi k n / N}}$ $\displaystyle{x_n = \frac{1}{N} \sum_{k=0}^{N-1} X_k \cdot e^{i 2 \pi k n / N}}$ Yikes. Rather than jumping into the symbols, let's experience the key idea firsthand. Here's a plain-English metaphor: • What does the Fourier Transform do? Given a smoothie, it finds the recipe. • How? Run the smoothie through filters to extract each ingredient. • Why? Recipes are easier to analyze, compare, and modify than the smoothie itself. • How do we get the smoothie back? Blend the ingredients. Here's the "math English" version of the above: • The Fourier Transform takes a time-based pattern, measures every possible cycle, and returns the overall "cycle recipe" (the strength, offset, & rotation speed for every cycle that was found). Time for the equations? No! Let's get our hands dirty and experience how any pattern can be built with cycles, with live simulations. If all goes well, we'll have an aha! moment and intuitively realize why the Fourier Transform is possible. We'll save the detailed math analysis for the follow-up. This isn't a force-march through the equations, it's the casual stroll I wish I had. Onward! ## From Smoothie to Recipe A math transformation is a change of perspective. We change our notion of quantity from "single items" (lines in the sand, tally system) to "groups of 10" (decimal) depending on what we're counting. Scoring a game? Tally it up. Multiplying? Decimals, please. The Fourier Transform changes our perspective from consumer to producer, turning What did I see? into How was it made? In other words: given a smoothie, let's find the recipe. Why? Well, recipes are great descriptions of drinks. You wouldn't share a drop-by-drop analysis, you'd say "I had an orange/banana smoothie". A recipe is more easily categorized, compared, and modified than the object itself. So... given a smoothie, how do we find the recipe? Well, imagine you had a few filters lying around: • Pour through the "banana" filter. 1 oz of bananas are extracted. • Pour through the "orange" filter. 2 oz of oranges. • Pour through the "milk" filter. 3 oz of milk. • Pour through the "water" filter. 3 oz of water. We can reverse-engineer the recipe by filtering each ingredient. The catch? • Filters must be independent. The banana filter needs to capture bananas, and nothing else. Adding more oranges should never affect the banana reading. • Filters must be complete. We won't get the real recipe if we leave out a filter ("There were mangoes too!"). Our collection of filters must catch every last ingredient. • Ingredients must be combine-able. Smoothies can be separated and re-combined without issue (A cookie? Not so much. Who wants crumbs?). The ingredients, when separated and combined in any order, must make the same result. ## See The World As Cycles The Fourier Transform takes a specific viewpoint: What if any signal could be filtered into a bunch of circular paths? Whoa. This concept is mind-blowing, and poor Joseph Fourier had his idea rejected at first. (Really Joe, even a staircase pattern can be made from circles?) And despite decades of debate in the math community, we expect students to internalize the idea without issue. Ugh. Let's walk through the intuition. The Fourier Transform finds the recipe for a signal, like our smoothie process: • Start with a time-based signal • Apply filters to measure each possible "circular ingredient" • Collect the full recipe, listing the amount of each "circular ingredient" Stop. Here's where most tutorials excitedly throw engineering applications at your face. Don't get scared; think of the examples as "Wow, we're finally seeing the source code (DNA) behind previously confusing ideas". • If earthquake vibrations can be separated into "ingredients" (vibrations of different speeds & strengths), buildings can be designed to avoid interacting with the strongest ones. • If sound waves can be separated into ingredients (bass and treble frequencies), we can boost the parts we care about, and hide the ones we don't. The crackle of random noise can be removed. Maybe similar "sound recipes" can be compared (music recognition services compare recipes, not the raw audio clips). • If computer data can be represented with oscillating patterns, perhaps the least-important ones can be ignored. This "lossy compression" can drastically shrink file sizes (and why JPEG and MP3 files are much smaller than raw .bmp or .wav files). • If a radio wave is our signal, we can use filters to listen to a particular channel. In the smoothie world, imagine each person paid attention to a different ingredient: Adam looks for apples, Bob looks for bananas, and Charlie gets cauliflower (sorry bud). The Fourier Transform is useful in engineering, sure, but it's a metaphor about finding the root causes behind an observed effect. ## Think With Circles, Not Just Sinusoids One of my giant confusions was separating the definitions of "sinusoid" and "circle". • A "sinusoid" is a specific back-and-forth pattern (a sine or cosine wave), and 99% of the time, it refers to motion in one dimension. • A "circle" is a round, 2d pattern you probably know. If you enjoy using 10-dollar words to describe 10-cent ideas, you might call a circular path a "complex sinusoid". Labeling a circular path as a "complex sinusoid" is like describing a word as a "multi-letter". You zoomed into the wrong level of detail. Words are about concepts, not the letters they can be split into! The Fourier Transform is about circular paths (not 1-d sinusoids) and Euler's formula is a clever way to generate one: Must we use imaginary exponents to move in a circle? Nope. But it's convenient and compact. And sure, we can describe our path as coordinated motion in two dimensions (real and imaginary), but don't forget the big picture: we're just moving in a circle. ## Following Circular Paths Let's say we're chatting on the phone and, like usual, I want us to draw the same circle simultaneously. (You promised!) What should I say? • How big is the circle? (Amplitude, i.e. size of radius) • How fast do we draw it? (Frequency. 1 circle/second is a frequency of 1 Hertz (Hz) or 2*pi radians/sec) • Where do we start? (Phase angle, where 0 degrees is the x-axis) I could say "2-inch radius, start at 45 degrees, 1 circle per second, go!". After half a second, we should each be pointing to: starting point + amount traveled = 45 + 180 = 225 degrees (on a 2-inch circle). Every circular path needs a size, speed, and starting angle (amplitude/frequency/phase). We can even combine paths: imagine tiny motorcars, driving in circles at different speeds. The combined position of all the cycles is our signal, just like the combined flavor of all the ingredients is our smoothie. Here's a simulation of a basic circular path: (Based on this animation, here's the source code. Modern browser required. Click the graph to pause/unpause.) The magnitude of each cycle is listed in order, starting at 0Hz. Cycles [0 1] means • 0 strength for the 0Hz cycle (0Hz = a constant cycle, stuck on the x-axis at zero degrees) • 1 strength for the 1Hz cycle (completes 1 cycle per time interval) Now the tricky part: • The blue graph measures the real part of the cycle. Another lovely math confusion: the real axis of the circle, which is usually horizontal, has its magnitude shown on the vertical axis. You can mentally rotate the circle 90 degrees if you like. • The time points are spaced at the fastest frequency. A 1Hz signal needs 2 time points for a start and stop (a single data point doesn't have a frequency). The time values [1 -1] shows the amplitude at these equally-spaced intervals. With me? [0 1] is a pure 1Hz cycle. Now let's add a 2Hz cycle to the mix. [0 1 1] means "Nothing at 0Hz, 1Hz of strength 1, 2Hz of strength 1": Whoa. The little motorcars are getting wild: the green lines are the 1Hz and 2Hz cycles, and the blue line is the combined result. Try toggling the green checkbox to see the final result clearly. The combined "flavor" is a sway that starts at the max and dips low for the rest of the interval. The yellow dots are when we actually measure the signal. With 3 cycles defined (0Hz, 1Hz, 2Hz), each dot is 1/3 of the way through the signal. In this case, cycles [0 1 1] generate the time values [2 -1 -1], which starts at the max (2) and dips low (-1). Oh! We can't forget phase, the starting angle! Use magnitude:angle to set the phase. So [0 1:45] is a 1Hz cycle that starts at 45 degrees: This is a shifted version of [0 1]. On the time side we get [.7 -.7] instead of [1 -1], because our cycle isn't exactly lined up with our measuring intervals, which are still at the halfway point (this could be desired!). The Fourier Transform finds the set of cycle speeds, strengths and phases to match any time signal. Our signal becomes an abstract notion that we consider as "observations in the time domain" or "ingredients in the frequency domain". Enough talk: try it out! In the simulator, type any time or cycle pattern you'd like to see. If it's time points, you'll get a collection of cycles (that combine into a "wave") that matches your desired points. But… doesn't the combined wave have strange values between the yellow time intervals? Sure. But who's to say whether a signal travels in straight lines, or curves, or zips into other dimensions when we aren't measuring it? It behaves exactly as we need at the equally-spaced moments we asked for. ## Making A Spike In Time Can we make a spike in time, like (4 0 0 0), using cycles? I'll use parentheses () for a sequence of time points, and brackets [] for a sequence of cycles. Although the spike seems boring to us time-dwellers (one data point, that's it?), think about the complexity in the cycle world. Our cycle ingredients must start aligned (at the max value, 4) and then "explode outwards", each cycle with partners that cancel it in the future. Every remaining point is zero, which is a tricky balance with multiple cycles running around (we can't just "turn them off"). Let's walk through each time point: • At time 0, the first instant, every cycle ingredient is at its max. Ignoring the other time points, (4 ? ? ?) can be made from 4 cycles (0Hz 1Hz 2Hz 3Hz), each with a magnitude of 1 and phase of 0 (i.e., 1 + 1 + 1 + 1 = 4). • At every future point (t = 1, 2, 3), the sum of all cycles must cancel. Here's the trick: when two cycles are on opposites sides of the circle (North & South, East & West, etc.) their combined position is zero (3 cycles can cancel if they're spread evenly at 0, 120, and 240 degrees). Imagine a constellation of points moving around the circle. Here's the position of each cycle at every instant: Time 0 1 2 3 ------------ 0Hz: 0 0 0 0 1Hz: 0 1 2 3 2Hz: 0 2 0 2 3Hz: 0 3 2 1  Notice how the the 3Hz cycle starts at 0, gets to position 3, then position "6" (with only 4 positions, 6 modulo 4 = 2), then position "9" (9 modulo 4 = 1). When our cycle is 4 units long, cycle speeds a half-cycle apart (2 units) will either be lined up (difference of 0, 4, 8…) or on opposite sides (difference of 2, 6, 10…). OK. Let's drill into each time point: • Time 0: All cycles at their max (total of 4) • Time 1: 1Hz and 3Hz cancel (positions 1 & 3 are opposites), 0Hz and 2Hz cancel as well. The net is 0. • Time 2: 0Hz and 2Hz line up at position 0, while 1Hz and 3Hz line up at position 2 (the opposite side). The total is still 0. • Time 3: 0Hz and 2Hz cancel. 1Hz and 3Hz cancel. • Time 4 (repeat of t=0): All cycles line up. The trick is having individual speeds cancel (0Hz vs 2Hz, 1Hz vs 3Hz), or having the lined-up pairs cancel (0Hz + 2Hz vs 1Hz + 3Hz). When every cycle has equal power and 0 phase, we start aligned and cancel afterwards. (I don't have a nice proof yet -- any takers? -- but you can see it yourself. Try [1 1], [1 1 1], [1 1 1 1] and notice the signals we generate: (2 0), (3 0 0), (4 0 0 0)). In my head, I consider these signals "time spikes": they have a burst of activity for a single instant, and are zero otherwise (the fancy name is a delta function.) Here's how I visualize the initial alignment, followed by a net cancellation: ## Moving The Time Spike Not everything happens at t=0. Can we change our spike to (0 4 0 0)? It seems the cycle ingredients should be similar to (4 0 0 0), but the cycles must align at t=1 (one second in the future). Here's where phase comes in. Imagine a race with 4 runners. Normal races have everyone lined up at the starting line, the (4 0 0 0) time pattern. Boring. What if we want everyone to finish at the same time? Easy. Just move people forward or backwards by the appropriate distance. Maybe granny can start 2 feet in front of the finish line, Usain Bolt can start 100m back, and they can cross the tape holding hands. Phase shifts, the starting angle, are delays in the cycle universe. Here's how we adjust the starting position to delay every cycle 1 second: • A 0Hz cycle doesn't move, so it's already aligned • A 1Hz cycle goes 1 revolution in the entire 4 seconds, so a 1-second delay is a quarter-turn. Phase shift it 90 degrees backwards (-90) and it gets to phase=0, the max value, at t=1. • A 2Hz cycle is twice as fast, so give it twice the angle to cover (-180 or 180 phase shift -- it's across the circle, either way). • A 3Hz cycle is 3x as fast, so give it 3x the distance to move (-270 or +90 phase shift) If time points (4 0 0 0) are made from cycles [1 1 1 1], then time points (0 4 0 0) are made from [1 1:-90 1:180 1:90]. (Note: I'm using "1Hz", but I mean "1 cycle over the entire time period"). Whoa -- we're working out the cycles in our head! The interference visualization is similar, except the alignment is at t=1. Test your intuition: Can you make (0 0 4 0), i.e. a 2-second delay? 0Hz has no phase. 1Hz has 180 degrees, 2Hz has 360 (aka 0), and 3Hz has 540 (aka 180), so it's [1 1:180 1 1:180]. ## Discovering The Full Transform The big insight: our signal is just a bunch of time spikes! If we merge the recipes for each time spike, we should get the recipe for the full signal. The Fourier Transform builds the recipe frequency-by-frequency: • Separate the full signal (a b c d) into "time spikes": (a 0 0 0) (0 b 0 0) (0 0 c 0) (0 0 0 d) • For any frequency (like 2Hz), the tentative recipe is "a/4 + b/4 + c/4 + d/4" (the strength of each spike is split among all frequencies) • Wait! We need to offset each spike with a phase delay (the angle for a "1 second delay" depends on the frequency). • Actual recipe for a frequency = a/4 (no offset) + b/4 (1 second offset) + c/4 (2 second offset) + d/4 (3 second offset). We can then loop through every frequency to get the full transform. Here's the conversion from "math English" to full math: A few notes: • N = number of time samples we have • n = current sample we're considering (0 .. N-1) • xn = value of the signal at time n • k = current frequency we're considering (0 Hertz up to N-1 Hertz) • Xk = amount of frequency k in the signal (amplitude and phase, a complex number) • The 1/N factor is usually moved to the reverse transform (going from frequencies back to time). This is allowed, though I prefer 1/N in the forward transform since it gives the actual sizes for the time spikes. You can get wild and even use 1/sqrt(N) on both transforms (going forward and back still has the 1/N factor). • n/N is the percent of the time we've gone through. 2 * pi * k is our speed in radians / sec. e^-ix is our backwards-moving circular path. The combination is how far we've moved, for this speed and time. • The raw equations for the Fourier Transform just say "add the complex numbers". Many programming languages cannot handle complex numbers directly, so you convert everything to rectangular coordinates and add those. ## Onward This was my most challenging article yet. The Fourier Transform has several flavors (discrete/continuous/finite/infinite), covers deep math (Dirac delta functions), and it's easy to get lost in details. I was constantly bumping into the edge of my knowledge. But there's always simple analogies out there -- I refuse to think otherwise. Whether it's a smoothie or Usain Bolt & Granny crossing the finish line, take a simple understanding and refine it. The analogy is flawed, and that's ok: it's a raft to use, and leave behind once we cross the river. I realized how feeble my own understanding was when I couldn't work out the transform of (1 0 0 0) in my head. For me, it was like saying I knew addition but, gee whiz, I'm not sure what "1 + 1 + 1 + 1" would be. Why not? Shouldn't we have an intuition for the simplest of operations? That discomfort led me around the web to build my intuition. In addition to the references in the article, I'd like to thank: Today's goal was to experience the Fourier Transform. We'll save the advanced analysis for next time. Happy math. ## Appendix: Projecting Onto Cycles Stuart Riffle has a great interpretation of the Fourier Transform: Imagine spinning your signal in a centrifuge and checking for a bias. I have a correction: we must spin backwards (the exponent in the equation above needs a negative sign). You already know why: we need a phase delay so spikes appear in the future. ## Appendix: Another Awesome Visualization Lucas Vieira, author of excellent Wikipedia animations, was inspired to make this interactive animation: Fourier Toy - Click to Open (Detailed list of control options) The Fourier Transform is about cycles added to cycles added to cycles. Try making a "time spike" by setting a strength of 1 for every component (press Enter after inputting each number). Fun fact: with enough terms, you can draw any shape, even Homer Simpson. ## Appendix: Using the code All the code and examples are open source (MIT licensed, do what you like). # An Intuitive Guide to Linear Algebra Despite two linear algebra classes, my knowledge consisted of “Matrices, determinants, eigen something something”. Why? Well, let’s try this course format: • Name the course Linear Algebra but focus on things called matrices and vectors • Teach concepts like Row/Column order with mnemonics instead of explaining the reasoning • Favor abstract examples (2d vectors! 3d vectors!) and avoid real-world topics until the final week The survivors are physicists, graphics programmers and other masochists. We missed the key insight: Linear algebra gives you mini-spreadsheets for your math equations. We can take a table of data (a matrix) and create updated tables from the original. It’s the power of a spreadsheet written as an equation. Here’s the linear algebra introduction I wish I had, with a real-world stock market example. ## What’s in a name? “Algebra” means, roughly, “relationships”. Grade-school algebra explores the relationship between unknown numbers. Without knowing x and y, we can still work out that (x + y)2 = x2 + 2xy + y2. “Linear Algebra” means, roughly, “line-like relationships”. Let’s clarify a bit. Straight lines are predictable. Imagine a rooftop: move forward 3 horizontal feet (relative to the ground) and you might rise 1 foot in elevation (The slope! Rise/run = 1/3). Move forward 6 feet, and you’d expect a rise of 2 feet. Contrast this with climbing a dome: each horizontal foot forward raises you a different amount. Lines are nice and predictable: • If 3 feet forward has a 1-foot rise, then going 10x as far should give a 10x rise (30 feet forward is a 10-foot rise) • If 3 feet forward has a 1-foot rise, and 6 feet has a 2-foot rise, then (3 + 6) feet should have a (1 + 2) foot rise In math terms, an operation F is linear if scaling inputs scales the output, and adding inputs adds the outputs: \begin{align*} F(ax) &= a \cdot F(x) \\ F(x + y) &= F(x) + F(y) \end{align*} In our example, F(x) calculates the rise when moving forward x feet, and the properties hold: $\displaystyle{F(10 \cdot 3) = 10 \cdot F(3) = 10}$ $\displaystyle{F(3+6) = F(3) + F(6) = 3}$ ## Linear Operations An operation is a calculation based on some inputs. Which operations are linear and predictable? Multiplication, it seems. Exponents (F(x) = x2) aren’t predictable: 102 is 100, but 202 is 400. We doubled the input but quadrupled the output. Surprisingly, regular addition isn’t linear either. Consider the “add three” function: \begin{align*} F(x) &= x + 3 \\ F(10) &= 13 \\ F(20) &= 23 \end{align*} We doubled the input and did not double the output. (Yes, F(x) = x + 3 happens to be the equation for an offset line, but it’s still not “linear” because F(10) isn’t 10 * F(1). Fun.) Our only hope is to multiply by a constant: F(x) = ax (in our roof example, a=1/3). However, we can still combine linear operations to make a new linear operation: $\displaystyle{G(x, y, z) = F(x + y + z) = F(x) + F(y) + F(z)}$ G is made of 3 linear subpieces: if we double the inputs, we’ll double the output. We have “mini arithmetic”: multiply inputs by a constant, and add the results. It’s actually useful because we can split inputs apart, analyze them individually, and combine the results: $\displaystyle{G(x,y,z) = G(x,0,0) + G(0,y,0) + G(0,0,z)}$ If the inputs interacted like exponents, we couldn’t separate them — we’d have to analyze everything at once. ## Organizing Inputs and Operations Most courses hit you in the face with the details of a matrix. “Ok kids, let’s learn to speak. Select a subject, verb and object. Next, conjugate the verb. Then, add the prepositions…” No! Grammar is not the focus. What’s the key idea? • We have a bunch of inputs to track • We have predictable, linear operations to perform (our “mini-arithmetic”) • We generate a result, perhaps transforming it again Ok. First, how should we track a bunch of inputs? How about a list: x y z  Not bad. We could write it (x, y, z) too — hang onto that thought. Next, how should we track our operations? Remember, we only have “mini arithmetic”: multiplications, with a final addition. If our operation F behaves like this: $\displaystyle{F(x, y, z) = 3x + 4y + 5z}$ We could abbreviate the entire function as (3, 4, 5). We know to multiply the first input by the first value, the second input by the second value, etc., and add the result. Only need the first input? $\displaystyle{G(x, y, z) = 3x + 0y + 0z = (3, 0, 0)}$ Let’s spice it up: how should we handle multiple sets of inputs? Let’s say we want to run operation F on both (a, b, c) and (x, y, z). We could try this: $\displaystyle{F(a, b, c, x, y, z) = ?}$ But it won’t work: F expects 3 inputs, not 6. We should separate the inputs into groups: 1st Input 2nd Input -------------------- a x b y c z  Much neater. And how could we run the same input through several operations? Have a row for each operation: F: 3 4 5 G: 3 0 0  Neat. We’re getting organized: inputs in vertical columns, operations in horizontal rows. ## Visualizing The Matrix Words aren’t enough. Here’s how I visualize inputs, operations, and outputs: Imagine “pouring” each input along each operation: As an input passes an operation, it creates an output item. In our example, the input (a, b, c) goes against operation F and outputs 3a + 4b + 5c. It goes against operation G and outputs 3a + 0 + 0. Time for the red pill. A matrix is a shorthand for our diagrams: $\text{I}\text{nputs} = A = \begin{bmatrix} \text{i}\text{nput1}&\text{i}\text{nput2}\end{bmatrix} = \begin{bmatrix}a & x\\b & y\\c & z\end{bmatrix}$ $\text{Operations} = M = \begin{bmatrix}\text{operation1}\\ \text{operation2}\end{bmatrix} = \begin{bmatrix}3 & 4 & 5\\3 & 0 & 0\end{bmatrix}$ A matrix is a single variable representing a spreadsheet of inputs or operations. Trickiness #1: The reading order Instead of an input => matrix => output flow, we use function notation, like y = f(x) or f(x) = y. We usually write a matrix with a capital letter (F), and a single input column with lowercase (x). Because we have several inputs (A) and outputs (B), they’re considered matrices too: $\displaystyle{MA = B}$ $\begin{bmatrix}3 & 4 & 5\\3 & 0 & 0\end{bmatrix} \begin{bmatrix}a & x\\b & y\\c & z\end{bmatrix} = \begin{bmatrix}3a + 4b + 5c & 3x + 4y + 5z\\ 3a & 3x\end{bmatrix}$ Trickiness #2: The numbering Matrix size is measured as RxC: row count, then column count, and abbreviated “m x n” (I hear ya, “r x c” would be easier to remember). Items in the matrix are referenced the same way: aij is the ith row and jth column (I hear ya, “i” and “j” are easily confused on a chalkboard). Mnemonics are ok with context, and here’s what I use: • RC, like Roman Centurion or RC Cola • Use an “L” shape. Count down the L, then across Why does RC ordering make sense? Our operations matrix is 2×3 and our input matrix is 3×2. Writing them together: [Operation Matrix] [Input Matrix] [operation count x operation size] [input size x input count] [m x n] [p x q] = [m x q] [2 x 3] [3 x 2] = [2 x 2]  Notice the matrices touch at the “size of operation” and “size of input” (n = p). They should match! If our inputs have 3 components, our operations should expect 3 items. In fact, we can only multiply matrices when n = p. The output matrix has m operation rows for each input, and q inputs, giving a “m x q” matrix. ## Fancier Operations Let’s get comfortable with operations. Assuming 3 inputs, we can whip up a few 1-operation matrices: • Adder: [1 1 1] • Averager: [1/3 1/3 1/3] The “Adder” is just a + b + c. The “Averager” is similar: (a + b + c)/3 = a/3 + b/3 + c/3. Try these 1-liners: • First-input only: [1 0 0] • Second-input only: [0 1 0] • Third-input only: [0 0 1] And if we merge them into a single matrix: [1 0 0] [0 1 0] [0 0 1]  Whoa — it’s the “identity matrix”, which copies 3 inputs to 3 outputs, unchanged. How about this guy? [1 0 0] [0 0 1] [0 1 0]  He reorders the inputs: (x, y, z) becomes (x, z, y). And this one? [2 0 0] [0 2 0] [0 0 2]  He’s an input doubler. We could rewrite him to 2*I (the identity matrix) if we were so inclined. And yes, when we decide to treat inputs as vector coordinates, the operations matrix will transform our vectors. Here’s a few examples: • Scale: make all inputs bigger/smaller • Skew: make certain inputs bigger/smaller • Flip: make inputs negative • Rotate: make new coordinates based on old ones (East becomes North, North becomes West, etc.) These are geometric interpretations of multiplication, and how to warp a vector space. Just remember that vectors are examples of data to modify. ## A Non-Vector Example: Stock Market Portfolios Let’s practice linear algebra in the real world: • Input data: stock portfolios with dollars in Apple, Google and Microsoft stock • Operations: the changes in company values after a news event • Output: updated portfolios And a bonus output: let’s make a new portfolio listing the net profit/loss from the event. Normally, we’d track this in a spreadsheet. Let’s learn to think with linear algebra: • The input vector could be (Apple, $Google,$Microsoft), showing the dollars in each stock. (Oh! These dollar values could come from another matrix that multiplied the number of shares by their price. Fancy that!)

• The 4 output operations should be: Update Apple value, Update Google value, Update Microsoft value, Compute Profit

Visualize the problem. Imagine running through each operation:

The key is understanding why we’re setting up the matrix like this, not blindly crunching numbers.

Got it? Let’s introduce the scenario.

Suppose a secret iDevice is launched: Apple jumps 20%, Google drops 5%, and Microsoft stays the same. We want to adjust each stock value, using something similar to the identity matrix:

New Apple     [1.2  0      0]
New Microsoft [0    0      1]


The new Apple value is the original, increased by 20% (Google = 5% decrease, Microsoft = no change).

Oh wait! We need the overall profit:

Total change = (.20 * Apple) + (-.05 * Google) + (0 * Microsoft)

Our final operations matrix:

New Apple       [1.2  0      0]
New Microsoft   [0    0      1]
Total Profit    [.20  -.05   0]


Making sense? Three inputs enter, four outputs leave. The first three operations are a “modified copy” and the last brings the changes together.

Now let’s feed in the portfolios for Alice ($1000,$1000, $1000) and Bob ($500, $2000,$500). We can crunch the numbers by hand, or use a Wolfram Alpha (calculation):

(Note: Inputs should be in columns, but it’s easier to type rows. The Transpose operation, indicated by t (tau), converts rows to columns.)

The final numbers: Alice has $1200 in AAPL,$950 in GOOG, $1000 in MSFT, with a net profit of$150. Bob has $600 in AAPL,$1900 in GOOG, and $500 in MSFT, with a net profit of$0.

What’s happening? We’re doing math with our own spreadsheet. Linear algebra emerged in the 1800s yet spreadsheets were invented in the 1980s. I blame the gap on poor linear algebra education.

## Historical Notes: Solving Simultaneous equations

An early use of tables of numbers (not yet a “matrix”) was bookkeeping for linear systems:

\begin{align*} x + 2y + 3z &= 3 \\ 2x + 3y + 1z &= -10 \\ 5x + -y + 2z &= 14 \end{align*}

becomes

$\begin{bmatrix}1 & 2 & 3\\2 & 3 & 1\\5 & -1 & 2\end{bmatrix} \begin{bmatrix}x \\y \\ z \end{bmatrix} = \begin{bmatrix}3 \\ -10 \\ 14 \end{bmatrix}$

We can avoid hand cramps by adding/subtracting rows in the matrix and output, vs. rewriting the full equations. As the matrix evolves into the identity matrix, the values of x, y and z are revealed on the output side.

This process, called Gauss-Jordan elimination, saves time. However, linear algebra is mainly about matrix transformations, not solving large sets of equations (it’d be like using Excel for your shopping list).

## Terminology, Determinants, and Eigenstuff

Words have technical categories to describe their use (nouns, verbs, adjectives). Matrices can be similarly subdivided.

Descriptions like “upper-triangular”, “symmetric”, “diagonal” are the shape of the matrix, and influence their transformations.

The determinant is the “size” of the output transformation. If the input was a unit vector (representing area or volume of 1), the determinant is the size of the transformed area or volume. A determinant of 0 means matrix is “destructive” and cannot be reversed (similar to multiplying by zero: information was lost).

The eigenvector and eigenvalue represent the “axes” of the transformation.

Consider spinning a globe: every location faces a new direction, except the poles.

An “eigenvector” is an input that doesn’t change direction when it’s run through the matrix (it points “along the axis”). And although the direction doesn’t change, the size might. The eigenvalue is the amount the eigenvector is scaled up or down when going through the matrix.

(My intuition here is weak, and I’d like to explore more. Here’s a nice diagram and video.)

## Matrices As Inputs

A funky thought: we can treat the operations matrix as inputs!

Think of a recipe as a list of commands (Add 2 cups of sugar, 3 cups of flour…).

What if we want the metric version? Take the instructions, treat them like text, and convert the units. The recipe is “input” to modify. When we’re done, we can follow the instructions again.

An operations matrix is similar: commands to modify. Applying one operations matrix to another gives a new operations matrix that applies both transformations, in order.

If N is “adjust for portfolio for news” and T is “adjust portfolio for taxes” then applying both:

TN = X

means “Create matrix X, which first adjusts for news, and then adjusts for taxes”. Whoa! We didn’t need an input portfolio, we applied one matrix directly to the other.

The beauty of linear algebra is representing an entire spreadsheet calculation with a single letter. Want to apply the same transformation a few times? Use N2 or N3.

Yes, because you asked nicely. Our “mini arithmetic” seems limiting: multiplications, but no addition? Time to expand our brains.

Imagine adding a dummy entry of 1 to our input: (x, y, z) becomes (x, y, z, 1).

Now our operations matrix has an extra, known value to play with! If we want x + 1 we can write:

[1 0 0 1]


And x + y - 3 would be:

[1 1 0 -3]


Huzzah!

Want the geeky explanation? We’re pretending our input exists in a 1-higher dimension, and put a “1” in that dimension. We skew that higher dimension, which looks like a slide in the current one. For example: take input (x, y, z, 1) and run it through:

[1 0 0 1]
[0 1 0 1]
[0 0 1 1]
[0 0 0 1]


The result is (x + 1, y + 1, z + 1, 1). Ignoring the 4th dimension, every input got a +1. We keep the dummy entry, and can do more slides later.

Mini-arithmetic isn’t so limited after all.

## Onward

I’ve overlooked some linear algebra subtleties, and I’m not too concerned. Why?

These metaphors are helping me think with matrices, more than the classes I “aced”. I can finally respond to “Why is linear algebra useful?” with “Why are spreadsheets useful?”

They’re not, unless you want a tool used to attack nearly every real-world problem. Ask a businessman if they’d rather donate a kidney or be banned from Excel forever. That’s the impact of linear algebra we’ve overlooked: efficient notation to bring spreadsheets into our math equations.

Happy math.

# Math As Language: Understanding the Equals Sign

It’s easy to forget math is a language for communicating ideas. As words, “two and three is equal to five” is cumbersome. Replacing numbers and operations with symbols helps: “2 + 3 is equal to 5”.

But we can do better. In 1557, Robert Recorde invented the equals sign, written with two parallel lines (=), because “noe 2 thynges, can be moare equalle”.

“2 + 3 = 5” is much easier to read. Unfortuantely, the meaning of “equals” changes with the context — just ask programmers who have to distinguish =, == and ===.

A “equals” B is a generic conclusion: what specific relationship are we trying to convey?

Simplification

I see “2 + 3 = 5” as “2 + 3 can be simplified to 5”. The equals sign transitions a complex form on the left to an equivalent, simpler form on the right.

Temporary Assignment

Statements like “speed = 50” mean “the speed is 50, for this scenario”. It’s only good for the problem at hand, and there’s no need to remember this “fact”.

Fundamental Connection

Consider a mathematical truth like a2 + b2 = c2, where a, b, and c are the sides of a right triangle.

I read this equals sign as “must always be equal to” or “can be seen as” because it states a permanent relationship, not a coincidence. The arithmetic of 32 + 42 = 52 is a simplification; the geometry of a2 + b2 = c2 is a deep mathematical truth.

The formula to add 1 to n is:

$\displaystyle{\frac{n(n+1)}{2}}$

which can be seen as a type of geometric rearrangement, combinatorics, averaging, or even list-making.

Factual Definition

Statements like

$\displaystyle{e = \lim_{n\to\infty} \left( 1 + \frac{100\%}{n} \right)^n}$

are definitions of our choosing; the left hand side is a shortcut for the right hand side. It’s similar to temporary assignment, but reserved for “facts” that won’t change between scenarios (e always has the same value in every equation, but “speed” can change).

Constraints

Here’s a tricky one. We might write

x + y = 5

x – y = 3

which indicates conditions we want to be true. I read this as “x + y should be 5, if possible” and “x – y should be 3, if possible”. If we satisfy the constraints (x=4, y=1), great!

If we can’t meet both goals (x + y = 5; 2x + 2y = 9) then the equations could be true individually but not together.

## Example: Demystifying Euler’s Formula

Untangling the equals sign helped me decode Euler’s formula:

$\displaystyle{e^{i \cdot \pi} = -1}$

A strange beast, indeed. What type of “equals” is it?

A pedant might say it’s just a simplification and break out the calulus to show it. This isn’t enlightening: there’s a fundamental relationship to discover.

e^i*pi refers to the same destination as -1. Two fingers pointing at the same moon.

They are both ways to describe “the other side of the unit circle, 180 degrees away”. -1 walks there, trodding straight through the grass, while e^i*pi takes the scenic route and rotates through the imaginary dimension. This works for any point on the circle: rotate there, or move in straight lines.

Two paths with the same destination: that’s what their equality means. Move beyond a generic equals and find the deeper, specific connection (“simplifies to”, “has been chosen to be”, “refers to the same concept as”).

Happy math.

# Why Do We Learn Math?

I cringe when hearing "Math teaches you to think".

It's a well-meaning but ineffective appeal that only satisfies existing fans (see: "Reading takes you anywhere!"). What activity, from crossword puzzles to memorizing song lyrics, doesn't help you think?

Math seems different, and here's why: it's a specific, powerful vocabulary for ideas.

Imagine a cook who only knows the terms "yummy" and "yucky". He makes a bad meal. What's wrong? Hrm. There's no way to describe it! Too mild? Salty? Sweet? Sour? Cold? These specific critiques become hazy variations of the "yucky" bucket. He probably wouldn't think "Needs more umami".

Words are handholds that latch onto thoughts. You (yes, you!) think with extreme mathematical sophistication. Your common-sense understanding of quantity includes concepts refined over millennia: base-10 notation, zero, decimals, negatives.

What we call "Math" are just the ideas we haven't yet internalized.

Let's explore our idea of quantity. It's a funny notion, and some languages only have words for one, two and many. They never thought to subdivide "many", and you never thought to refer to your East and West hands.

Here's how we've refined quantity over the years:

• We have "number words" for each type of quantity ("one, two, three... five hundred seventy nine")
• The "number words" can be written with symbols, not regular letters, like lines in the sand. The unary (tally) system has a line for each object.
• Shortcuts exist for large counts (Roman numerals: V = five, X = ten, C = hundred)
• We even have a shortcut to represent emptiness: 0
• The position of a symbol is a shortcut for other numbers. 123 means 100 + 20 + 3.
• Numbers can have incredibly small, fractional differences: 1.1, 1.01, 1.001...
• Numbers can be negative, less than nothing (Wha?). This represents "opposite" or "reverse", e.g., negative height is underground, negative savings is debt.
• Numbers can be 2-dimensional (or more). This isn't yet commonplace, so it's called "Math" (scary M).
• Numbers can be undetectably small, yet still not zero. This is also called "Math".

Our concept of numbers shapes our world. Why do ancient years go from BC to AD? We needed separate labels for "before" and "after", which weren't on a single scale.

Why did the stock market set prices in increments of 1/8 until 2000 AD? We were based on centuries-old systems. Ask a modern trader if they'd rather go back.

Why is the decimal system useful for categorization? You can always find room for a decimal between two other ones, and progressively classify an item (1, 1.3, 1.38, 1.386).

Why do we accept the idea of a vacuum, empty space? Because you understand the notion of zero. (Maybe true vacuums don't exist, but you get the theory.)

Why is anti-matter or anti-gravity palatable? Because you accept that positives could have negatives that act in opposite ways.

How could the universe come from nothing? Well, how can 0 be split into 1 and -1?

Our math vocabulary shapes what we're capable of thinking about. Multiplication and division, which eluded geniuses a few thousand years ago, are now homework for grade schoolers. All because we have better ways to think about numbers.

We have decent knowledge of one noun: quantity. Imagine improving our vocabulary for structure, shape, change, and chance. (Oh, I mean, the important-sounding Algebra, Geometry, Calculus and Statistics.)

Caveman Chef Og doesn't think he needs more than yummy/yucky. But you know it'd blow his mind, and his cooking, to understand sweet/sour/salty/spicy/tangy.

We're still cavemen when thinking about new ideas, and that's why we study math.

# A Brief Introduction to Probability & Statistics

I’ve studied probability and statistics without experiencing them. What’s the difference? What are they trying to do?

This analogy helped:

• Probability is starting with an animal, and figuring out what footprints it will make.
• Statistics is seeing a footprint, and guessing the animal.

Probability is straightforward: you have the bear. Measure the foot size, the leg length, and you can deduce the footprints. “Oh, Mr. Bubbles weighs 400lbs and has 3-foot legs, and will make tracks like this.” More academically: “We have a fair coin. After 10 flips, here are the possible outcomes.”

Statistics is harder. We measure the footprints and have to guess what animal it could be. A bear? A human? If we get 6 heads and 4 tails, what’re the chances of a fair coin?

## The Usual Suspects

Here’s how we “find the animal” with statistics:

Get the tracks. Each piece of data is a point in “connect the dots”. The more data, the clearer the shape (1 spot in connect-the-dots isn’t helpful. One data point makes it hard to find a trend.)

Measure the basic characteristics. Every footprint has a depth, width, and height. Every data set has a mean, median, standard deviation, and so on. These universal, generic descriptions give a rough narrowing: “The footprint is 6 inches wide: a small bear, or a large man?”

Find the species. There are dozens of possible animals (probability distributions) to consider. We narrow it down with prior knowledge of the system. In the woods? Think horses, not zebras. Dealing with yes/no questions? Consider a binomial distribution.

Look up the specific animal. Once we have the distribution (“bears”), we look up our generic measurements in a table. “A 6-inch wide, 2-inch deep pawprint is most likely a 3-year-old, 400-lbs bear”. The lookup table is generated from the probability distribution, i.e. making measurements when the animal is in the zoo.

Make additional predictions. Once we know the animal, we can predict future behavior and other traits (“According to our calculations, Mr. Bubbles will poop in the woods.”). Statistics helps us get information about the origin of the data, from the data itself.

Ok! The metaphor isn’t perfect, but more palatable than “Statistics is the study of the collection, organization, analysis, and interpretation of data”. Need proof? Let’s see if we can ask intuitive “I tasted it!” questions:

• What are the most common species? (Common distributions)
• Are new ones being discovered?
• Can we predict the next footprint? (Extrapolation)
• Are the tracks following a path? (Regression / trend line)
• Here’s two tracks, which animal was faster? Bigger? (Data from two drug trials: which was more effective?)
• Is one animal moving in the same direction as another? (Correlation)
• Are two animals tracking a common source? (Causation: two bears chasing the same rabbit)

These questions are much deeper than what I pondered when first learning stats. Every dry procedure now has a context: are we learning a new species? How to take the generic footprint measurements? How to make a table from a probability distribution? How to lookup measurements in a table?

Having an analogy for the statistics process makes later data crunching click. Happy math.

PS. The forwards-backwards difference between probability and statistics shows up all over math. Some procedures are easy to do (derivatives) but difficult to undo (integrals). (Thanks Denis)

# Understanding Algebra: Why do we factor equations?

What’s algebra about? When learning about variables (x, y, z), they seem to “hide” a number:

$\displaystyle{x + 3 = 5}$

What number could be hiding inside of x? 2, in this case.

It seems that arithmetic still works, even when we don’t have the exact numbers up front. Later on, we might arrange these “hidden numbers” in complex ways:

$\displaystyle{x^2 + x = 6}$

Whoa — a bit harder to solve, but it’s possible. Today let’s figure out how factoring works and why it’s useful.

## Polynomials

When we write a polynomial like “x^2 + x = 6”, we can think at a higher level.

We have an unknown number, x, which interacts with itself (x * x = x^2). We add in the original number (+ x) and the result is 6.

x^2, x and 6 are all “numbers”, but now we’re keeping track of how they’re made:

• x^2 is a component interacting with itself
• x is a component on its own
• 6 is the desired state we want the entire system to become

After the interactions are finished, we should get 6. What number could be hiding inside of x to make this true?

Hrm — this is tricky. So let’s fight with a trick of our own: we can make a different system to track the error in our original one (this is mind-bending, so hang on).

Our original system is x^2 + x. The desired state is 6. A new system:

$\displaystyle{x^2 + x - 6}$

will track the difference between the original system and the desired state. When are we happiest? When there’s no difference:

$\displaystyle{x^2 + x - 6 = 0}$

Ah! that’s why we’re so interested in setting polynomials to zero! If we have a system and the desired state, we can make a new equation to track the difference — and try make it zero. (This is deeper than just “subtract 6 from both sides” — we’re trying to describe the error!)

But… how do we actually get the error to zero? It’s still a jumble of components: x^2, x and 6 are flying everywhere.

## Factor That Mamma Jamma

Factoring the rescue. My intuition: factoring lets us re-arrange a complex system (x^2 + x – 6) as a bunch of linked, smaller systems.

Imagine taking a pile of sticks (our messy, disorganized system) and standing them up so they support each other, like a teepee:

/\

(That’s a 2-d example, with two sticks).

Remove any stick and the entire structure collapses. If we can rewrite our system:

$\displaystyle{x^2 + x - 6 = 0}$

as a series of multiplications:

$\displaystyle{Component \ A \cdot Component \ B = 0}$

we’ve put the sticks in a “teepee”. If Component A or Component B becomes 0, the structure collapses, and we get 0 as a result.

Neat! That is why factoring rocks: we re-arrange our error-system into a fragile teepee, so we can break it. We’ll find what obliterates our errors and puts our system in the ideal state.

Remember: We’re breaking the error in the system, not the system itself.

## Onto The Factoring

Learning to “factor an equation” is the process of arranging your teepee. In this case:

\begin{align*} x^2 + x - 6 &= (x + 3)(x -2) \\ &= Component \ A \cdot Component \ B \end{align*}

If x = -3 then Component A falls down. If x = 2, Component B falls down. Either value causes the error to collapse, which means our original system (x^2 + x, the one we almost forgot about!) meets our requirements:

• When x = -3, the error collapses, and we get (-3)2 + -3 = 6
• When x = 2, the error collapses, and we get 22 + 2 = 6

## Putting It All Together

I’ve wondered about the real purpose of factoring for a long, long time. In algebra class, equations are conveniently set to zero, and we’re not sure why. Here’s what happens in the real world:

• Define the model: Write how your system behaves (x^2 + x)
• Define the desired state: What should it equal? (6)
• Define the error: The error is its own system: Error = actual – desired (i.e., x^2 + x – 6)
• Factor the error: Rewrite the error as interlocking components: (x + 3)(x – 2)
• Reduce the error to zero: Zero out one component or the other (x = -3, or x = 2).

When error = 0, our system must be in the desired state. We’re done!

Algebra is pretty darn useful:

• Our system is a trajectory, the “desired state” is the target. What trajectory hits the target?
• Our system is our widget sales, the “desired state” is our revenue target. What amount of earnings hits the goal?
• Our system is the probability of our game winning, the “desired state” is a 50-50 (fair) outcome. What settings make it a fair game?

The idea of “matching a system to its desired state” is just one interpretation of why factoring is useful. If you have more, I’d like to hear them!

## Appendix

A cheatsheet for the process:

Some more food for thought:

• Multiplication is often seen as AND. Component A must be there AND Component B must be there. If either condition is false, the system breaks.

• The Fundamental Theorem of Algebra proves you have as many “components” as the highest polynomial. If your highest term is x^4, then you can factor into 4 interlocked components (discussion for another day). But this should make sense: if you rewrite an “x^4 system” into multiplications, shouldn’t there be 4 individual “x components” being multiplied? If there were 3, you could never get to x^4, and if there were 5, you’d overshoot and get an x^5 term.

• Do you have a real-world system in a “teepee” arrangement, where a single failing component collapses the entire structure?

• The quadratic formula can “autobreak” any system with x^2, x and constant components. There’s formulas for complex systems (with x^3, x^4, or even some x^5 components) but they start to get a bit crazy.

• Is there any way to prevent a system from having these weak points? (Unfactorable? Non-zeroable?). Don’t forget, we thought systems like x^2 + 1 were “non-zeroable” until imaginary numbers came along.

Happy math.