Wednesday, September 2, 2009

Quadratic formula

I have one last post on the topic of "simple math." The quadratic equation which we can use to find the roots of an equation like:

ax2 + bx + c = 0

is well-known to anyone who has studied algebra. It is:

[ -b +/- √(b2 - 4ac) ] / 2a

So where does this come from? As detailed in the wikipedia entry, it comes from the method of "completing the square." The idea is that if we can transform the first equation above to:

x2 + 2hx + h2 = something

Then the left-hand side is

(x + h)2

If we take the square root of the right side and subtract h, we've solved for x. The first step is to divide by a (which is non-zero or we wouldn't be bothering with this) and move the constant part to the right side:

x2 + (b/a)x = -c/a

So the h we are looking for is:

h = b/2a

We need to add h2, like so:

x2 + (b/a)x + b2/4a2 = - c/a + b2/4a2
(x + b/2a)2 = -c/a + b2/4a2

Express the right side as a single fraction

(x + b/2a)2 = - 4ac/4a2 + b2/4a2
(x + b/2a)2 = (b2 - 4ac) / 4a2

Take square roots and isolate x:

x + b/2a = +/- √(b2 - 4ac) / 2a
x = [-b +/- √(b2 - 4ac) ] / 2a

As quoted in the wikipedia entry:
To the absolute number multiplied by four times the [coefficient of the] square, add the square of the [coefficient of the] middle term; the square root of the same, less the [coefficient of the] middle term, being divided by twice the [coefficient of the] square is the value.
(Brahmasphutasiddhanta (Colebrook translation, 1817, page 346)

I am puzzled by the little problem of the sign of the term 4ac in this quoted version. [UPDATE: I see. <Bonks self on head> They just set up the equation with c on the right-hand side to start with]