‘Completing the square’ really isn’t that hard.
So we’ve got this generating function for Fibonacci numbers:
‘Why the heck is that simpler?’ you ask. Because by doing this, you reduce the degree/power of the numerator (A/B) or denominator (something/else). In this case, we wanna simplify that bottom part by factoring. Well, where do you start?
There’s a handy little theorem called ‘the factor theorem’. All it says is: for an equation in x, if ‘r’ is a root, then (x-r) is a factor. So if we find the roots of
then we can find factors for it. It probably sounds like I’m jumping from point to point, so:
- Want to simplify the fraction at the top. So use partial fractions.
- If we want to use partial fractions, we need factors for them.
- If we want factors, we need to find roots.
What the hell is a root of an equation anyway? Well, for an equation in x, the roots are the values of x which give the equation a value of 0. By plottingfor a range of x, you can kinda get a ballpark idea of what the roots are. They’re where the line crosses the x-axis (or, where ‘y’ = 0). But rather than use trial and error, there’s a general formula that involves a nifty little trick called ‘completing the square’.
Quadratic equation (geometric method)
‘Quad’ is Latin for square, so quadratic equations are just equations which have x² as the highest power. And it turns out that quite a few solutions to equations have clear geometric interpretations.
History digression: there was a fellow named Al-Khwārizmī, who came up with a lot of these geometric solutions. His name is also where ‘algorithm’ comes from, and ‘algebra’ comes from the word al-ğabr in the title of one of his books. It’s Arabic for ‘restoration/balance’, which is kinda nice.
Aaaaanyhoo, this is how to find the root of any quadratic which has the form x²+bx = a. Essentially, getting x on its own on one side of the equation. For example, x²+bx = a is the same as:
Cool, huh? So, for a quadratic equation of the form x²+bx=a, the root (in this case, x) is:
General quadratic equation (algebraic method)
Thankfully though, most of the work is already done. To get this into the form of x²+bx=a (so we can just complete the square for it), we move c over to the other side, and then divide the whole equation by a:
- x² is just x² (or, the coefficient is just 1).
- x has a coefficient.
- The right-hand side of the equation has a constant (a number, not a variable).
So now, you just do the same thing you did for the geometric method. You add (half of the coefficient of x) squared, to both sides. Top is what you get when you do this to the general quadratic equation, below is what we got when did it to the regular quadratic equation. Exactly the same form:
And since they’re the same form, it means the quadratic can be factorized similarly (the bit in the .gif where you stop thinking of it as four separate shapes and just consider it as a square with a particular length side). Like so:
Plug the coefficients a,b and the constant c into that formula, and we’ll get our roots of 1-x-x²!
Since it’s a root, it has two values (the root of 5 can be positive or negative). So the two roots of our equation are:
These values are phi / the golden ratio, in flavour, but not exactly. The two values of phi are 1.61… and -0.61… our values ‘a’ and ‘b’ are the inverse (1/phi) of these! Which reminds me: phi has some interesting properties. 1/phi = phi-1. That shit is weird. But neat.
Next step is to put these roots into factors, and put those factors into a partial fraction. And also to come up with another sequel-based title for the next post. Stay tuned.