Table of Contents

Mathematical Maturity

Trivial example

One of the earliest awakenings of my mathematical maturity was when I was a kid, thinking one of the simplest equations there is:

$$ a\cdot x = b$$

I knew how to solve this 99% of the time:

$$x = b / a$$

Is this correct? Let's take the equation $2\cdot x = 6$:

How much simpler can it get? Clearly there is not much more to it. This works 99% of the time. No matter what two numbers I pick, it always works. The evidence is overwhelming.

However, threre is that pesky 1% chance of division by zero. What do we do with it? Not much of a problem if $b = 0$, since the solution $x = 0$ still works. But if $a = 0$ then we enter a truly strange land. If we take $a = 0$ and $b = 3$, no matter what choice we make for $x$ we get a nonsensical answer $0 = 3$. On the other hand, if both $a = 0$ and $b = 0$, any choice for $x$ yields $0 = 0$ which is… seemingly true. What's going on? Looks like there is a lot more structure to this equation than I thought. Let's map all the possible cases:

Okay, from a simple straightforward computation we now have a decision tree. This is a bit surprising considering my goal was to find an answer to a simple equation like $a\cdot x = b$.

Analogy with programming

As a kid, I always found programming easier than mathematics. So let's translate into programming. My algorithm for solving $a\cdot x = b$ was simple, yet causing my program to crash:

float solve_for_x(float a, float b)
{
    return b / a;
}

To avoid the crash, the algorithm will have to be upgraded:

std::set<float> solve_for_x(float a, float b)
{
    if (a != 0) {
        return { b / a };
    } else {
        if (b == 0) {
            return set::set_of_all_floats;
        } else {
            return std::empty_set;
        }
    }
}