Thursday, 7 July 2016

Cubic Formula Analysis

This story starts over four months ago, with two different tweets that were sent out within 48 hours of each other. One by Megan Schmidt, referencing the cubic formula, the other by Doug Robertson, referencing gospel.

Twenty-four hours later, I had the math parody ready to go for February 29th. It was posted directly to my math comic blog, rather than being placed into the music parody archive, because I hadn’t had time to actually verify the maths yet. I wanted to run the formula on an equation, to make sure it actually produced all three roots as I advertised. I figured I’d do that over the March Break, and maybe produce a video.

Instead, I fell down this rabbit hole. To see my conclusions, skip to “Actual Analysis” below. To follow the journey, keep reading.


THE FORMULA FAILED


Given y = ax^3 + bx^2 + cx + d, I wanted different values for each coefficient, and ideally some nice whole number roots. Expanding (x+1)(x-1)(x-2) felt like it would work, and indeed it means a=1, b=-2, c=-1, d=2 (all different but small). I plugged them into the formula... and I did not get -1, 1, and 2. Rather, I got -1/3, 2/3 and 7/3.

That wasn’t supposed to happen.


After poking at the maths, I decided my problem was the negative square roots that had turned up. I’d actually had to turn to ‘wolfram alpha’ to take the cube roots of those complex numbers; maybe I’d entered it wrong. This would probably be easier if I kept that nested square root ‘positive’. After swapping all the signs (multiplying by -1) and seeing that wouldn’t fix it, I moved my calculations off of a paper bag and onto actual lined paper.

I focussed on what was under the square root. I would later call this the “root discriminant” of the cubic formula. One piece of it is already squared, no problem, that’s positive, ignore it. To get a positive result overall, I needed c/(3a) to be larger than b^2/(3a)^2. Except with the latter also being squared (always positive), this meant “a” and “c” HAD to be the same sign. Huh.

I played around with some other expansions of factored form. At first those signs were wrong, or some coefficients were zero, or they weren’t unique numbers. Then I found one that worked: (x+2)(x+3)(x+4) But it still produced a negative root result. At this point in my notes I’ve scribbled “a can’t be +-1”, which is kind of silly in retrospect.

I kept going, further scribbles being “need smaller abs(b) vs. (c)” and “3ac>b^2”. To my horror, I began to suspect that the root would always be negative, so long as I was feeding in three real solutions. I played with some sliders in Desmos, then decided I should contrast with cubic formulas which had only one functional root instead (also verified in Desmos).

Working with y1 = 2x^3 - 3x^2 - x - 2, which is solved when x=2, produced a positive square root overall. But it led to doing cube roots of nasty fractions, and the decimal approximations were NOT giving me the answer x=2 (closer to x=1.68). I started to think maybe the formula ITSELF was wrong. (The internet, unreliable? What?!)


FORMULA VARIATIONS


The previous work wasn’t done all in one sitting. I’d already given up on having this done through March Break. One weekend, while heading into school for a play rehearsal, I stopped in a food court and started tackling other formula variations I’d discovered online. For instance, one that separated out the three x1, x2 and x3 solutions, and another that used expressions for q, p and r to simplify the formula overall.

None of them worked with my y1 equation (above). Worse, they were giving me different solutions. Depending on which formula variation I used, I either got x=1.68 or x=2.13 or x=2.29. But the solution is TWO, dammit! I checked my math, found a mistake, it didn’t fix the problem. Surely the issue was the “cube root of fractions” step, which I was approximating on my calculator (to 8 decimal places).

This was going to take more time than I had. Easter Break, at the end of March, wouldn’t help. I had to use it to bank a bunch of my math comics, in anticipation of being at school for 25 days straight due to the play. While still writing 2,000 words/week on my serial. Yeah. So after downloading some plausible “cube” footage on March 26th for that later video, I shelved the whole project.


It resurfaced briefly in May, when I put together a Cubic Formula Song Powerpoint for my MCT class. (We were finishing our Polynomials unit at the time.) This despite my unfounded reservations about the formula. The performance went fine; as a student remarked, “It just kept growing!”.

The project resurfaced again in June, when John Golden tweeted out something about the cubic formula - except his formula image looked DIFFERENT from any of the others. Time to get back into actual research. As motivation, I decided I would do a presentation of the song on the last day of my MCR class, if it felt right.


ACTUAL ANALYSIS


I’d realized that “a” only ever appears in the denominator. This is different from the quadratic formula, where we have -4ac. But from the research, it makes total sense. The first step in developing the cubic formula is to divide everything by “a”, creating a simpler problem, namely x^3 + Bx^2 + Cx + D = 0. (As noted, it makes my “a can’t be 1” remark above rather silly.)

The next step in creating the formula seemed to be developing a depressed cubic, by substituting in a different value for “x” to get rid of the squared term, effectively giving you m^3 + Jm + K = 0, where once you have the “m” you can reverse determine “x” from there. That made sense, but didn’t really help me grab numbers for an example.

This was when I discovered the “cubic discriminant”. It seems to have it's own definition that synchs with the quadratic, but had me consider the piece under the square root - a "root discriminant", if you will. And I had been correct - for there to be 3 real solutions, that "root discriminant" had to be NEGATIVE. Conversely, if it was POSITIVE, that meant there would be only one real solution (the other two solutions would be imaginary). Again, this made some sense to me. If you picture cube roots equidistant from each other on the polar plane, only one root can land where b*i=0.



But there’s a third case. If my "root discriminant" is ZERO, this means you get at least a double root. That’s honestly *the only way* to avoid either doing cube roots of imaginary numbers, or having imaginary answers as solutions. Wonderful. (It also meant Golden’s found formula was invalid, as the cubic discriminant, which appears twice, had an invalid sign one of those times.)

There was even this “wikihow” website showing how to do the steps by hand. With renewed faith, I sang the song for the few 3Us who were there the last day of class, then shelved this project AGAIN until after exams - I was SO behind in my marking.


FINAL RESULT


July 2016. The website “SOSMath” offered a cubic formula with x=3 as the only solution. I tried the formula, and it worked, despite ugly radicals. (I don’t know why I was having such trouble before.) The last hurdle was a formula with a “cubic discriminant” of zero that would work nicely. I created one... for some reason, it didn’t work?! ... Damn sign error. Okay. Good to go!

And that's the story. The final video will premiere within the next 3-4 days; I’ve linked to it here. I’m still maintaining weekly posts on three blogs (including here), that’s holding me back a bit. Thanks for reading, feel free to check out some of my fiction writing too!

No comments:

Post a Comment