Solving Quadratic Equations (by brain):
You have to make one side equal zero. Because if one side is zero, one (or both) of the factors has to be zero. Then you find the 2 (or sometimes 1) value(s) of x, and you take the one you want.
1. If the equation is in the form (ax + b)^2 = 0
This means that ax + b = 0
-> ax = -b
-> x = (-b)/a
2. If the equation is in the form (ax + b)(cx + d) = 0
This means that either ax + b = 0 or cx + d = 0
First, assume ax1 + b = 0 (x1 and x2 are the possible values of x)
-> x1 = (-b)/a
and then cx2 + d = 0
-> x2 = (-d)/c
So now you have x1 and x2. But you only want one. This is where it comes down to common sense. (eg: can’t have negative amounts of people etc.) Look back to the situation.
3. If the equation is in the form ax^2 + bx + c = 0
You need to get this into factorised form.
Find two numbers (d and e) that match the following equations:
de = ac (and therefore: d/a = e/c, which is important later)
d+e = b
Now you can rearrange the formula to this:
ax^2 + dx + ex + c = 0
Factorise the first two terms, and the last two terms seperately:
ax^2 + dx = ax(x + d/a)
ex + c = e(x + c/e)
And because d/a = c/e (as shown above), we’ll make it easier by having f = d/a = c/e.
The new equations:
ax(x + f)
e(x + f)
And now to add them together again:
ax(x + f) + e(x + f) = 0
(ax + e)(x + f) = 0
Now continue with method #2 above.
4. For other equations
Rearrange into ax^2 + bx + c = 0, then use method #3.
Note: For programming purposes, use the quadratic formula.