a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment
wasoxygen  ·  3172 days ago  ·  link  ·    ·  parent  ·  post: Roots, Roots!

That's really something. I didn't know what to expect, but it wasn't that.

Can you talk us through this, in Fisher-Price math? Let me see how far I can get on my own.

A complex number, like 2 + 3i, has a real (2) and imaginary (3i) part. The real part is simple enough, and we can pretend the i in the imaginary part is just another variable like x, except that when two i's get multiplied together they change into a -1.

You wrote a program to solve an equation, actually a lot of equations. Let's start with one equation. A simple polynomial might have the form ax² + bx + c = something, you didn't say what but I'll guess it's zero.

You restricted the coefficients, a, b, and c to the values 1 and -1. Each of the three coefficients can take two values, so we should get 2 × 2 × 2 = 8 equations.

   1x² + 1x + 1 = 0

1x² + 1x - 1 = 0

1x² - 1x + 1 = 0

1x² - 1x - 1 = 0

-1x² + 1x + 1 = 0

-1x² + 1x - 1 = 0

-1x² - 1x + 1 = 0

-1x² - 1x - 1 = 0

To find solutions, we ask what values x can take that give true equations. Considering real numbers first, we might be lazy and plot all eight equations on a graph and see where they cross the x-axis.

We find four values of x that work, each time yielding zero in two different polynomials. The highest is near x = 1.618, where the fourth and fifth polynomials both equal zero. In other words,

  1x² - 1x - 1 = -1x² + 1x + 1

so

  2x² - 2x - 2 =  0

or

  x² - x - 1 =  0

Now we turn to the quadratic formula to solve for x:

  x = (-b ± √(b² - 4ac)) / 2a 

= (1 ± √(1 - 4(1)(-1)))/2

= (1 ± √5)/2

which, in agreement with the graph, is about -0.618 and 1.618, the latter of which is phi, the golden ratio. I thought that number looked familiar.

So we could plot these values on a number line, but it would be two boring dots.

So let's consider complex numbers. Now x can have two parts, one a real number like before and the other imaginary. For the first equation, 1x² + 1x + 1 = 0, we need the imaginary part or it's hopeless, because the sum is always positive if x is real. If x is complex, the equation takes the form 1(a + b)² + (a + b) + 1 = 0, and when we solve it we will change any b² to a -1 and hopefully the b coefficient will be zero at the end because we're trying to get to zero and there's no i in zero.

So

  a² + 2ab + b² + a + b + 1 = 0

a² + 2ab - 1 + a + b + 1 = 0

a² + 2ab + a + b = 0

a² + a + 2ab + b = 0

a² + a + b(2a + 1) = 0

Maybe now we just assume b is zero so that part drops out, and

  a² + a = 0

a(a + 1) = 0

and a = 0 or -1. But those don't satisfy the first equation, so maybe it was a bad assumption and this equation has no complex roots.

How about the second one, 1x² + 1x - 1 = 0. It has two real roots, near x = -1.618 and x = 0.618. If x is complex, it takes the form

  1(a + b)² + 1(a + b) - 1 = 0

a² + ab + b² + a + b - 1 = 0

a² + ab - 1 + a + b - 1 = 0

a² + ab + a + b - 2 = 0

a² + a + ab + b - 2 = 0

a² + a + b(a + 1) - 2 = 0

b(a + 1) = 2 - a² - a

b = (2 - a² - a) / (a + 1)

and cheating again with the graphing tool I find that when a = -2 or 1 the b equals zero.

So that gives me x = (-2 + 0i) and x = (1 + 0i), but these are both real. Is my Fisher-Price arithmetic off, or did I get off track by assuming you would set the polynomials to zero, or perhaps do things only get interesting in the higher degree polynomials?