# 1.3: Quadratic Equations

- Page ID
- 6786

Any reader of this book will know that the solutions to the quadratic equation

\[ax^2 + bx + c = 0 \label{1.3.1}\]

are

\[x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \label{1.3.2}\]

and will have no difficulty in finding that the solutions to

\[2.9x^2 - 4.7x + 1.7 = 0 \nonumber\]

are

\[x = 1.0758 \text{ or } 0.5449. \nonumber\]

We are now going to look, largely for fun, at two alternative iterative numerical methods of solving a quadratic equation. One of them will turn out not to be very good, but the second will turn out to be sufficiently good to merit our serious attention.

In the first method, we re-write the quadratic equation in the form

\[x = \frac{-\left(ax^2 + c \right)}{b} \nonumber\]

We guess a value for one of the solutions, put the guess in the right hand side, and hence calculate a new value for \(x\). We continue iterating like this until the solution converges.

For example, let us guess that a solution to the equation \(2.9x^2 − 4.7x + 1.7 = 0\) is \(x = 0.55\). Successive iterations produce the values

\begin{array}{c c}

0.54835 & 0.54501 \\

0.54723 & 0.54498 \\

0.54648 & 0.54496 \\

0.54597 & 0.54495 \\

0.54562 & 0.54494 \\

0.54539 & 0.54493 \\

0.54524 & 0.54493 \\

0.54513 & 0.54494 \\

0.54506 & 0.54492 \\

\nonumber

\end{array}

We did eventually arrive at the correct answer, but it was very slow indeed even though our first guess was so close to the correct answer that we would not have been likely to make such a good first guess accidentally.

Let us try to obtain the second solution, and we shall try a first guess of 1.10, which again is such a good first guess that we would not be likely to arrive at it accidentally. Successive iterations result in

\begin{array}{c}

1.10830 \\

1.11960 \\

1.13515 \\

\nonumber

\end{array}

and we are getting further and further from the correct answer!

Let us try a better first guess of 1.05. This time, successive iterations result in

\begin{array}{c}

1.04197 \\

1.03160 \\

1.01834 \\

\nonumber

\end{array}

Again, we are getting further and further from the solution.

No more need be said to convince the reader that this is not a good method, so let us try something a little different.

We start with

\[ax^2 + bx = -c \label{1.3.3}\]

Add \(ax^2\) to each side:

\[2ax^2 + bx = ax^2 - c \label{1.3.4}\]

or \[(2ax + b)x = ax^2 - c \label{1.3.5}\]

Solve for \(x\): \[x = \frac{ax^2-c}{2ax+b} \label{1.3.6}\]

This is just the original equation written in a slightly rearranged form. Now let us make a guess for \(x\), and iterate as before. This time, however, instead of making a guess so good that we are unlikely to have stumbled upon it, let us make a very stupid first guess, for example \(x = 0\). Successive iterations then proceed as follows.

\begin{array}{c}

0.00000 \\

0.36170 \\

0.51751 \\

0.54261 \\

0.54491 \\

0.54492 \\

\nonumber

\end{array}

and the solution converged rapidly in spite of the exceptional stupidity of our first guess. The reader should now try another very stupid first guess to try to arrive at the second solution. I tried \(x = 100\), which is very stupid indeed, but I found convergence to the solution \(1.0758\) after just a few iterations.

Even although we already know how to solve a quadratic equation, there is something intriguing about this. What was the motivation for adding \(ax^2\) to each side of the equation, and why did the resulting minor rearrangement lead to rapid convergence from a stupid first guess, whereas a simple direct iteration either converged extremely slowly from an impossibly good first guess or did not converge at all?