# Root Finding Methods By now you've learned the quadratic formula to find the roots of a second degree polynomial. $$ x=\frac{-b \pm \sqrt{b^2-4ac}}{2a} $$ This works nicely if we're given the function $f(x)$. However, how would you solve for $x$ if you were given experimental data? In this section we will cover bracketing and open methods to find roots of a function. Let us take a step back and think *algorithmically*. To find a root numerically, we can implement a search algorithm. Let's consider a small phone book - a database of names and numbers sorted alphabetically by last name. Our goal is to find the phone number of James Watt (our root). We could make an algorithm that starts at the the first page, checks to see if the current name equals our target (Watt), if it doesn't, check the next entry. This is method is called *incremental search*. As you may see, this can take very long if the database is large. > [!NOTE] Example Phonebook Database Entries > **A** – Archimedes > **B** – Bernoulli > **C** – Curie > **D** – Darwin > **E** – Einstein > **F** – Feynman > **G** – Galileo > **H** – Hubble > **I** – Ibn Sina > **J** – Joule > **K** – Kelvin > **L** – Leonardo > **M** – Maxwell > **N** – Newton > **O** – Oppenheimer > **P** – Pascal > **Q** – Quetelet > **R** – Röntgen > **S** – Schrödinger > **U** – Urey > **V** – Volta > **W** – Watt > **X** – Xenophon > **Y** – Yukawa > **Z** – Zuse Another approach may be to index the book and jump straight to the 'W' names however this requires two steps. When # Bracketing Method ## Incremental Search Incremental search ## Bisection This method start by sectioning the database into two halves. We can do this with a phone book by simply opening it in the middle of the book. In our data set, we have find the middle entry to be 'M - Maxwell'. Based on the premises that all names are sorted alphabetically we can conclude that we will find our target in the second half, essentially eliminating the first half. Doing this a second time gives us our new midpoint 'S – Schrödinger' and a third time get us to our target 'W - Watt'. In only 3 iterations we have reached out target goal. This is a huge improvement from the Incremental search (22 iterations) versus our new 3 iterations. This exact same concept can be applied to finding roots of functions. Instead of searching for strings we are searching for floats. For computers this is a lot easier to do. Take a moment to think about how you would write psuedo-code to program this. > The **Intermediate Value Theorem** says that if f(x) is a continuous function between a and b, and sign(f(a))≠sign(f(b)), then there must be a c, such that a